Пример #1
0
 /**
  * Assign template vars related to category
  */
 protected function assignCategory()
 {
     // Assign category to the template
     if ($this->category !== false && JeproshopTools::isLoadedObject($this->category, 'category_id') && $this->category->inShop() && $this->category->isAssociatedToShop()) {
         $path = JeproshopTools::getPath($this->category->category_id, $this->product->name, true);
     } elseif (JeproshopCategoryModelCategory::inShopStatic($this->product->default_category_id, $this->context->shop)) {
         $this->category = new JeproshopCategoryModelCategory((int) $this->product->default_category_id, (int) $this->context->language->lang_id);
         if (JeproshopTools::isLoadedObject($this->category, 'category_id') && $this->category->published && $this->category->isAssociatedToShop()) {
             $path = JeproshopTools::getPath((int) $this->product->default_category_id, $this->product->name[$this->context->language->lang_id]);
         }
     }
     if (!isset($path) || !$path) {
         $path = JeproshopTools::getPath((int) $this->context->shop->category_id, $this->product->name[$this->context->language->lang_id]);
     }
     $subCategories = array();
     if (JeproshopTools::isLoadedObject($this->category, 'category_id')) {
         $subCategories = $this->category->getSubCategories($this->context->language->lang_id, true);
         // various assignments before Hook::exec
         $this->assignRef('path', $path);
         $this->assignRef('category', $this->category);
         $this->assignRef('sub_categories', $subCategories);
         $this->assignRef('current_category_id', $this->category->category_id);
         $this->assignRef('parent_category_id', $this->category->parent_id);
         $return_category_name = JeproshopTools::safeOutput($this->category->getFieldByLang('name'));
         $this->assignRef('return_category_name', $return_category_name);
         $categories = JeproshopCategoryModelCategory::getHomeCategories($this->context->language->lang_id, true, (int) $this->context->shop->shop_id);
         $this->assignRef('categories', $categories);
     }
     //$this->context->smarty->assign(array('HOOK_PRODUCT_FOOTER' => Hook::exec('displayFooterProduct', array('product' => $this->product, 'category' => $this->category))));
 }