Jump to content

Optimize some cod


Recommended Posts



I have next situation: I need to get in product-list.tpl the manufacturer, and group.

Here is the link i do: https://www.prestashop.com/forums/topic/277309-how-to-group-products-by-manufacturer-in-product-list-category-or-sub-category-pages/

But....  , I need only id_manufacturer and the name, not all

Next is the code:

  1. if ($this->cat_products)
  2. foreach ($this->cat_products as &$product) {
  3. $this->manufacturers[$product['id_manufacturer']] = new Manufacturer(intval($product['id_manufacturer']), $this->context->language->id);
  4. }
  5. $this->context->smarty->assign(array(
  6. 'nb_products', $this->nbProducts,
  7. 'manufacturers' => $this->manufacturers,
  8. ));
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...