Jump to content

List of new products in a specified category


jolyanah

Recommended Posts

Hello,

 

In a module that I have created , after a request of all products in a category,

I would then , in the same function , show those who are new ,

 

I did like this:

 

private function getNewProducts($nbr){

 

        $newProducts = false;

        $category = new Category()(int)$cat_id, (int)Context::getContext()->language->id);

       

        $products = $category::getProducts((int) $this->context->language->id, 1, ($nbr ? $nbr : 10);

 

         if (Configuration::get('PS_NB_DAYS_NEW_PRODUCT'))

                $result = $products->getNewProducts((int) $this->context->language->id, 0, $nbr);

 

        if (!$newProducts)

            return;

       

         return $newProducts;

    }

 

 

And Prestashop is completely planted ,

As I don't know too prestashop , I don't know if it's the right syntax,

 

Does anyone have an idea ?

 

Thanks for your help,,,

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

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...