Jump to content

Override NewProductsControllerCore to show only new products with Stock


Recommended Posts

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

à 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...