Hi everyone!
Unless I have missed it, I don't think that my problem has been raised in previous post, so I hope someone will be able to help me or direct me to the right place. 😊
I am currently setting up a shop with Prestashop version 8 where I want to show in the Special block and Prices Drop page only products with the 'on_sale' flag.
To do so, I've been following this topic that is quite simple: create an override of Product.php and in the functions getRandomSpecial() and getPricesDrop() add to SQL WHERE conditions 'p.`on_sale`= 1 AND '.
I tried to put this at the beginning of the WHERE condition, with and without brackets surrounding the rest of the condition, I tried to put it at the end of the condition and I also did so directly in the main Product.php disabling the override one. Before every attempt I cleared the cache through the BO or by erasing directories in /var/cache/.
Whichever way I tried, the Prices Drop page still has every products with a specific price, even those that are not labeled as 'on_sale'...
It is as if other getRandomSpecial() and getPricesDrop() functions exist somewhere else and has the priority over my modified queries...
Can someone help me understand what is happening?
NB: In the case of Prices Drop page, I went down the rabbit hole of looking into controllers/front/listing/PricesDropController.php then Adapter\PricesDrop\PricesDropProductSearchProvider.php to see where getPricesDrop() is called and it is definitely called through Product class.