Jump to content

[SOLVED] "Featured Products" show new products in last...


b22c

Recommended Posts

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...