Miguel86 Posted February 11 Share Posted February 11 Hi: I'm trying to override this controller so i can show only new products list but show the products with stock. But i don't find a way to override this controller and modify the query to join with the product_quiantities table to take it into account. Link to comment Share on other sites More sharing options...
Prestashop Addict Posted February 12 Share Posted February 12 Hi, it will be more simple to change the template by making a test on $product.quantity Link to comment Share on other sites More sharing options...
Miguel86 Posted February 12 Author Share Posted February 12 But if you do that approach is difficult to always show a fixed amount of elements, as the limit of the query will limit the results passed to the template. Link to comment Share on other sites More sharing options...
Prestashop Addict Posted February 12 Share Posted February 12 à l’instant, Miguel86 a dit : But if you do that approach is difficult to always show a fixed amount of elements, as the limit of the query will limit the results passed to the template. Yes, but so easy 😉 So you need to override Product.php class and method, by adding your WHERE condition based on stock public static function getNewProducts($id_lang, $page_number = 0, $nb_products = 10, $count = false, $order_by = null, $order_way = null, Context $context = null) 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