Jump to content

Please help HomeCaregories


djjohnny

Recommended Posts

Please help me edit the code to show me the pictures category.
code of the module is categoriestop

to version 1.4

blockcategoriestop.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}

 

41745_ufpyG1Hxp6LTcKcDy68I_t

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...