Jump to content

override hook actionProductListOverride


jmstyle008

Recommended Posts

Hi, I'm new to Prestashop and i saw that i'm in need of overriding this hook.. actionProductListOverride.

 

I thought it was a method called actionProductListOverride but i could not find it or isn't there

 

How could i over ride this method so i can add extra data to my CategoryController.

 

the method i wish to override is this.

 

/**

* Assign list of products template vars

*/

public function assignProductList()

{

$hookExecuted = false;

Hook::exec('actionProductListOverride', array(

'nbProducts' => &$this->nbProducts,

'catProducts' => &$this->cat_products,

'hookExecuted' => &$hookExecuted,

));

 

// The hook was not executed, standard working

if (!$hookExecuted)

{

$this->context->smarty->assign('categoryNameComplement', '');

$this->nbProducts = $this->category->getProducts(null, null, null, $this->orderBy, $this->orderWay, true);

$this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts"

$this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay);

}

// Hook executed, use the override

else

// Pagination must be call after "getProducts"

$this->pagination($this->nbProducts);

 

foreach ($this->cat_products as &$product)

{

if ($product['id_product_attribute'] && isset($product['product_attribute_minimal_quantity']))

$product['minimal_quantity'] = $product['product_attribute_minimal_quantity'];

}

 

$this->context->smarty->assign('nb_products', $this->nbProducts);

}

Link to comment
Share on other sites

  • 1 year 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...