mohamd.sobhy Posted May 21, 2016 Share Posted May 21, 2016 (edited) I just made module that contains all categories and i need to select just manufacturers that related to the same category like this pic i already using module wcontentmaker to create this module Edited May 21, 2016 by mohamd.sobhy (see edit history) Link to comment Share on other sites More sharing options...
mohamd.sobhy Posted May 23, 2016 Author Share Posted May 23, 2016 function hookHome($params){ global $smarty, $cookie, $link; $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 level_depth < 3 AND c.`active` = 1 AND cg.`id_group` = '.$id_group.' ORDER BY 1 ASC'); $category = new Category(1); $nb = intval(Configuration::get('HOME_categories_NBR')); global $link; $this->context->smarty->assign(array( 'categories' => $result, Category::getRootCategories(intval($params['cookie']->id_lang), true), 'link' => $link)); $manufacturers = Manufacturer::getManufacturers(); foreach ($manufacturers as &$manufacturer) { $manufacturer['image'] = $this->context->language->iso_code.'-default'; if (file_exists(_PS_MANU_IMG_DIR_.$manufacturer['id_manufacturer'].'-'.ImageType::getFormatedName('medium').'.jpg')) $manufacturer['image'] = $manufacturer['id_manufacturer']; } $this->context->smarty->assign(array( 'category' => $category, 'lang' => Language::getIsoById(intval($params['cookie']->id_lang)), 'manufacturers' => $manufacturers, 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'), 'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'), 'display_link_manufacturer' => Configuration::get('PS_DISPLAY_SUPPLIERS') )); return $this->display(__FILE__, 'wcontentmaker.tpl'); } <div id="wContent-top" class="wContent-top" > {$content} <div class="categories"> <h2>{l s='Categories' mod='homecategories'}</h2> {if isset($categories) AND $categories} <ul> {foreach from=$categories item=category name=homeCategories} {assign var='categoryLink' value=$link->getcategoryLink($category.id_category, $category.link_rewrite)} <li class="ajax_block_category {if $smarty.foreach.homeCategories.first}first_item{elseif $smarty.foreach.homeCategories.last}last_item{else}item{/if}" style="width:1200px; height:300px;background:#EFECEA ;border:1px solid #222; margin:20px;"> <!-- <div> <a href="{$categoryLink}" title="{$category.legend}" class="category_image"> <img src="{$img_cat_dir}{$category.id_category}-large.jpg" alt="{$category.name}" title="{$category.name}" class="categoryImage" width="{$categorySize.width}" height="{$categorySize.height}" /> </a></div>--> <a href="{$categoryLink}" title="{$category.legend}" >{$category.name|truncate:35}</a><br/> <div class="row" style="width:1200px;float:left;"> <div class="col-sm-2 block_content"> <h4 class="title_block">{if $display_link_manufacturer}<a href="{$link->getPageLink('manufacturer')|escape:'html'}" title="{l s='Manufacturers' mod='blockmanufacturer'}">{/if}{l s='Brands' mod='blockmanufacturer'}{if $display_link_manufacturer}</a>{/if}</h4> {if $manufacturers} {if $text_list} <ul class="bullet"> {foreach from=$manufacturers item=manufacturer name=manufacturer_list} {if $smarty.foreach.manufacturer_list.iteration <= $text_list_nb} <li class="{if $smarty.foreach.manufacturer_list.last}last_item{elseif $smarty.foreach.manufacturer_list.first}first_item{else}item{/if}"><a href="{$link->getmanufacturerLink($manufacturer.id_manufacturer, $manufacturer.link_rewrite)|escape:'html'}" title="{l s='More about %s' sprintf=[$manufacturer.name] mod='blockmanufacturer'}"> {$manufacturer.name|escape:'html':'UTF-8'}</a></li> {/if} {/foreach} </ul> {/if} {else} <p>{l s='No manufacturer' mod='blockmanufacturer'}</p> {/if} </div> <div class="col-sm-4"><h4 class="title_block">Slide</h4></div> <div class="col-sm-6"><h4 class="title_block">Products</h4></div> </div> </li> {/foreach} </ul> {else} <p>{l s='No categories' mod='homecategories'}</p> {/if} <div class="cr"></div> </div> </div> how can i display related manufacturers to this category , any one know .. how ? Link to comment Share on other sites More sharing options...
mohamd.sobhy Posted May 25, 2016 Author Share Posted May 25, 2016 thanks for answering me , i am already using this module but it shows all manufacturers , and i just need to show related manufacturers for sepreated categories Link to comment Share on other sites More sharing options...
mohamd.sobhy Posted May 26, 2016 Author Share Posted May 26, 2016 idid but i can`t customize for related category , how ? 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