Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Subcategory text & images for x-cart 4.1.5

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #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
  #2  
Old 01-14-2007, 06:48 PM
 
scalemar scalemar is offline
 

Advanced Member
  
Join Date: Oct 2006
Posts: 35
 

Smile 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
__________________
x-cart V4.4.4
Smart Template
CDSEO
Unix
Reply With Quote
  #3  
Old 01-15-2007, 01:49 PM
 
scalemar scalemar is offline
 

Advanced Member
  
Join Date: Oct 2006
Posts: 35
 

Question 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
__________________
x-cart V4.4.4
Smart Template
CDSEO
Unix
Reply With Quote
  #4  
Old 01-23-2007, 05:17 AM
 
karentown karentown is offline
 

Senior Member
  
Join Date: Apr 2005
Posts: 129
 

Default 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);
__________________
Running stores using the following:

2@ Version 4.0.19
2@ Version 4.1.9
1@ Version 4.1.11
Reply With Quote
  #5  
Old 01-23-2007, 05:25 AM
  photo's Avatar 
photo photo is offline
 

X-Wizard
  
Join Date: Feb 2006
Location: UK
Posts: 1,146
 

Default 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 #
__________________
v4.1.10
In Dev v4.5.x


"If you don't keep an eye on your business, someone else will."
Reply With Quote
  #6  
Old 01-23-2007, 05:31 AM
 
karentown karentown is offline
 

Senior Member
  
Join Date: Apr 2005
Posts: 129
 

Default 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 ?!
__________________
Running stores using the following:

2@ Version 4.0.19
2@ Version 4.1.9
1@ Version 4.1.11
Reply With Quote
  #7  
Old 01-23-2007, 05:32 AM
 
karentown karentown is offline
 

Senior Member
  
Join Date: Apr 2005
Posts: 129
 

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

forget it ...... found it.....version 4.0.19

*sigh*

Will this mod still work?
__________________
Running stores using the following:

2@ Version 4.0.19
2@ Version 4.1.9
1@ Version 4.1.11
Reply With Quote
  #8  
Old 01-24-2007, 10:54 PM
 
karentown karentown is offline
 

Senior Member
  
Join Date: Apr 2005
Posts: 129
 

Default 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
__________________
Running stores using the following:

2@ Version 4.0.19
2@ Version 4.1.9
1@ Version 4.1.11
Reply With Quote
  #9  
Old 01-25-2007, 01:32 AM
 
karentown karentown is offline
 

Senior Member
  
Join Date: Apr 2005
Posts: 129
 

Default 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
__________________
Running stores using the following:

2@ Version 4.0.19
2@ Version 4.1.9
1@ Version 4.1.11
Reply With Quote
  #10  
Old 01-28-2007, 07:35 AM
  ezi designs's Avatar 
ezi designs ezi designs is offline
 

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

Default 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
__________________
x-cart 4.1.6

DSEFU PRO

http.www.demontemplates.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:00 AM.

   

 
X-Cart forums © 2001-2020