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

Mod for subcategories in columns with descriptions and icons

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #241  
Old 01-01-2008, 07:30 PM
 
eurojet eurojet is offline
 

Member
  
Join Date: Dec 2007
Posts: 12
 

Default Re: Mod for subcategories in columns with descriptions and icons

i cant find xcart/include/catagories.php....
help?
__________________
xcart version 4.1.6
Reply With Quote
  #242  
Old 01-06-2008, 09:19 AM
 
jcgoldy jcgoldy is offline
 

Advanced Member
  
Join Date: Sep 2007
Posts: 52
 

Default Re: Mod for subcategories in columns with descriptions and icons

I was wondering if you could change it with the picture on the left and the name of the subcategory on the right, going down the page?
__________________
Version 4.1.12 Gold
Reply With Quote
  #243  
Old 01-06-2008, 09:23 PM
 
MoonDog MoonDog is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 93
 

Default Re: Mod for subcategories in columns with descriptions and icons

eurojet,

Quote:

i cant find xcart/include/catagories.php....

xcart is your root directory. Just look for the include folder and the catagores.php file should be in there.


jcgoldy,

Quote:

I was wondering if you could change it with the picture on the left and the name of the subcategory on the right, going down the page?

Just change the width and text-align code in your skin1/skin1.css file to this:
Code:
/* For subcategories in columns with descriptions and icons */ .ColumnTitles { TEXT-ALIGN: left; WIDTH: 100%; PADDING-LEFT: 5px; }

and replace the code from <table ..to...</table> in skin1/customer/main/subcategories.tpl with this:

Code:
<table cellspacing="5" width="100%" border="0"> <tr> {foreach from=$subcategories item=subcat} {if $tmp is div by 1} </tr> <tr><td colspan="1"></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 href="home.php?cat={ $subcat.categoryid }"><img src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_web_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 }) {elseif $subcat.subcategory_count}({ $subcat.subcategory_count }) {else} (0) {/if} {/if} {assign var="tmp" value=$tmp+1} {/foreach} </tr> </td> </table>

Make sure you also change the code in xcart/include/categories.php as noted in post #211.

I think that should do it.

- MoonDog -
__________________
X-CART Gold v4.1.8
Reply With Quote
  #244  
Old 01-07-2008, 06:52 PM
 
jcgoldy jcgoldy is offline
 

Advanced Member
  
Join Date: Sep 2007
Posts: 52
 

Default Re: Mod for subcategories in columns with descriptions and icons

let me explain a little better. I was hoping to have the text displayed on the right side of the pictures...is this possible?

http://www.thebabblingbaby.com/newbaby/images/C/TYC091thumb.jpg
Thank You Cards - To Match Announcements (1)
__________________
Version 4.1.12 Gold
Reply With Quote
  #245  
Old 01-07-2008, 10:23 PM
 
MoonDog MoonDog is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 93
 

Default Re: Mod for subcategories in columns with descriptions and icons

Hi jcgoldy,

See if this works. I changed the code, it's quick and dirty and I have not tested it.
Let me know if it doesn't work and I'll try to correct it by this weekend.

Code:
<table cellspacing="5" width="100%" border="0"> <tr> {foreach from=$subcategories item=subcat} {if $tmp is div by 1} </tr> <tr><td colspan="1"></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 width="125" valign="top"> <a href="home.php?cat={ $subcat.categoryid }"><img src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_web_dir}/default_image.gif{/if}" alt=""></a></td> <td align="left" valign="middle"> <a href="home.php?cat={ $subcat.categoryid }"> <font class="ItemsList">{ $subcat.category|escape }</font></a> {if $config.Appearance.count_products eq "Y"} {if $subcat.product_count}({ $subcat.product_count }) {elseif $subcat.subcategory_count}({ $subcat.subcategory_count }) {else} (0) {/if} {/if} {assign var="tmp" value=$tmp+1} {/foreach} </tr> </td> </table>

- MoonDog -
__________________
X-CART Gold v4.1.8
Reply With Quote
  #246  
Old 01-22-2008, 01:55 PM
 
boxerbay boxerbay is offline
 

Senior Member
  
Join Date: Nov 2002
Posts: 170
 

Default Re: Mod for subcategories in columns with descriptions and icons

Looks like there is a syntax error below in the subcategories.tpl insert.

Code:
<td class="ColumnTitles" valign="top"><a title="{$subcat.description}" <a href="home.php?cat={ $subcat.categoryid }"><img src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_web_dir}/default_image.gif{/if}" alt="" /><br>

notice <a title="{$subcat.description}" <a theres a double a< a< and it made my display a bit weird.

well i removed <a title="{$subcat.description}" to avoid from pulling in the description.

Quote:
Originally Posted by MoonDog
This is for v4.1.8

Thanks to mrkenzie from post #137 for the modifications and the original poster 27stars for the original creation, I got this working on v4.1.8 with just minor modifications.

These instructions are basically the same as post #137, but I'll explain it with the code modifications that I have.

Mod for subcategories in columns with descriptions and icons for v4.1.8
1. the default "No Image Available" image is displayed if none is assigned
2. product description is displayed below the icon.
3. quantity will display a number in parenthesis and without the word 'product' and "(0)" if there are no subcategories or products for a particular category.
4. and it will also show the subcategory DESCRIPTION if there is one when you hover over the subcategory link.
------------------------------------------------------------

Start by adding this code to the end of the xcart/skin1/skin1.css file.

Code:
/* For subcategories in columns with descriptions and icons */ .ColumnTitles { TEXT-ALIGN: center; WIDTH: 33% PADDING-LEFT: 5px; }

Find the following code in xcart/include/categories.php:

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

and replace with this (in order to get the category description):

Code:
$_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);

Next, find the following code, from <table ..to...</table> in skin1/customer/main/subcategories.tpl and delete it:

Code:
<table cellspacing="5" width="100%"> {foreach from=$subcategories item=subcat} <tr> {if $tmp and $first_subcat ne "Y"} <td valign="top" rowspan="{count value=$subcategories print="Y"}"><img src="{if $current_category.icon_url}{$current_category.icon_url}{else}{$xcart_web_dir}/image.php?id={$cat}&amp;type=C{/if}" alt="" /></td> {assign var="first_subcat" value="Y"} {/if} <td class="SubcatTitle"><a href="home.php?cat={ $subcat.categoryid }"><font class="ItemsList">{ $subcat.category|escape }</font></a><br /></td> <td class="SubcatInfo">{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}</td> </tr> {/foreach} </table>

And replace that code with this:

Code:
<table cellspacing="5" width="100%" border="0"> <tr> {foreach from=$subcategories item=subcat} {if $tmp is div by 3} </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}" <a href="home.php?cat={ $subcat.categoryid }"><img src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_web_dir}/default_image.gif{/if}" alt="" /><br> <font class="ItemsList">{ $subcat.category|escape }</font></a> {if $config.Appearance.count_products eq "Y"} {if $subcat.product_count}({ $subcat.product_count }) {elseif $subcat.subcategory_count}({ $subcat.subcategory_count }) {else} (0) {/if} {/if} {assign var="tmp" value=$tmp+1} {/foreach} </tr> </td> </table>

And thats it.

-------------------------------------------------------------

The default is 3 columns. But if you want to change the number of columns, then just change all the 3's to the number of columns you want in this line of code (from above):

4 column example (two number 3's was changed to 4):
Code:
{if $tmp is div by 4} </tr><tr><td colspan="4"></td></tr><tr valign="top"> {/if}

And also change the following line in skin1.css (from above) for the appropriate td width % (4 columns is 25%; 2 columns is 50%; etc.)

4 column example:
Code:
.ColumnTitles { TEXT-ALIGN: center; WIDTH: 25%; PADDING-LEFT: 5px; }

To keep the icons aligned evenly on the page , I created my sub-category icons (thumbnails) the same size as the 'No Image Available' image. This size is around 125 x 75 pixels. I've also attached screenshots for the 3 and 4 column displays below.

All the modifications above were made on templates that had no previous modifications. Hope you like it and thanks again to 27stars and mrkenzie.

- MoonDog -
__________________
Thanks,
Alex.
Too many version to list. I have some on 3.51 and some on the latest version.
Reply With Quote
  #247  
Old 02-04-2008, 01:22 PM
 
billstevens billstevens is offline
 

Member
  
Join Date: Oct 2004
Posts: 26
 

Default Re: Mod for subcategories in columns with descriptions and icons

Working great in 4.1.9 Thanks!
__________________
Bill
X-Cart 4.1.9
Reply With Quote
  #248  
Old 02-07-2008, 06:04 AM
 
karentown karentown is offline
 

Senior Member
  
Join Date: Apr 2005
Posts: 129
 

Default Re: Mod for subcategories in columns with descriptions and icons

Am I being an idiot or what? I am setting the code to show coloumns in fours but it is setting to five .... I have changed the css as per boxerbay ... why is this happening?

Here is an example

http://www.organ-nics.com/store/home.php?cat=264

and this is my subcategory code:

Code:
{* $Id: subcategories.tpl,v 1.43.2.9 2006/06/27 08:22:01 svowl Exp $ *} {* if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu ne "Y" * } {include file="modules/Bestsellers/bestsellers.tpl"} {*/if*} {* if $active_modules.Special_Offers and $category_offers * } <BR><BR> {include file="modules/Special_Offers/customer/category_offers_short_list.tpl"} {*/if*} {if ($navigation_page eq "")||($navigation_page eq "1")}{$current_category.description}<BR><BR>{/if} {capture name=dialog} {assign var="tmp" value="0"} {section name=cat_num loop=$subcategories} {if $subcategories[cat_num].category}{assign var="tmp" value="1"}{/if} {/section} {if $subcategories} <table cellspacing="4" width="100%" border="0"> <tr> {foreach from=$subcategories item=subcat} {if $tmp is div by 4} </tr><tr><td colspan="4"></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_web_dir}/default_image.gif{/if}" alt="" align="middle" <br><left> <font class="ItemsList">{ $subcat.category|escape }</font></a> {if $config.Appearance.count_products eq "Y"} {/if} {assign var="tmp" value=$tmp+1} {/foreach} </table> {/if} {if $tmp and $products ne "" } <BR clear="left"> <HR size="1" noshade> {/if} {if $products} {if $sort_fields} <DIV align="right">{include file="main/search_sort_by.tpl" sort_fields=$sort_fields selected=$search_prefilled.sort_field direction=$search_prefilled.sort_direction url="home.php?cat=`$cat`&"}</DIV> {/if} {if $total_pages gt 2} <BR> { include file="customer/main/navigation.tpl" } {/if} <BR> {include file="customer/main/products.tpl" products=$products} {/if} {if $products eq "" and $tmp eq "0"} {$lng.txt_no_products_in_cat} {/if} {/capture} {include file="dialog.tpl" title=$current_category.category content=$smarty.capture.dialog extra="width=100%"} {if $products eq ""} {if $f_products ne ""} <P> {include file="customer/main/featured.tpl"} {/if} {/if} { include file="customer/main/navigation.tpl" }
__________________
Running stores using the following:

2@ Version 4.0.19
2@ Version 4.1.9
1@ Version 4.1.11
Reply With Quote
  #249  
Old 02-15-2008, 01:33 AM
 
karentown karentown is offline
 

Senior Member
  
Join Date: Apr 2005
Posts: 129
 

Default Re: Mod for subcategories in columns with descriptions and icons

Anyone have any ideas for the above? I am really stuck and it looks so stupid! Thanks for your help
__________________
Running stores using the following:

2@ Version 4.0.19
2@ Version 4.1.9
1@ Version 4.1.11
Reply With Quote
  #250  
Old 02-15-2008, 01:53 AM
 
rashriaz rashriaz is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 72
 

Default Re: Mod for subcategories in columns with descriptions and icons

I had this problem too. Use the following code should work fine

{* $Id: subcategories.tpl,v 1.55.2.1 2006/06/27 08:20:37 svowl Exp $ *}
<p />&nbsp;
{if $active_modules.Special_Offers}
{include file="modules/Special_Offers/customer/category_offers_short_list.tpl"}
{/if}
{if ($navigation_page eq "")||($navigation_page eq "1")}{$current_category.description}<p />&nbsp;{/if}
{capture name=dialog}
{assign var="tmp" value="0"}
{foreach from=$subcategories item=c key=catid}
{if $c.category}{assign var="tmp" value="1"}{/if}
{/foreach}
{if $subcategories}
<table cellspacing="5" width="100%" border="0">
<tr>
{foreach from=$subcategories item=subcat}
{if $tmp is div by 4}
</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"><div align="center"><a title="{$subcat.category|escape}" 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="{$subcat.category|escape}" /></a><br>
<a title="{$subcat.category|escape}" href="home.php?cat={$subcat.categoryid}" align="center">
<font class="ItemsList">{$subcat.category|escape}</font></a> {if $config.Appearance.count_products eq "Y"}
<br/>
{if $subcat.product_count}{elseif $subcat.subcategory_count} {else}

{/if}
{/if}
{assign var="tmp" value=$tmp+1}
{/foreach} </div></td>
</tr>
</table>
{/if}
{if $tmp and $products ne "" }
<br clear="left" />
<hr size="1" noshade="noshade" />
{/if}
{if $products}
{if $sort_fields}
<div style="float:right;">{include file="main/search_sort_by.tpl" sort_fields=$sort_fields selected=$search_prefilled.sort_field direction=$search_prefilled.sort_direction url="home.php?cat=`$cat`&"}</div>
{/if}
{*if $total_pages gt 2}
<br />
{ include file="customer/main/navigation.tpl" }
{/if*}
<br style="clear:both;" /><br />
{include file="customer/main/products.tpl" products=$products}
{/if}
{if $products eq "" and $tmp eq "0"}
{$lng.txt_no_products_in_cat}
{/if}
{/capture}
{include file="dialog.tpl" title=$current_category.category content=$smarty.capture.dialog extra='width="100%"'}
{*if $products eq ""*}
{if $f_products ne ""}
<p />&nbsp;
<hr size="1" noshade="noshade" />
{capture name=dialog}
{include file="customer/main/products.tpl" products=$f_products featured="Y"}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_featured_products content=$smarty.capture.dialog extra="width=100%"}
<p />&nbsp;
{/if}
{include file="customer/main/navigation.tpl"}
__________________
rashriaz
product -x-cart gold 4.1.9
operating system -windows
location - uk
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 08:09 PM.

   

 
X-Cart forums © 2001-2020