View Single Post
  #1  
Old 01-05-2007, 05:29 AM
  ezi designs's Avatar 
ezi designs ezi designs is offline
 

Senior Member
  
Join Date: Sep 2006
Location: United Kingdom
Posts: 118
 

Talking Subcategory text & images for x-cart 4.1.5

Instead of just the un-glorious text for subcats, here is a working addition to the latest x-cart version 4.1.5

3 files to change:

/skin1/customer/main/subcategories.tpl
/includes/categories.php
skin1/skin1.css


O.K here we go, open up /skin1/customer/main/subcategories.tpl and at around line 17 look for the beginning that looks like this, {if $subcategories}. We are going to paste in the following code that goes to about line 44 over the top of it, take notice of the blue highlight, this has been changed as previous versions with [IMG] brackets cause no images to displayed with image links.


{if $subcategories}


<table cellspacing="5" width="100%" border="0">

<tr>

{foreach from=$subcategories item=subcat}

{if $tmp is div by 2}
</tr><tr><td colspan="3"></td></tr><tr valign="top">
{/if}

{ if $tmp and $first_subcat ne "Y" }
{assign var="tmp" value=0}
{assign var="first_subcat" value="Y"}
{/if}
<td class="ColumnTitles" valign="top"><a title="{$subcat.description}" href="home.php?cat={ $subcat.categoryid }"><img src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_w eb_dir}/default_image.gif{/if}" alt="" />

<font class="ItemsList">{ $subcat.category|escape }</font></a>

{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}
{else} 0 Products
{/if}
{/if}
{assign var="tmp" value=$tmp+1}
{/foreach}
</table>
{/if}







NEXT open /includes/categories.php and find this code



$_categories = func_query_hash("SELECT $to_search FROM $sql_tbl[categories] USE INDEX (am) $join_tbl ".(!empty($search_condition)?"WHERE ".implode(" AND ", $search_condition):"")." GROUP BY $sql_tbl[categories].categoryid ".$sort_condition, "categoryid", false);



REPLACE WITH



$_categories = func_query_hash("SELECT $to_search, $sql_tbl[categories].description FROM $sql_tbl[categories] USE INDEX (am) $join_tbl ".(!empty($search_condition)?"WHERE ".implode(" AND ", $search_condition):"")." GROUP BY $sql_tbl[categories].categoryid ".$sort_condition, "categoryid", false);


LAST THING TO DO IS open skin1/skin1.css and add to the bottom of the css file the folowing as it is;


.ColumnTitles {






padding-left: 5px;

text-align: center;

width: 33%;
}







Thats it, please do not forget to add your image if you require one. One tip that i have not worked out yet is that if you use the following in 'div by 2' in /skin1/customer/main/subcategories.tpl it throws the text out a bit if you do not use that same image size, so i kept mine at 2, you can of course use less or more colums.

{foreach from=$subcategories item=subcat}
{if $tmp is div by 2}
</tr><tr><td colspan="3"></td></tr><tr valign="top">


Hope this helps



Richard



__________________
x-cart 4.1.6

DSEFU PRO

http.www.demontemplates.com
Reply With Quote