/**
  * Assign template vars if displaying one manufacturer
  */
 protected function assignOne()
 {
     $this->manufacturer->description = Tools::nl2br(trim($this->manufacturer->description));
     $nbProducts = $this->manufacturer->getProducts($this->manufacturer->id, null, null, null, $this->orderBy, $this->orderWay, true);
     $this->pagination((int) $nbProducts);
     $products = $this->manufacturer->getProducts($this->manufacturer->id, $this->context->language->id, (int) $this->p, (int) $this->n, $this->orderBy, $this->orderWay);
     $this->addColorsToProductList($products);
     $this->context->smarty->assign(array('nb_products' => $nbProducts, 'products' => $products, 'path' => $this->manufacturer->active ? Tools::safeOutput($this->manufacturer->name) : '', 'manufacturer' => $this->manufacturer, 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'body_classes' => array($this->php_self . '-' . $this->manufacturer->id, $this->php_self . '-' . $this->manufacturer->link_rewrite)));
 }
 public function hookProductFooter($params)
 {
     $id_product = (int) $params['product']->id;
     $product = $params['product'];
     if (isset($params['product']->id_manufacturer) && $params['product']->id_manufacturer) {
         $cache_id = 'productsmanufacturer|' . $id_product . '|' . (int) $params['product']->id_manufacturer;
         if (!$this->isCached('productsmanufacturer.tpl', $this->getCacheId($cache_id))) {
             // Get infos
             $manufacturer_products = Manufacturer::getProducts($params['product']->id_manufacturer, $this->context->language->id, 1, Configuration::get('pmslid_limit'));
             /* 100 products max. */
             // Remove current product from the list
             if (is_array($manufacturer_products) && count($manufacturer_products)) {
                 foreach ($manufacturer_products as $key => $manufacturer_product) {
                     if ($manufacturer_product['id_product'] == $id_product) {
                         unset($manufacturer_products[$key]);
                         break;
                     }
                 }
                 $taxes = Product::getTaxCalculationMethod();
                 if (!Configuration::get('pmslid_DISPLAY_PRICE')) {
                     foreach ($manufacturer_products as $key => $manufacturer_product) {
                         if ($manufacturer_product['id_product'] != $id_product) {
                             $manufacturer_products[$key]['show_price'] = 0;
                         }
                     }
                 }
             }
             // Display tpl
             $this->smarty->assign(array('manufacturer_products' => $manufacturer_products, 'ProdDisplayPrice' => Configuration::get('pmslid_DISPLAY_PRICE')));
         }
         return $this->display(__FILE__, 'productsmanufacturer.tpl', $this->getCacheId($cache_id));
     }
 }
 public function getRandomBrandProducts()
 {
     //see if the html fragment is in memcache
     $memcache = new Memcache();
     if ($memcache->connect('127.0.0.1', 11211)) {
         $brandProducts = $memcache->get('product-brand-products-' . $this->product->id);
         if ($brandProducts) {
             return $brandProducts;
         } else {
             $brandProducts = Manufacturer::getProducts($this->product->id_manufacturer, (int) self::$cookie->id_lang, 0, 15, NULL, NULL, false, true, true, 15, false);
             $memcache->set('product-brand-products-' . $this->product->id, $brandProducts, false, 172800);
             //cache for 2 days
             return $brandProducts;
         }
     } else {
         return Manufacturer::getProducts($this->product->id_manufacturer, (int) self::$cookie->id_lang, 0, 15, NULL, NULL, false, true, true, 15, false);
     }
 }