milanmarkovic Posted October 25, 2016 Share Posted October 25, 2016 Hi, is it posible to get ids for all homefeatured products that are listed in homepage via javascript code after page is loaded? Thanks Link to comment Share on other sites More sharing options...
vekia Posted October 25, 2016 Share Posted October 25, 2016 Hi, is it posible to get ids for all homefeatured products that are listed in homepage via javascript code after page is loaded? Thanks it is, share the url and i will prepare a script :-) Link to comment Share on other sites More sharing options...
milanmarkovic Posted October 25, 2016 Author Share Posted October 25, 2016 Thank you Vekia for fast response. Url is: www.tegetmedia.rs Link to comment Share on other sites More sharing options...
vekia Posted October 25, 2016 Share Posted October 25, 2016 here it is $(document).ready(function(){ var products = new Array(); $("#homefeatured li").each(function(){ products.push($(this).find("a.ajax_add_to_cart_button").attr('data-id-product')); }); }); code creates an array of products' id numbers from homefeatured blockif you will use console.log(products) the result will be: ["885", "811", "112", "248", "856", "772", "219", "135", "518", "713", "453", "882", "885", "811", "112", "248", "856", "772", "219", "135", "518", "713", "453", "882"] Link to comment Share on other sites More sharing options...
milanmarkovic Posted October 25, 2016 Author Share Posted October 25, 2016 Thank you Vekia. I will try code tomorrow morning and post results. Link to comment Share on other sites More sharing options...
milanmarkovic Posted October 26, 2016 Author Share Posted October 26, 2016 Thank you Vekia,above code works but products array contains duplicated ids. It contains 24 instead of 12 ids. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now