View Single Post
  #1  
Old 06-27-2007, 12:12 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Add Root Category Icons to the front page

This mod was previously posted in the Template Editing forum by user "cah", but as inadvertently deleted (my bad, good thing the back button works!). So here it is again. Essentially it adds some controls to the General Setttings/Appearance Options screen to control the display:

SQL query (enter into the Patch/Upgrade area under SQL):

Code:
INSERT INTO `xcart_config` VALUES ('categories_desc_on_main', 'Show description under icons for categories on main page', 'N', 'Appearance', 500, 'checkbox', 'N', ''); INSERT INTO xcart_config VALUES ('categories_on_main_page','Show icons for categories on main page','Y','Appearance',500,'checkbox','N',''); INSERT INTO xcart_config VALUES ('columns_categories_on_main_page','Number of columns for categories on main page','','Appearance',510,'numeric','','');

customer/main/welcome.tpl:

Code:
{* $Id: welcome.tpl,v 1.28.2.1 2006/07/12 04:51:17 svowl Exp $ *} {if ($active_modules.Greet_Visitor ne "") and ($smarty.cookies.GreetingCookie ne "") and $logout_user eq ''} {assign var="_name" value=$smarty.cookies.GreetingCookie|replace:"\'":"'"} <h3>{$lng.lbl_welcome_back|substitute:"name":$_name} </h3> {elseif $lng.lbl_site_title} <h3>{$lng.lbl_welcome_to|substitute:"company":$lng.lbl_site_title}</h3> {else} <h3>{$lng.lbl_welcome_to|substitute:"company":$config.Company.company_name}</h3> {/if} {$lng.txt_welcome} <br /> {if $config.Appearance.categories_on_main_page} <table border="0" width="100%" cellpadding="0" cellspacing="0"><tr><td class="TableThumbnailBorder"> <table border="0" width="100%" cellpadding="5" cellspacing="1"> {math equation="floor(100/x)" x=$config.Appearance.columns_categories_on_main_page assign="width"} {foreach from=$subcategories name=sc item=c key=catid} {if $smarty.foreach.sc.index is div by $config.Appearance.columns_categories_on_main_page} <tr> {assign var="cell_counter" value=0} {/if} {math equation="x+1" x=$cell_counter assign="cell_counter" } <td align="center" valign="center" width="{$width}%" class="DialogBox"> <a href="home.php?cat={$c.categoryid}"> <img src="{if $c.icon_url}{$c.icon_url}{else}{$xcart_web_dir}/image.php?id={$cat}&amp;type=C{/if}" alt="" /> <br><br> {if $config.Appearance.categories_desc_on_main eq "Y"} <font class="ItemsList">{$c.category|escape}</font></a><br> {/if} {if $config.Appearance.count_products eq "Y"} {if $subcat.product_count}{ $subcat.product_count } {$lng.lbl_products} {elseif $subcat.subcategory_count}{ $subcat.subcategory_count } {$lng.lbl_categories|lower} {/if} {/if} </a> &nbsp; </TD> {capture name=prod_index} {math equation="index+x+1" index=$smarty.foreach.sc.index x=2} {/capture} {if $smarty.capture.prod_index is div by $config.Appearance.columns_categories_on_main_page} {*</tr>*} {/if} {/foreach} {if $cell_counter lt $config.Appearance.columns_categories_on_main_page} {section name=rest_cells loop=$config.Appearance.columns_categories_on_main_page} <td class="DialogBox">&nbsp;</td> {/section} </tr> {/if} </table> </td></tr></table> {else} {if $active_modules.Bestsellers ne "" and $config.Bestsellers.bestsellers_menu ne "Y"} {include file="modules/Bestsellers/bestsellers.tpl"} {/if} <br /> {include file="customer/main/featured.tpl" f_products=$f_products} {/if}
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote