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)
-   -   Subcategory text & images for x-cart 4.1.5 (https://forum.x-cart.com/showthread.php?t=27803)

ezi designs 01-05-2007 05:29 AM

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




scalemar 01-14-2007 06:48 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Dear Richard:

This mod, looks great.

I did the three steps, but the subcategories are showing in one column.

The code to show two columns not work for me; Can you explain a little bit better in the form "old code" >> "new code".
Sorry to ask this simple question, but I'm not an expert in this codes.

Thank you

Moses
X-cart 4.1

scalemar 01-15-2007 01:49 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Quote:

Originally Posted by ezi designs
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













Dear Richard:

This mod, looks great.

I did the three steps, but the subcategories are showing in one column.

The code to show two columns not work for me; Can you explain a little bit better in the form "old code" >> "new code".
Sorry to ask this simple question, but I'm not an expert in this codes.

Thank you

Moses
X-cart 4.1

karentown 01-23-2007 05:17 AM

Re: Subcategory text & images for x-cart 4.1.5
 
aaaaaaaaarrrrrrrrrgggggggggggghhhhhhhhhhhh!

I cant find this code:

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);

photo 01-23-2007 05:25 AM

Re: Subcategory text & images for x-cart 4.1.5
 
Quote:

Originally Posted by karentown
aaaaaaaaarrrrrrrrrgggggggggggghhhhhhhhhhhh!

I cant find this code:

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);


Line 122 just below
Code:

#
# Check category icons
#


karentown 01-23-2007 05:31 AM

Re: Subcategory text & images for x-cart 4.1.5
 
Ok, I think I am being a complete plonker here....... It doesnt say that in my code ...... how do I tell which version I am using as I bought it via a hosting co. and they transferred the license to me ..... I know that is an eye rolling dummy question. I thought it was 4.1.5 but maybe I am wrong ?!

karentown 01-23-2007 05:32 AM

Re: Subcategory text & images for x-cart 4.1.5
 
forget it ...... found it.....version 4.0.19

*sigh*

Will this mod still work?

karentown 01-24-2007 10:54 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Bump ....

Anyone help me with getting images in my subcategories please?

This is how it is looking so far:

http://www.partypresence.co.uk/store/home.php?cat=248

Thanks :)

karentown 01-25-2007 01:32 AM

Re: Subcategory text & images for x-cart 4.1.5
 
OK, pulling my hair out now :( I even tried to add this
Code:

{if $subcategories[cat_num].icon_url}<IMG height="100" border="0" alighn="middle" src="{if

$subcategories[cat_num].icon_url}{$subcategories[cat_num].icon_url}{else}{$xcart_web_dir}/icon.php?catego

ryid={$cat}{/if}

from the other mod in place of this part with no joy .... going to cry soon! lol

ezi designs 01-28-2007 07:35 AM

Re: Subcategory text & images for x-cart 4.1.5
 
Hello

You may wish to look over the forum as like i have stated this works with 4.1.x not your version as there is more than likely some text difference.


Richard


All times are GMT -8. The time now is 02:18 AM.

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