zmora.vip Posted February 17, 2022 Share Posted February 17, 2022 (edited) Hello, I found a bug and Im almost sure it is in clear instalation of prestashop 1.7 If it is last day of "newest" limit days, prestashop dont add "new" label to product. For example if you set 45 days for "new product" life and one product life is 44 days and 2nd is 45 days then both are on list "new products" but only one got label/flag "new". Am i right? Can you help me to fix it? I think it need to be "<=" and it is "<" in function checking limit life of new flag. Edited February 17, 2022 by zmora.vip (see edit history) Link to comment Share on other sites More sharing options...
zmora.vip Posted February 18, 2022 Author Share Posted February 18, 2022 Thanks @Piotr3qx 🍺 for find solution. Problem is not in flag/label but in incorrect counting days for new products. If product is created in 1.01.2022 and "new" is for 3 days then it need to display in 1/2/3.01.2022 but not in 4.01.2022. Prestashop accept 4th day for listing but not for label. So label /flag was OK, but listing was incorrect. in classes/Product.php line:2685 $sql->where('product_shop.`active` = 1'); if ($front) { $sql->where('product_shop.`visibility` IN ("both", "catalog")'); } $sql->where('product_shop.`date_add` > "' . date('Y-m-d', strtotime('-' . $nb_days_new_product . ' DAY')) . '"'); we need to add one day so: $sql->where('product_shop.`active` = 1'); if ($front) { $sql->where('product_shop.`visibility` IN ("both", "catalog")'); } $sql->where('product_shop.`date_add` > "' . date('Y-m-d', strtotime('-' . $nb_days_new_product+1 . ' DAY')) . '"'); HAND 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