Affan Ashraf Posted September 7, 2023 Share Posted September 7, 2023 Hi, I recently got my website upgraded to 8.1.0 and problem is the oldest products are appearing on top. Alot of products are very old and we dont want them to appear on front page ( New Products module on main page). Is there any way I can set the order of products by date so that new products can appear first? I tried to find but found no such option, however in older prestashop 1.7 I was using this option to sort the products by date. Please help. Thanks Link to comment Share on other sites More sharing options...
Mr Rick Posted September 7, 2023 Share Posted September 7, 2023 Hi, You have to edit code for this purpose, in modules/ps_newproducts/ps_newproducts.php Find function getNewProducts and change the code to below one. $newProducts = Product::getNewProducts( (int) $this->context->language->id, 0, (int) Configuration::get('NEW_PRODUCTS_NBR'), false, 'date_add' ); 1 Link to comment Share on other sites More sharing options...
Affan Ashraf Posted September 7, 2023 Author Share Posted September 7, 2023 6 minutes ago, Matt Rix said: Hi, You have to edit code for this purpose, in modules/ps_newproducts/ps_newproducts.php Find function getNewProducts and change the code to below one. $newProducts = Product::getNewProducts( (int) $this->context->language->id, 0, (int) Configuration::get('NEW_PRODUCTS_NBR'), false, 'date_add' ); Thank you for your response, i will check and let you know the results. Thank you once again. Link to comment Share on other sites More sharing options...
Affan Ashraf Posted September 8, 2023 Author Share Posted September 8, 2023 20 hours ago, Matt Rix said: Hi, You have to edit code for this purpose, in modules/ps_newproducts/ps_newproducts.php Find function getNewProducts and change the code to below one. $newProducts = Product::getNewProducts( (int) $this->context->language->id, 0, (int) Configuration::get('NEW_PRODUCTS_NBR'), false, 'date_add' ); Hi, i made the changes and its working just fine. Thank you so much. Link to comment Share on other sites More sharing options...
Affan Ashraf Posted September 8, 2023 Author Share Posted September 8, 2023 Like I said, it worked perfect. I want same thing for "Featured Products" as well. If you or any one else can help in this regard, i would be grateful. Regards, 21 hours ago, Matt Rix said: Hi, You have to edit code for this purpose, in modules/ps_newproducts/ps_newproducts.php Find function getNewProducts and change the code to below one. $newProducts = Product::getNewProducts( (int) $this->context->language->id, 0, (int) Configuration::get('NEW_PRODUCTS_NBR'), false, 'date_add' ); 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