djjohnny Posted March 31, 2011 Share Posted March 31, 2011 Please help me edit the code to show me the pictures category.code of the module is categoriestopto version 1.4blockcategoriestop.php <?php if (!defined('_CAN_LOAD_FILES_')) exit; class BlockCategoriesTop extends Module { public function __construct() { $this->name = 'blockcategoriestop'; $this->tab = 'front_office_features'; $this->version = '1.0'; parent::__construct(); $this->displayName = $this->l('Categories block (top)'); $this->description = ''; } public function install() { return (parent::install() AND $this->registerHook('home')); } public function hookHome($params) { global $smarty, $cookie; $id_customer = (int)$params['cookie']->id_customer; $id_group = $id_customer ? Customer::getDefaultGroupId($id_customer) : _PS_DEFAULT_CUSTOMER_GROUP_; $id_lang = (int)$params['cookie']->id_lang; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT c.*, cl.* FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.$id_lang.') LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`) WHERE level_depth = 1 AND c.`active` = 1 AND cg.`id_group` = '.$id_group.' ORDER BY c.`position` ASC'); $smarty->assign('blockcategoriestop_categories', $result); return $this->display(__FILE__, 'blockcategoriestop.tpl'); } } blockcategoriestop.tpl {foreach from=$blockcategoriestop_categories item=blockcategoriestop_category} getCategoryLink($blockcategoriestop_category.id_category, $blockcategoriestop_category.link_rewrite, $cookie->id_lang )}"> getCatImageLink($category.link_rewrite, $category.id_image,'category')}" alt="{$category.name|escape:'htmlall':'UTF-8'}" /> {/foreach} Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now