name = 'categoryimg'; $this->tab = 'front_office_features'; $this->version = '1.0'; parent::__construct(); $this->displayName = $this->l('Category Image'); $this->description = $this->l('Display image category on left column.'); } public function install() { if(!parent::install() OR !$this->registerHook('displayLeftVP')) { return FALSE; } return TRUE; } public function hookdisplayLeftVP($params) { global $smarty; $id_category = $params['id_category']; $id_lang = (int) Tools::getValue('id_lang', Configuration::get('PS_LANG_DEFAULT')); if(file_exists(_PS_ROOT_DIR_.'/img/c/'. $id_category. '.jpg')) { $category = new Category($id_category, $id_lang); }else{ $id_parent = Category::getIdParent($id_category); if(file_exists(_PS_ROOT_DIR_.'/img/c/'. $id_parent. '.jpg')) { $category = new Category($id_parent, $id_lang); }else{ $parent_bis = Category::getIdParent($id_parent); if(file_exists(_PS_ROOT_DIR_.'/img/c/'. $parent_bis. '.jpg')) { $category = new Category($parent_bis, $id_lang); }else{ $category = ""; } } } $sale = Sale::getSaleFromCategory(Tools::getValue('id_category')); $smarty->assign('sale', $sale); $smarty->assign('consumable', ((int) _SHOP_PRIVATESALES_CONSUMABLE == (int) $sale->id)? true : false); $smarty->assign('category', $category); return $this->display(__FILE__, 'left_img.tpl'); } }