Jump to content

How can I show new items first in "homefeatured"?


Recommended Posts

Hello,

 

I want to show latest items first in my homefeatured.

I searched in forum i found a code, but it does not fit my code. Can you help me?

 

This is original code: (what writes in forum)

$products = $category->getProducts(intval($params['cookie']->id_lang), 1, ($nb ? $nb : 10));

.

This is the code to show latest items first in homefeatured

$products = $category->getProducts(intval($params['cookie']->id_lang), 1, ($nb ? $nb : 10) , 'id_product', 'desc');

.

This is my code ...  :mellow:  How should i change my code to show latest items first?

$products = $category->getProducts((int)Context::getContext()->language->id, (int)($controller->p),
				(int)($controller->n), $controller->orderBy, $controller->orderWay);
Edited by ajnglagla (see edit history)
Link to comment
Share on other sites

I have changed my code

$products = $category->getProducts((int)Context::getContext()->language->id, (int)($controller->p),
				(int)($controller->n), $controller->orderBy, $controller->orderWay);

with this

$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10), 'date_add');

But it didnt work.

And the most interesting part is its loaded twice. I will show screenshot.

Link to comment
Share on other sites

×
×
  • Create New...