FitDeck.dk Posted August 16, 2011 Share Posted August 16, 2011 Hi, How do I add a link to either a CMS page, external URL or product page in the category block? (version 1.3.1.1 and category block version 1) Thank you very much Link to comment Share on other sites More sharing options...
keweli Posted August 16, 2011 Share Posted August 16, 2011 If you only want to add a single page/link, just edit the .tpl for modules/blockcategories. If you want to merge categories and CMS pages together dynamically so that it will update according to backoffice CMS pages, you will need to integrate the blockcategories and blockcms modules together. Link to comment Share on other sites More sharing options...
FitDeck.dk Posted August 16, 2011 Author Share Posted August 16, 2011 If you only want to add a single page/link, just edit the .tpl for modules/blockcategories. If you want to merge categories and CMS pages together dynamically so that it will update according to backoffice CMS pages, you will need to integrate the blockcategories and blockcms modules together. Thanks for your reply. Do you know if there already are a modul that integrate the category and cms module? I guess you need some kind of experience in building modules etc. to integrate the modules? Tue Link to comment Share on other sites More sharing options...
keweli Posted August 18, 2011 Share Posted August 18, 2011 Yes you need a bit of experience to integrate the modules, but it won't be hard as all the code is already there. Refer to blockcms.tpl & blockcategories.tpl for what is displayed and blockcms.php & blockcategories.php for how the module works 1 Link to comment Share on other sites More sharing options...
FitDeck.dk Posted August 25, 2011 Author Share Posted August 25, 2011 Hi again, And many thanks for your help. I have located the .tpl file i need to edit. It's category-tree-branch.tpl in a module called tmcategories. What do i need to do in order for a link to show up: <li class="{if $node.children|@count > 0}sousmenu{/if}{if $node.id == $currentCategoryId} selected{/if}{if $last == 'true'} last{/if}"> <a href="{$node.link}" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> {if $node.children|@count > 0} <ul class="niveau2"> {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last} {include file="$branche_tpl_path" node=$child last='true'} {else} {include file="$branche_tpl_path" node=$child last='false'} {/if} {/foreach} </ul> {/if} </li> If i just edit the second line (<a href="{ ...), it only creates one menulink (which looks fine) but i need to put in other links next to it. If I copy the second line and paste it in, i just get two menues under each other. Here's a screenshot of the menu: Thanks in advance - Tue Link to comment Share on other sites More sharing options...
phpimran Posted September 21, 2011 Share Posted September 21, 2011 hi keweli, i have running in the same situation where i need to integrate blockcms.tpl & blockcategories.tpl and blockcms.php & blockcategories.php but all my attempts got failed as i have not much experience on integrating the blocks. in my cms block i have one link " product " and on clicking this link i need to show all the categories under it. please help me out.. Link to comment Share on other sites More sharing options...
phpimran Posted September 23, 2011 Share Posted September 23, 2011 hi keweli, i have added following code in the blockcms.php $id_product = (int)(Tools::getValue('id_product', 0)); $id_category = (int)(Tools::getValue('id_category', 0)); //Tools::enableCache(); if (!$this->isCached('blockcategories.tpl', $smartyCacheId)) { $maxdepth = Configuration::get('BLOCK_CATEG_MAX_DEPTH'); if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite 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 (c.`active` = 1 OR c.`id_category` = 1) '.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').' AND cg.`id_group` IN ('.pSQL($groups).') GROUP BY id_category ORDER BY `level_depth` ASC, c.`position` ASC') ) //return; $resultParents = array(); $resultIds = array(); foreach ($result as &$row) { $resultParents[$row['id_parent']][] = &$row; $resultIds[$row['id_category']] = &$row; } $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH')); unset($resultParents); unset($resultIds); } //return $this->display(__FILE__, 'blockcms.tpl'); return $this->display(__FILE__, 'blockcms.tpl'); and added following code in the blockcms.tpl file : <ul class="tree {if $isDhtml}dhtml{/if}"> {foreach from=$blockCategTree.children item=child name=blockCategTree} {include file="$branche_tpl_path" node=$child} {/foreach} </ul> before function hookLeftColumn() i have added getTree() .. it shows the list of all the categories into the cms block but some time it shows and sometime not. please see the file what it displaying and please correct me where i m going wrong. Link to comment Share on other sites More sharing options...
robbysalz Posted November 20, 2011 Share Posted November 20, 2011 Hello all, I have this tmcategories.tpl <div id="tmcategories"> <div id="tmcategories_inner"> <ul id="cat"> {foreach from=$blockCategTree.children item=child name=blockCategTree} {if $smarty.foreach.blockCategTree.last} {include file="$branche_tpl_path" node=$child last='true'} {else} {include file="$branche_tpl_path" node=$child} {/if} {/foreach} {literal}<li><a href="cristocat.tumblr.com/">Blog</a></li>{/literal} </ul> </div> </div> Two internal shop categories, and one external link to our blog. This generates the following awesome result: However, when we go to click the new <li> Blog link, the URL is prefixed with the domain name, as such: So as you can see, instead of pointing to directly to the external URL I've specified, it treats the link as if it were an internal document. I realize this has something to do with the PHP classes defined by the "extends" call at the start of the attached code..any ideas for workarounds? We'd really love to have our three links located in the same nav bar, instead of arbitrarily separated. Thanks guys, it's a real blast reading what everyone has to say on these boards! Link to comment Share on other sites More sharing options...
pmlvfs Posted January 29, 2013 Share Posted January 29, 2013 You just need to put "http://" before the link and it should work. Link to comment Share on other sites More sharing options...
wlongdonstudio Posted February 28, 2013 Share Posted February 28, 2013 where do i find the file tmcategories.tpl in 1.5.3.1 why you guys don't ever say where Link to comment Share on other sites More sharing options...
vekia Posted February 28, 2013 Share Posted February 28, 2013 where do i find the file tmcategories.tpl in 1.5.3.1 why you guys don't ever say where it's a module file, you can find it out in two directories or in one: 1) modules/tmcatgories/tmcategories/tmcategories.tpl 2) themes/YOUR_THEME/modules/tmcategories/tmcategories.tpl Link to comment Share on other sites More sharing options...
R Santos Posted August 22, 2013 Share Posted August 22, 2013 <p>Hi Guys,</p> <p> </p> <p>I did same as described, follow code from tmcategories.tpl I`m using prestashop V1.4.8.2</p> <p> </p> <div><!-- TM Categories --></div> <div><script type="text/javascript" src="{$module_dir}superfish.js"></script></div> <div>{literal}</div> <div><script type="text/javascript"></div> <div>$(document).ready(function() {</div> <div>$('ul.sf-menu').superfish({</div> <div>delay: 1000,</div> <div>animation: {opacity:'show',height:'show'},</div> <div>speed: 'fast',</div> <div>autoArrows: false,</div> <div>dropShadows: false</div> <div>});</div> <div>});</div> <div></script></div> <div>{/literal}</div> <div><div class="clearblock"></div></div> <div><div id="tmcategories"></div> <div><ul id="cat" class="sf-menu"></div> <div>{foreach from=$blockCategTree.children item=child name=blockCategTree}</div> <div>{if $smarty.foreach.blockCategTree.last}</div> <div>{include file="$branche_tpl_path" node=$child last='true'}</div> <div>{else}</div> <div>{include file="$branche_tpl_path" node=$child}</div> <div>{/if}</div> <div>{/foreach}</div> <div><strong> <li class="sub"></strong></div> <div><strong> <a href="{$link->getPageLink('cms.php?id_cms=11')}">{l s='Make-up' mod='tmcategories'}</a></strong></div> <div><strong> </li></strong></div> <div></ul></div> <div></div></div> <div><!-- /TM Categories --></div> <div> </div> <div>After save and refresh the page, nothing happens???</div> <div>Any Ideas what is wrong?</div> <div> </div> <div>Thank you.</div> Link to comment Share on other sites More sharing options...
Recommended Posts