X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Add Root Category Icons to the front page (https://forum.x-cart.com/showthread.php?t=32130)

balinor 06-27-2007 12:12 PM

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}


KoppTech 08-20-2007 11:23 PM

Re: Add Root Category Icons to the front page
 
Hi,

What exactly is it that this does? Has anybody tries it that has an example? Is it compatible with 4.1.8?

Is it like this: http://forum.x-cart.com/showthread.php?t=32480&highlight=category+image ?? What's the difference, and which is better?

Thanks!


All times are GMT -8. The time now is 09:57 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.