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)
-   -   Categories in Columns on Front Page v4.x (https://forum.x-cart.com/showthread.php?t=32480)

PhilJ 07-11-2007 08:16 AM

Categories in Columns on Front Page v4.x
 
1) Create a new file according to your version, either...

cats_in_cols_v40x.tpl

or...

cats_in_cols_v41x.tpl

2) Add the code below according to your version...

Code for v4.0.x

Code:


{* -------------------------------------- *}
{* Categories in Columns with Icons on Front Page - v4.0.x *}
{* Set the number of columns ------------ *}
{assign var='cols' value='4'}
{* -------------------------------------- *}
{capture name=dialog}
{section name=cat_num loop=$subcategories}
{if %cat_num.first%}
<table width="100%" border="0" cellpadding="5" cellspacing="0">
{/if}
{if %cat_num.index% is div by $cols}
<tr>
{/if}
<td width="{math equation="100 / x" x=$cols}%" align="center" valign="top">
 <a href="home.php?cat={$subcategories[cat_num].categoryid}">
 <img src="{$xcart_web_dir}/icon.php?categoryid={$subcategories[cat_num].categoryid}" border="0" alt="{$subcategories[cat_num].category|escape}">
 </a>
 <br />
 <a href="home.php?cat={$subcategories[cat_num].categoryid}"><b>{$subcategories[cat_num].category|escape}</b></a>
 {if $config.Appearance.count_products eq "Y"}
 {if $subcategories[cat_num].product_count}
 <br />
 {$subcategories[cat_num].product_count} {$lng.lbl_items}
 {/if}
 {if $subcategories[cat_num].subcategory_count}
 <br />
 {$subcategories[cat_num].subcategory_count} {$lng.lbl_subcategories}
 {/if}
 {/if}
</td>
{if %cat_num.last%}
</tr>
</table>
{/if}
{/section}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_categories content=$smarty.capture.dialog extra="width=100%"}


Code for v4.1.x

Code:


{* -------------------------------------- *}
{* Categories in Columns with Icons on Front Page - v4.1.x *}
{* Set the number of columns ------------ *}
{assign var='cols' value='4'}
{* -------------------------------------- *}
{capture name=dialog}
{foreach from=$categories item=c name=cats}
{if $smarty.foreach.cats.first}
<table width="100%" border="0" cellpadding="5" cellspacing="0">
{/if}
{if $smarty.foreach.cats.index is div by $cols}
<tr>
{/if}
<td width="{math equation="100 / x" x=$cols}%" align="center" valign="top">
 <a href="home.php?cat={$c.categoryid}">
 <img src="{$xcart_web_dir}/image.php?id={$c.categoryid}&amp;type=C" border="0" alt="{$c.category}">
 </a>
 <br />
 <a href="home.php?cat={$c.categoryid}"><b>{$c.category}</b></a>
 {if $config.Appearance.count_products eq "Y"}
 {if $c.product_count}
 <br />
 {$c.product_count} {$lng.lbl_items}
 {/if}
 {if $c.subcategory_count}
 <br />
 {$c.subcategory_count} {$lng.lbl_subcategories}
 {/if}
 {/if}
</td>
{if $smarty.foreach.cats.last}
</tr>
</table>
{/if}
{/foreach}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_categories content=$smarty.capture.dialog extra="width=100%"}


3) Upload the new file created to skin1/customer/main/

4) Then in...

skin1/customer/main/welcome.tpl

Add..

Code:

{include file="customer/main/cats_in_cols_v40x.tpl"}

or...

Code:

{include file="customer/main/cats_in_cols_v41x.tpl"}

Done :)

jayzee 07-12-2007 06:36 AM

Re: Categories in Columns on Front Page v4.x
 
Hi thanks for this, I was wondering if you know how i can get next level of subcategories to appear below the first levelof subcategories on x-cart 4.1?

thanks
J

DataViking 08-30-2007 12:52 PM

Re: Categories in Columns on Front Page v4.x
 
thank you

vtonya 09-01-2007 01:23 AM

Re: Categories in Columns on Front Page v4.x
 
Where can we see a demo?
Thank you!

PhilJ 09-01-2007 03:22 AM

Re: Categories in Columns on Front Page v4.x
 
http://www.xcartmods.co.uk/demos/416

vtonya 09-01-2007 03:29 AM

Re: Categories in Columns on Front Page v4.x
 
Thank you PhilJ!

Chris B 09-12-2007 07:55 PM

Re: Categories in Columns on Front Page v4.x
 
Is there a method to limit the number of categories listed?

Say I only want the 1st 6.

version 4.0.18

Thank you,

PS. very nice mod!

PhilJ 09-13-2007 09:30 AM

Re: Categories in Columns on Front Page v4.x
 
I could probably code it to show only certain categories, pm if interested.

sjbt 09-25-2007 11:50 AM

Re: Categories in Columns on Front Page v4.x
 
Is there a way to keep it from displaying the heading, "Categories"?

I have 4 categories and just want to display them with their images across the top.

Thanks!

PhilJ 09-25-2007 11:56 AM

Re: Categories in Columns on Front Page v4.x
 
remove...
Code:

{capture name=dialog}
and...
Code:

{/capture}
{include file="dialog.tpl" title=$lng.lbl_categories content=$smarty.capture.dialog extra="width=100%"}



All times are GMT -8. The time now is 04:55 PM.

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