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)
-   -   Mod for subcategories in columns with descriptions and icons (https://forum.x-cart.com/showthread.php?t=3848)

eurojet 01-01-2008 07:30 PM

Re: Mod for subcategories in columns with descriptions and icons
 
i cant find xcart/include/catagories.php....
help?

jcgoldy 01-06-2008 09:19 AM

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?

MoonDog 01-06-2008 09:23 PM

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 -

jcgoldy 01-07-2008 06:52 PM

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)

MoonDog 01-07-2008 10:23 PM

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 -

boxerbay 01-22-2008 01:55 PM

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 -


billstevens 02-04-2008 01:22 PM

Re: Mod for subcategories in columns with descriptions and icons
 
Working great in 4.1.9 Thanks!

karentown 02-07-2008 06:04 AM

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" }


karentown 02-15-2008 01:33 AM

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

rashriaz 02-15-2008 01:53 AM

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"}

karentown 02-15-2008 06:33 AM

Re: Mod for subcategories in columns with descriptions and icons
 
It is still jumping down one level on the end.....

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

Pulling my hair out!

karentown 02-15-2008 06:36 AM

Re: Mod for subcategories in columns with descriptions and icons
 
Its fixed ... yay! Thank you!!!

itsmeee 02-20-2008 12:59 PM

Re: Mod for subcategories in columns with descriptions and icons
 
amazing mod, thanks everyone who has put the time into this!

Logo2k 03-04-2008 04:53 PM

Re: Mod for subcategories in columns with descriptions and icons
 
Could anyone give me an example or the full template of the sub categories displayed in 2 columns for the latest v4?

I don't need icons. I just need to split the subs up in 2 or maybe even 3 columns.

Any help is greatly appreciated.

Thanks

andy@calsound.com 05-05-2008 12:25 PM

Re: Mod for subcategories in columns with descriptions and icons
 
Is there a way to make this mod affect only certain categories? We sell vinyl records and dj equipment, I want logos for manufacruters of equipment, but not for "styles" of music.

MBA 05-21-2008 07:36 PM

Re: Mod for subcategories in columns with descriptions and icons
 
This works great in v4.1.10 - you know what would put this mod over the top!?!

"1. the default "No Image Available" image is displayed if none is assigned"

If the first available image in the subcategory group was displayed instead of the no_image_available default image.

...OR!!! To randomly grab a new image from the subcategory group. So if you have 115 products in a subcategory and 108 of them have an image associated with it (i.e. not a no image available image). The subcategory image would show any one of the available 108 available images each time the page reloads. And in my beautiful perfect world, the image would auto resize to a predefined subcategory image size. :) I'm liking this mod more and more. :)

xtestedx 06-01-2008 05:32 PM

Re: Mod for subcategories in columns with descriptions and icons
 
why is this happening?

[img]/shop/icon.php?categoryid=276[/img] BIKINI'S 11 Items [img]/shop/icon.php?categoryid=275[/img] MONOKINI 3 Items
[img]/shop/icon.php?categoryid=274[/img] ONE PIECES 25 Items [img]/shop/icon.php?categoryid=277[/img] YINGFA 11 Items

no images i have dynamic image generator does that make a difference?

xtestedx 06-01-2008 06:24 PM

Re: Mod for subcategories in columns with descriptions and icons
 
Girls Swimwear
GIRLS
http://www.slixaustralia.com.au/shop/files/thumbnails/t_16169.jpg BIKINI'S 11 Items [img]/shop/default_icon.gif[/img] MONOKINI 3 Items
[img]/shop/default_icon.gif[/img] ONE PIECES 25 Items [img]/shop/default_icon.gif[/img] YINGFA 11 Items

this is what im getting now !! please what am i doing wrong!!

http://www.slixaustralia.com.au/shop/home.php?cat=254

xtestedx 06-01-2008 06:53 PM

Re: Mod for subcategories in columns with descriptions and icons
 
don't worry i just changed the [img] tags with <img src=zxxxxx > go figure! it works

mescalito_ve 07-09-2008 03:36 AM

Re: Mod for subcategories in columns with descriptions and icons
 
Hello
Im trying in version 4.1.10

I just used this mod and works fine except for the icons that doesnt show up even they show up in the admin area.

Any suggestions?

thank you

lindseyabrandon 07-16-2008 10:05 AM

Re: Mod for subcategories in columns with descriptions and icons
 
I am having trouble finding the include folder. I have read through all 26 pages of this thread and saw someone else had an issue finding it as well and got the following response:


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


Unfortunately, I just can't seem to find the include folder. It is probably obvious, can anyone help please? I can't wait to try this mod.

mescalito_ve 07-17-2008 01:57 AM

Re: Mod for subcategories in columns with descriptions and icons
 
I found the solution for the subcategory icons not showing for version 4.1.10

The solution is to set the Image Location for your icons to file system and it works perfectly.

Thank you all

mescalito_ve 07-17-2008 02:00 AM

Re: Mod for subcategories in columns with descriptions and icons
 
lindseyabrandon do you have your xcart in the root directory?

Anyway the include folder is inside the xcart root folder not necesarily in the root of your domain.

Hope it helps

lindseyabrandon 07-17-2008 11:34 AM

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

Originally Posted by balinor
A few things:

-Are your category icons in the database or the file system?
-If they are in the file system, make sure the permissions and htaccess file are correct on that folder
-Can you see the category icons in the admin area?


I finally found my include folder...it was only accessible through FTP and I was looking in the Admin section. I think I have the mod installed correctly, but the images aren't showing up.
They are in the file system, but I am unclear how to make sure the permissions and htaccess files are correct.
I can see the category icons in the admin area.

I am so close to being done, please help! :lol:

mcpilot 08-07-2008 05:56 PM

Re: Mod for subcategories in columns with descriptions and icons
 
Awesome MOD! Works well in 4.1.10 as well.

gpagan 08-27-2008 07:46 PM

Re: Mod for subcategories in columns with descriptions and icons
 
Thanks to all that created the mod :lol: , but I'm still on the below problem can someone tell me what I missed, I followed the all the directions and still can't get it to display right. 8O

Thanks

Quote:

Originally Posted by alreadyregistered
I have the mod working for my version (see below). However, the thumbnail placement, according to the division, is not good.

I have:
15 subcategories (in one category)
code set for 3 columns, colspan=3

Displays as
4 images on first row
3 images on 2nd, 3rd, 4th rows
2 image on last row

Rather than 3 items on each row. Any ideas how to (scalably) force this?


Lingerieblowout 08-28-2008 06:40 AM

Re: Mod for subcategories in columns with descriptions and icons
 
gpagan - Please post your code from subcategories.tpl so i can have a look

gpagan 08-28-2008 10:51 AM

Re: Mod for subcategories in columns with descriptions and icons
 
Here it is. Thanks

{* $Id: subcategories.tpl,v 1.43.2.2 2004/10/07 07:08:51 max Exp $ *}
{if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu ne "Y"}


{include file="modules/Bestsellers/bestsellers.tpl"}
{/if}


{if ($navigation_page eq "")||($navigation_page eq "1")}{$current_category.description|regex_replace: "/[\n]/":"
"}
{/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}
{* ==================== Sub categories mod start *}
{foreach from=$subcategories item=subcat name="subcats"}
{ if $smarty.foreach.subcats.first }
<table cellspacing="5" 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}" <a href="home.php?cat={ $subcat.categoryid }"><img src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_w eb_dir}/spacer.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>
{/if}
{/foreach}
{* ==================== Sub categories mod end *}
{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}

{ 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_man}
{/if}
{/capture}
{include file="dialog.tpl" title=$current_category.category content=$smarty.capture.dialog extra="width=100%"}
{if $products eq ""}
{if $f_products ne ""}


{include file="customer/main/featured.tpl"}
{/if}
{/if}
{ include file="customer/main/navigation.tpl" }

toddpatterson 09-19-2008 05:40 PM

Re: Mod for subcategories in columns with descriptions and icons
 
Ok guys, I am REALLY confused. I have been trying to find out how to put the category images on our site and I was referred to this forum topic. I do not know how to use this code or where it is goes....can anyone give me some direction here?

We are using version 4.1.11

Thanks in advance for any help!

lindseyabrandon 09-19-2008 06:21 PM

Re: Mod for subcategories in columns with descriptions and icons
 
I hear you...I was in the same boat and ended up just spending the points to have the X-Cart people help me and I am glad I did. I would suggest that.
Good luck!

finestshops 09-19-2008 06:30 PM

Re: Mod for subcategories in columns with descriptions and icons
 
Hi toddpatterson,

Please try to replace customer/main/subcategories.tpl with this file:

{* $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"}

{include file="modules/Bestsellers/bestsellers.tpl"}
{/if}

{if $active_modules.Special_Offers && $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"}
{foreach from=$subcategories item=c key=catid}
{if $c.category}{assign var="tmp" value="1"}{/if}
{/foreach}


{if $subcategories}

{*
<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>
*}

{* subcategories in 4 columns mod by Finestshops.com *}
<table border=0 cellspacing="0" cellspacing="0" width="100%">
{foreach from=$subcategories key=k item=subcat name=subcategories}
{if $smarty.foreach.subcategories.index is div by 4}
</tr><tr valign="top">
{/if}
<td valign="top" width="25%" align="center">

<A href="home.php?cat={ $subcat.categoryid }"><IMG alt="{* $subcat.category|escape *}" border="0" src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_w eb_dir}/icon.php?categoryid={$subcat.categoryid}{/if}"></a>
<br>
<A href="home.php?cat={ $subcat.categoryid }"><FONT class="ItemsList">{ $subcat.category|escape }</FONT></A>
<br>
<FONT class="Text">{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}
</FONT>
</td>
{/foreach}
</tr>
</table>
{* subcategories in 4 columns mod by Finestshops.com *}

<table width="100%" cellpadding="5" cellspacing="1">

{math equation="floor(100/x)" x=$config.Appearance.products_per_row assign="width"}

{section name=product loop=$products}
{assign var="discount" value=0}

{if %product.index% is div by $config.Appearance.products_per_row}
<tr>
{assign var="cell_counter" value=0}
{/if}

{math equation="x+1" x=$cell_counter assign="cell_counter" }

<td width="{$width}%" class="PListCell">

<a href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_p age}" class="ProductTitle">{$products[product].product}</a><br />
{if $config.Appearance.display_productcode_in_list eq "Y" and $products[product].productcode ne ""}
{$lng.lbl_sku}: {$products[product].productcode}<br />
{/if}
<table cellpadding="3" cellspacing="0" width="100%">
<tr>
<td height="100" nowrap="nowrap" align="center">{include file="product_thumbnail_cust.tpl" product=$products[product]}</td>
</tr>
</table>
<a href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_p age}{if $featured eq 'Y'}&amp;featured{/if}">{$lng.lbl_see_details}</a>
{if $products[product].product_type ne "C"}
<br />
<br />
{if $active_modules.Subscriptions ne "" and $products[product].catalogprice}
{include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else}
{if $config.General.unlimited_products ne "Y" && ($products[product].avail le 0 or $products[product].avail lt $products[product].min_amount) && $products[product].variantid}
&nbsp;
{elseif $products[product].taxed_price ne 0}
{if $products[product].list_price gt 0 and $products[product].taxed_price lt $products[product].list_price}
{math equation="100-(price/lprice)*100" price=$products[product].taxed_price lprice=$products[product].list_price format="%3.0f" assign=discount}
{if $discount gt 0}
<font class="MarketPrice">{$lng.lbl_market_price}: <s>
{include file="currency.tpl" value=$products[product].list_price}
</s></font><br />
{/if}
{/if}
<font class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].taxed_price}</font><br /><font class="MarketPrice">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price}</font>{if $discount gt 0}{if $config.General.alter_currency_symbol ne ""},{/if} {$lng.lbl_save_price} {$discount}%{/if}
{if $products[product].taxes}<br />{include file="customer/main/taxed_price.tpl" taxes=$products[product].taxes}{/if}
{if $active_modules.Special_Offers ne "" and $products[product].use_special_price ne ""}
{include file="modules/Special_Offers/customer/product_special_price.tpl" product=$products[product]}
{/if}
{else}
<font class="ProductPrice">{$lng.lbl_enter_your_price}</font>
{/if}
{/if}
{if $active_modules.Feature_Comparison ne '' && $products[product].fclassid > 0}
<div align="center" style="width: 100%; padding-top: 10px;">
{include file="modules/Feature_Comparison/compare_checkbox.tpl" id=$products[product].productid}
</div>
{/if}
{*** Uncomment it if you need 'Buy Now' button ***
{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y"}
{include file="customer/main/buy_now.tpl" product=$products[product]}
{/if}
*** Uncomment it if you need 'Buy Now' button ***}
{/if}
</td>

{capture name=prod_index}
{math equation="index+x+1" index=%product.index% x=$config.Appearance.products_per_row}
{/capture}
{if $smarty.capture.prod_index is div by $config.Appearance.products_per_row }
</tr>
{/if}

{/section}

{if $cell_counter lt $config.Appearance.products_per_row}
{section name=rest_cells loop=$config.Appearance.products_per_row start=$cell_counter}
<td class="SectionBox">&nbsp;</td>
{/section}
</tr>
{/if}

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

toddpatterson 09-20-2008 12:37 AM

Re: Mod for subcategories in columns with descriptions and icons
 
Thanks a million! It looks like that is EXACTLY what I was looking for. I appreciate it!

Todd

aerogear2000 10-15-2008 10:11 PM

Re: Mod for subcategories in columns with descriptions and icons
 
Hello I have 4.1.11 which post will show me how to do this mod, post number please

barryb12000 10-16-2008 11:58 AM

Re: Mod for subcategories in columns with descriptions and icons
 
I used #271 and it worked for me just fine

gotpump 10-20-2008 05:07 PM

Re: Mod for subcategories in columns with descriptions and icons
 
Great mod. Anyway to remove the product list from the main page though?

Shows all my categories on my welcome page but also is including product images with price. Any way to get rid of this?

altairastro 11-30-2008 05:49 AM

Re: Mod for subcategories in columns with descriptions and icons
 
Hi Guys I tried the code in post #271 which had some interesting effects

- displays the category thumbnail and a header link
- unfortunately it doesn't show the category description text
- it seems to have swapped sides with the lefthand navigation which has jumped to the righthand side of the page...

looks like I need to make some changes :smile: any ideas?

Nick

Bobarra_Webmaster 12-09-2008 09:44 AM

Re: Mod for subcategories in columns with descriptions and icons
 
Hi, I tried using this mod. I liked the way you were pulling in information. I changed it a bit to make a <ul> instead, but there is something wrong. It's not pulling any data from the database. The loop works fine, all the HTML gets populated, but wherever the data should appear, the HTML is blank. Is there a reason why this wouldn't pull in data for me? Maybe the version?

Below is the code, thanks very much to anyone who considers this small issue.

Code:

{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}
<ul id="subcategories">
{section name=cat_num loop=$subcategories}
    <li>
        <a href="home.php?cat={$subcategories[cat_num].categoryid}"><img src="{$xcart_web_dir}/image.php?id={$subcategories[cat_num].categoryid}&amp;type=C" alt="" class="p_img" /></a>
        <p class="subcategory_p_title"><a href="home.php?cat={$subcategories[cat_num].categoryid}">{$subcategories[cat_num].category|escape}</a></p>
        <p class="subcategory_p_desc">{$categories[cat_num].description|escape}</p>
    </li>
{/section}
</ul>


davidsaldana 12-17-2008 11:17 AM

Re: Mod for subcategories in columns with descriptions and icons
 
this is a great mod. Looking for a modified version, which would read as follows:

CategoryA (Image)
CategoryA (title)
SubcategoryA (title)
SubcategoryB (title)
SubcategoryC (title)

Does anyone know how to modify the code to do that???

hyper1 01-21-2009 07:46 PM

Re: Mod for subcategories in columns with descriptions and icons
 
I am using the code from post #271 to display my subcategories using version 4.1.10, although I changed the code to only display one category image and title per row. I have read and re-read this post over and over and I cannot find code that will work in v4.1.10 that allows for the inclusion of the category description within the row. When complete, I would like to display the category image on the left, then the category title to the right of the image and the category description below the category description. Would someone please help me understand how to add the additional code to the template(s) in v4.1.10?

Thank you so much in advance,

GiZ 01-22-2009 05:05 AM

Re: Mod for subcategories in columns with descriptions and icons
 
I moved the code for the css to the skin1_c.css and this worked.


All times are GMT -8. The time now is 12:40 AM.

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