b22c Posted December 24, 2013 Share Posted December 24, 2013 Hi i am using the module featured products. But when i add a new product, the product is displayed in last but the correct should be that the new product were displayed in first place not in the last, how can i put new products to be displayed in the beginning of the list... Thanks Link to comment Share on other sites More sharing options...
w3bsolutions Posted December 24, 2013 Share Posted December 24, 2013 Hi, To change this you must edit the file /modules/homefeatured/homefeatured.php and in function hookDisplayHome change this line: $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8)); to this: $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'date_upd', 'DESC'); That should do it. Link to comment Share on other sites More sharing options...
vekia Posted December 24, 2013 Share Posted December 24, 2013 you can use also simple array_reverse function $products=array_reverse($products); Link to comment Share on other sites More sharing options...
b22c Posted December 26, 2013 Author Share Posted December 26, 2013 you can use also simple array_reverse function $products=array_reverse($products); Hi my code is: $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); Where i put your piece of code ($products=array_reverse($products) in my code? Thanks Link to comment Share on other sites More sharing options...
b22c Posted December 26, 2013 Author Share Posted December 26, 2013 Hi my code is: $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); Where i put your piece of code ($products=array_reverse($products) in my code? Thanks Hi i put your code below my line and it works. Thats the correct way right? Link to comment Share on other sites More sharing options...
vekia Posted December 26, 2013 Share Posted December 26, 2013 Hi i put your code below my line and it works. Thats the correct way right? that's correct $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); $products = array_reverse($products); Link to comment Share on other sites More sharing options...
b22c Posted December 26, 2013 Author Share Posted December 26, 2013 Thanks Vekia and fire2. You can mark as solved Link to comment Share on other sites More sharing options...
vekia Posted December 26, 2013 Share Posted December 26, 2013 you're welcome done, topic marked as [solved] exactly as you suggested with regards, milos 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