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

evolv 02-19-2007 10:37 PM

Re: Subcategory text & images for x-cart 4.1.5
 
This is exactly what I wanted and I followed the instructions exactly, but I cannot get Images for my sub-categories to show up.

Is there another change other then the one in blue above that will get the images to show up???

thanks

Warwick 02-21-2007 06:14 AM

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

Works with 4.1.3 :)

obaluba2 02-23-2007 12:26 AM

Re: Subcategory text & images for x-cart 4.1.5
 
Did anyone manage to solve why Images werent showing up? I've installed this mod and all seems fine except I cant see the images!

Is the code in question

<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="" />

anyone have any ideas?

thanks :)

Wambli 02-23-2007 08:48 AM

Re: Subcategory text & images for x-cart 4.1.5
 
Ok I have x-cart 4.1x and my categories.php does not have that line of code? does anyone have this mod or anything like it that is working in my version of x-cart Please someone help:

Warwick 02-23-2007 09:12 AM

Re: Subcategory text & images for x-cart 4.1.5
 
I have 4.1.3 and with this version it is at

Line 117 in myshopurl/include/categories.php

Newpowerr 04-08-2007 06:23 AM

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

Originally Posted by obaluba2
Did anyone manage to solve why Images werent showing up? I've installed this mod and all seems fine except I cant see the images!

Is the code in question

<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="" />

anyone have any ideas?

thanks :)



That is because there is an error in the code, everybody is doing a nice copy and paste without looking at the code as to what it does.
In the code it says: {$xcart_w eb_dir}/default_image.gif{/if}

As many of you can see, there is an ampty space between the w and the eb of the word xcart_web_dir. Get rid of this empty space and it will work fine.

loly 05-27-2007 09:47 AM

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

Originally Posted by evolv
This is exactly what I wanted and I followed the instructions exactly, but I cannot get Images for my sub-categories to show up.

Is there another change other then the one in blue above that will get the images to show up???

thanks


well hope you have fiquerd it out by now, but i relized that you need to add subcatagories to your catagory in order for your catagories icons to show up.

loly 05-27-2007 09:52 AM

Re: Subcategory text & images for x-cart 4.1.5
 
thank you for this great mod :-) if you happend to fiquir out how icons can line up correctly please pass me the code. here is how it lookes on my site http://www.zafafy.com/shop/home.php?cat=318

PP 05-28-2007 07:49 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Great mod thanks for sharing, one issue I see is it looks great at 1024x768 and less but any resolutions above this and the text moves off to the side of the image. So in my case running 1280x1024 and 1440x900 it looks a mess. Is there any way to make the text stick under the image with out going to tables ?

Seacat 06-02-2007 03:22 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Really like this mod! Adjusted a few things to get it to work with my site. Here's a little variation on the theme::D/

Left this: /includes/categories.php as in post #1.

In /skin1/customer/main/subcategories.tpl, used a little bit like this:

{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}/self-defense-weapons.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}

This validates as xhtml/transitional and displays a category image that has been uniformly set to 105px on the long side. Then puts the text link for the subcategory name to the right of the image. It uses title tags with the two hrefs and an alt tag for the image. These are all subcategory names. Keyword bliss.

In skin1/skin1.css, a few changes:

.ColumnTitles {
padding-top: 12px;
padding-right: 10px;
padding-bottom: 3px;
padding-left: 10px;
text-align: left;
margin: 0px;
width: 33%;
}

It works for me, may play with some spacing and alignment a little more, see it here: http://www.misdefenseproducts.com/Home-Security-Decoys-p-1-c-272.html

roblen 06-05-2007 02:37 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Seems to work except that the first row is one category too many
if divide by 2 then the first row has three cats and the following rows are correct with two.
is anyone else getting this.?
version 4.1.7

I solved it for me.
the code that assigns sthe var to 0 sould be 1

{ if $tmp and $first_subcat ne "Y" }
{assign var="tmp" value=0}
{assign var="first_subcat" value="Y"}

needs to be changed to

{ if $tmp and $first_subcat ne "Y" }
{assign var="tmp" value=1}
{assign var="first_subcat" value="Y"}

Seacat 06-05-2007 03:50 PM

Re: Subcategory text & images for x-cart 4.1.5
 
I don't know why that is on your system. Mine displays in two columns all the way down. Had the problem with one column on first and last rows until setting the cntr variable to 0 at the start. If it works for you that way, great!

Funinc 06-08-2007 04:01 PM

Re: Subcategory text & images for x-cart 4.1.5
 
I have all the parts in and working with the excepition of the category image showing.

see example:
http://www.nastygear.com/nastygear/home.php?cat=115
Beware adult products

Has anyone been able to get sub category icon images to show in version 4.1.3

Thanks,
Timm

Seacat 06-08-2007 05:07 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Would you mind double checking your code for spaces? Particularly {$xcart_w eb_dir} and a few others have some spaces in there that were included during the post to the forum. Don't know why this happens. Have seen it in many threads where spaces are arbitrarily added during posting of code.

Double check that, if that isn't the problem, make sure you have assigned a category icon and that you can see it there in admin. You've probably already done this....Also, I think you may need to add a product to the category before the cat image will show. If none of this fixes your problem, I'll try to help if I can. I'm no expert though. :D

Funinc 06-15-2007 05:41 AM

Re: Subcategory text & images for x-cart 4.1.5
 
I have checked and removed all spaces. I have the Icon in the sub category in the admin and I have products added and still nothing....Help...anyone???

Seacat 06-15-2007 12:01 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Sounds like things are in order. Did you make the change to categories.php as outlined in post #1? I don't know how much difference there is between 4.1.3 and 4.1.6 with this. Can you post your subcategories.tpl? I'll see if I can help...Also, don't know what your original 4.1.3 code looked like in subcategories.tpl but in post #1 there was an [images] tag mentioned. Haven't seen that code to know if it was in there or not. May want to check and see the placement on that.

Funinc 06-15-2007 01:38 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Here is my subcategories.tpl...I have done all mentioned.

Thanks for taking a look

This I have implemented on a different cart with version 4.1.6

Same issue

{* $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}
{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}/default_image.gif{/if}" alt="{$subcat.category|escape}" /></a></td>
<td align="left" 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 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}
<hr size="1" width="100%" />
{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" }

Seacat 06-15-2007 02:01 PM

Re: Subcategory text & images for x-cart 4.1.5
 
OK, looked at your code there. You have a couple of other things going on at the beginning. Maybe you could paste my code in there and then add your other changes in to see if it breaks.

{* $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}/self-defense-weapons.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"}



Change this part: {$xcart_web_dir}/self-defense-weapons.jpg for your default image. You may have to check again for spaces added during this post. This should fly for you. Then tweak it to suit for your Bestsellers and other stuff you have in there.

Let me know...

Oh forgot to mention, this file has been modded to show featured products on subcats that have products in them. Had to modify home.php lines 45-49 have been changed to this

#if (!empty($cat))
# include "./products.php";

if (empty($products))
include "./featured_products.php";

if (!empty($cat))
include "./products.php";

Which runs to line 52. Got this from another post.

Funinc 06-15-2007 02:11 PM

Re: Subcategory text & images for x-cart 4.1.5
 
check it out same results

http://jodyforster.com/v416/home.php?cat=1

Seacat 06-15-2007 02:59 PM

Re: Subcategory text & images for x-cart 4.1.5
 
Yeah, i see that...Looks real good if the images would pop in there.

Your view source shows this:
<img src="/v416/default_image.gif" alt="Antenna Pennants" />

Mine shows this:

<img src="http://www.misdefenseproducts.com/images/C/diversion-safe-DS-PEANUTBUTTER.jpg" alt="diversion safe" />

That it pulls from this part in the code:

<img src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_web_dir}/self-defense-weapons.jpg{/if}" alt="{$subcat.category|escape}" />

I suppose you've discovered that yours is pulling from the else condition.

I'm not an expert, but the highlighted part above seems to not be picking up. I'm sure you've been around this already. If the image shows in your admin side, it should pick that part up and display it.
My first thought would be some path problem somewhere. I guess this is as far as I can go with this. Maybe someone else can help you. Sorry! When you get it fixed, please let me know what it was. I'm curious because this should be working for you, same version, same code. Hmmmm.

Perhaps it could be permissions or something. I'd troubleshoot by adding a hard coded url to an image in your images/C directory over the highlighted part and see if it picks up. If it does then put the code back and it shouldn't be permissions on the directory, its somewhere else. Just a thought.

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 11:53 PM.

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