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)

espresso 06-26-2007 05:02 AM

Re: Subcategory text & images for x-cart 4.1.5
 
What a great mod. I got it working on 4.1.7., thanks guys...
It would even be better if it would show how many sub categories are inside a category instead of just the total item count (just like the default tpl did). I'm sure it's just a one line "if" statement.

Funinc 07-10-2007 03:13 PM

Re: Subcategory text & images for x-cart 4.1.5
 
After beating my head againist the wall, I finally figured it out. The images have to be in your file system not database. Changed it and it works perfectly....

Coach Wireless 07-17-2007 03:28 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Has anyone gotten this mod to work on v4.1.8?

kanjigirl 07-18-2007 01:18 PM

Re: Subcategory text & images for x-cart 4.1.5
 
I have this working nicely in Firefox:

http://www.parallaxwebdesign.com/projects/timbercreek/xcart/home.php?cat=275

However in IE7 it puts a big wide space between the left menu and the subcats. Can anyone tell me why this might be happening?

kanjigirl 07-18-2007 01:37 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Never mind, I answered my last question - adding a description to the category made it take up the full space in IE7.

Madhatterr 07-20-2007 11:35 AM

Re: Subcategory text & images for x-cart 4.1.5
 
1 Attachment(s)
I'm working on modifying my files to test this out and I got a strange bit of text I'm not sure how to get rid of. Please see the attached JPG.
Thanks to anyone who can help out with this total mind bender! :mrgreen:

Since I know you may need to look at my code here it is for my subcategories.tpl -

Quote:

{* $Id: subcategories.tpl,v 1.55.2.1 2006/06/27 08:20:37 svowl Exp $ *}
{if ($navigation_page eq "")||($navigation_page eq "1")}{$current_category.description}<p />{/if}
{assign var="tmp" value="0"}
{foreach from=$subcategories item=c key=catid}
{if $c.category}{assign var="tmp" value="1"}{/if}
{/foreach}
{if $tmp and $first_subcat ne "Y"}
<div style="float:right;"><img src="{if $current_category.icon_url}{$current_category.icon _url}{else}{$xcart_web_dir}/image.php?id={$cat}&amp;type=C{/if}" alt="" /></div>
{assign var="first_subcat" value="Y"}
<br style="clear:left;" />
{/if}

{if $active_modules.Bestsellers ne "" and $config.Bestsellers.bestsellers_menu ne "Y"}
<p />
{include file="modules/Bestsellers/bestsellers.tpl"}
{/if}
<p />
{if $active_modules.Special_Offers}
{include file="modules/Special_Offers/customer/category_offers_short_list.tpl"}
{/if}
{capture name=dialog}
{if $subcategories}
{assign var="cntr" value="0"}
<table cellspacing="5" width="100%" border="0">
<tr align="right">
{foreach from=$subcategories item=subcat}
{if $cntr is div by 2}
<td colspan="3" align="right"></td></tr><tr>
{/if}
{if $first_subcat ne "Y"}
{assign var="first_subcat" value="Y"}
{/if}
<td align="right"><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}/hsnopic.jpg{/if}" alt="{$subcat.category|escape}" /></a></td>
<td align="right" class="ColumnTitles"><a title="{$subcat.category|escape}" href="home.php?cat={$subcat.categoryid}">
<font class="ItemsList">{$subcat.category|escape}</font></a></td>
{if $config.Appearance.count_products eq "Y"}
{if $subcat.product_count}{$subcat.product_count}{$lng .lbl_products}
{elseif $subcat.subcategory_count}{$subcat.subcategory_cou nt}{$lng.lbl_categories|lower}
{else} 0 Products
{/if}
{/if}
{assign var="cntr" value=$cntr+1}
{/foreach}
</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 />
<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 />
{/if}
{include file="customer/main/navigation.tpl"}


kanjigirl 07-20-2007 11:52 AM

Re: Subcategory text & images for x-cart 4.1.5
 
I saw something like that (Madhatterr) when I was trying to get this to work, but I don't remember exactly what produced it...

Maybe this might help - here's my code from /customer/main/subcategories.tpl:

Code:

{* this section from forum to allow subcat images *}
{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_web_dir}/default_image.gif{/if}" alt="" />
<p class="ItemsList">{ $subcat.category|escape }</p></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}
</td>
</tr>
</table>
{/if}
{* end subcat image code from forum*}


And from skin1_c.css:

Code:

.ColumnTitles {
margin: 0;
padding: 5px 5px 0 5px;
text-align: center;
width: 33%;
}

.ItemsList {
padding: 0;
color: #374C79;
font-weight: bold;
font-size: 12px;
}


Madhatterr 07-20-2007 12:52 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Thank you sooo much for the help Kanjigirl. Here's my full (working) subcategories.tpl code.
My version at this point is 4.1.8 -

Quote:


{* $Id: subcategories.tpl,v 1.55.2.1 2006/06/27 08:20:37 svowl Exp $ *}
{if $active_modules.Bestsellers ne "" and $config.Bestsellers.bestsellers_menu ne "Y"}
<p />
{include file="modules/Bestsellers/bestsellers.tpl"}
{/if}
<p />
{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 />{/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 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.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"}
{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}
</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 />
<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 />
{/if}
{include file="customer/main/navigation.tpl"}



Hope this helps others! :D

Madhatterr 07-26-2007 12:23 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Okay,

Seems I am having a issue still... for some reason the subcat icon pics aren't showing and it keeps showing the nopic.gif default. Anyone know what's up with that? My code is as posted above.

Thanks! :D/

Seacat 07-26-2007 04:19 PM

Re: Subcategory text & images for x-cart 4.1.5
 
The pics should be in the file system instead of the database for it to work. Someone else discovered that when they were having display problems for the icons. If yours are in the file system, then of course something else is going on.:lol:


All times are GMT -8. The time now is 04:10 AM.

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