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)

hhiker 05-16-2007 10:15 AM

Re: Mod for subcategories in columns with descriptions and icons
 
I have read through this thread & am a bit confused as to what code I need to use to get the sub-category thumbs to show up. I tried a few different things that were shown here but could not get it to function properly so I restored the original subcategories.tpl file to our site.

Can someone post the latest, functional code again please?

pcparts 05-25-2007 03:50 PM

Re: Mod for subcategories in columns with descriptions and icons
 
http://forum.x-cart.com/showthread.php?t=3848&page=14
mrkenzie post #137

This works with 4.1.7

maineiac 05-26-2007 08:40 AM

Re: Mod for subcategories in columns with descriptions and icons
 
mrkenzie post #137 does indeed work with v4.1.7. Thank you!

When checking the html output it seems that the table cells are not closed ie: <td>subcategory icon <td>subcategory icon etc. with no closing </td> tags. Anyone know where/how to fix this?

FIXED:
code: subcategories.tpl:
_________________________________________________
{if $subcategories}
<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}" href="home.php?cat={ $subcat.categoryid }"><font class="ItemsList">{ $subcat.category|escape }</font><br /><img src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_w eb_dir}/default_image.gif{/if}" alt="" />

</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_count } {$lng.lbl_categories|lower}
{else} 0 Products
{/if}
{/if}
{assign var="tmp" value=$tmp+1}
{/foreach}
</tr></table>
{/if}
__________________________________________________ ____

jrmpling 07-06-2007 06:30 PM

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

Originally Posted by hhiker
I have read through this thread & am a bit confused as to what code I need to use to get the sub-category thumbs to show up. I tried a few different things that were shown here but could not get it to function properly so I restored the original subcategories.tpl file to our site.

Can someone post the latest, functional code again please?


the post on page 14 works (mrkenzie's, post #137 from the link above) for 4.1.8. tested. you just need to save your category icons to the filesystem and not the database. i have yet to see a working code for calling images from the database.

you can set where the images are saved thru the images location in your x-cart admin page. hope that helps.

i seem to be having an issue with the descriptions though. if i use the wysiwyg mode to type in the description it shows the html tags when you hover over the subcat title. has anyone been able to make it work with wysiwyg mode without showing the html tags?

hhiker 07-08-2007 05:38 PM

Re: Mod for subcategories in columns with descriptions and icons
 
I actually got it working some time last week. I just have been so busy with modifying the cart & other things at work I did not get back here to post.

Thanks for the help!

DavyMac 07-30-2007 05:37 AM

Re: Mod for subcategories in columns with descriptions and icons
 
I've implemented the code listed on page 14 of this thread and found it to be straight forward to get working. I have, however, noticed that the subcategory description alongside the image is a link (good) with the alt tag being the sub category description (also good) except it displays the <h1> and <\h1> header tags.

Can anyone point me towards where the subcategory description header is formed so that I can use it before the <h1> tags are added? ...or does anyone know how to strip leading/trailing characters from strings?

DavyMac 07-31-2007 01:59 AM

Re: Mod for subcategories in columns with descriptions and icons
 
As has been the case with all my posts I shall now answer my own question:

To remove the header 1 tags from the title of the subcategory links using the code on page 14 I have used the strip_tags variable modifier as follows:

Code:


<td class="ColumnTitles" valign="top"><a title="{$subcat.description|strip_tags:false}" href="home.php?cat={ $subcat.categoryid }"><img src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_web_dir}/default_image.gif{/if}" alt="{$subcat.category|escape}" /><BR />
 <font class="ItemsList">{ $subcat.category|escape}:</font></a>


I just love it when code does what you want it to!

Glowinafuse 08-04-2007 01:08 PM

Re: Mod for subcategories in columns with descriptions and icons
 
How do I get the code below for message 182 to be centered under image?

Please help

Jason

Quote:

Originally Posted by karentown
OK, all done and working now on version 4.0.19 as seen here:

http://www.partypresence.co.uk/store/home.php?cat=248

The subcategories code is:

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


Hope that helps someone! Thanks so much for the emails Robbert .... couldnt have done it without you!!!!


ptcsstore 08-22-2007 11:37 AM

Re: Mod for subcategories in columns with descriptions and icons
 
I have tried the code from post 137 and I see no difference. What could I be doing wrong?

I have ver 4.1.8. I made the changes to skin1.css, include/categories.php, and skin1/customer/main/subcategories.tpl. Uploaded the files, refreshed my frontpage of the store and no changes....

Thanks for the help.

TL408 08-31-2007 12:36 PM

Re: Mod for subcategories in columns with descriptions and icons
 
I can't believe it that X-Cart still hasn't fix this "problem" since several release ago.

If someone from Xcart reading this, PLEASE consider getting this added as an option on the next release!!!

MoonDog 09-02-2007 06:06 PM

Re: Mod for subcategories in columns with descriptions and icons
 
2 Attachment(s)
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 -

katandmouse 09-04-2007 12:06 AM

Re: Mod for subcategories in columns with descriptions and icons
 
Anyway to get this to work if the images are in the database?

didn't mean to do that, but had to set it that way to install on this server and forgot to set it back to file system.

balinor 09-04-2007 04:24 AM

Re: Mod for subcategories in columns with descriptions and icons
 
Move them back to FileSystem...never should run images from the DB.

katandmouse 09-04-2007 07:53 AM

Re: Mod for subcategories in columns with descriptions and icons
 
Thanks,
Can I change now or will I have to re-enter all the images for the products?

balinor 09-04-2007 08:06 AM

Re: Mod for subcategories in columns with descriptions and icons
 
http://forum.x-cart.com/showthread.php?t=8438

vahidnia 09-16-2007 12:19 AM

Re: Mod for subcategories in columns with descriptions and icons
 
Jason,
Did you ever find out how to center the text under the image in subcategories?
Thanks,
Vahid

Quote:

Originally Posted by Glowinafuse
How do I get the code below for message 182 to be centered under image?

Please help

Jason


vahidnia 09-16-2007 12:22 AM

Re: Mod for subcategories in columns with descriptions and icons
 
MoonDog,
You have done an excellent job on this! I have done every thing correct and got the subcategories aligned with picture and text. all great. The only problem I have is that I can’t get the text under the picture in the center. It is on the bottom left side of the image. Any advise.

Sorry to have to bother you, I read a lot on the forum with no success.
Thanks,
V

MoonDog 09-16-2007 08:38 AM

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

Make sure that you have added the following code to your skin1/skin1.css correctly. This is the code that sets your icon and text alignment to center.


Code:

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



That's it. Hope this helps.

- MoonDog -

vahidnia 09-16-2007 01:10 PM

Re: Mod for subcategories in columns with descriptions and icons
 
Apparently, my skin1.css file has no control over subcategort text format and size! . I got rid of this code all together and the text still showed up at the bottom left. I deleted skin1.css in skin1/ directory but again nothing happened. It seems to me that subcategory text gets its format and size from somewhere else! is it possible?
By the way, I am using fancy category mod, does that has anything to do with this?

MoonDog 09-16-2007 02:40 PM

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

Yeah, that seems pretty strange.

O.K. let's see, you deleted the .ColumnTitles class and it still does the same thing. Did you check to see that there is only one instance of .ColumnTitles in your skin1.css file. If you have two .ColumnTitles classes, then the last one will overide the first one. But if you do have two of them, just delete one of the two.

Now, if there is nothing wrong with your skin1.css file, then go back to the modified skin1/customer/main/subcategories.tpl file and open that up.

When your icon gets placed on your page it gets center aligned and then it sees a break tag and then it places the category name text centered on the next line. So if you don't have a <br> tag, then when the text is too long, it goes to the next line, but it continues from the left side instead of the center.

So what you need to do is find this line of code:
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>
and make sure that you have a <br> tag at the end of this line of code.

Hopefully one of the two will fix it. As far as the fancy category mod, I don't really know what that is. I just bought this x-cart software last month and I'm just playing around with it right now. But I don't think that mod should affect it. But if those two suggestions doesn't work, then I guess maybe it could.

Well, that's it. Good luck.

- MoonDog -

vahidnia 09-16-2007 04:33 PM

Re: Mod for subcategories in columns with descriptions and icons
 
I checked both. there is only one ColumnTitles in skin1.css file (at the end of the page) and <br> tag was already there.
If i could find how i could change the text size of the subcategories i would have been able to fighure that out. Any advise on that?
Thanks for your time,
V

MoonDog 09-16-2007 08:09 PM

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

Search for this code in the skin1/skin1.css file.
This is what your looking for to change the font styles of the subcategories.
Code:


/*
 Items style
*/
.ItemsList {
 COLOR: #003834;
 FONT-WEIGHT: bold;
}
.ItemsListDisabled {
 COLOR: #909090;
}
A.ItemsList:link {
 COLOR: #330000;
 TEXT-DECORATION: none;
}
A.ItemsList:visited {
 COLOR: #330000;
 TEXT-DECORATION: none;
}
A.ItemsList:hover {
 COLOR: #330000;
 TEXT-DECORATION: underline;
}
A.ItemsList:active {
 COLOR: #330000;
 TEXT-DECORATION: none;
}

Since the font size is inherited, and you want a different size font. Then all you do is just insert the font size you want into the .ItemsList class.
Example: you want to change to font size to 16 px. All you do is insert this code:

Code:

FONT-SIZE: 16px;

into the .ItemsList class above. So that your code will now look like this:
Code:


.ItemsList {
 COLOR: #003834;
 FONT-SIZE: 16px;
 FONT-WEIGHT: bold;
}


And that's it.

- MoonDog -

vahidnia 09-16-2007 10:09 PM

Re: Mod for subcategories in columns with descriptions and icons
 
I told you my skin1.css file has no control over anything! It was skin1_c.css! can you believe that! :D/
Thanks for your help MoonDog!

alreadyregistered 10-08-2007 10:38 AM

SOLUTION: Centering subcat name under photo || Mod for subcategories in columns
 
DIV is block-level. text-align does not center a DIV. The correct way to horizontally center a DIV is to use "auto" attribute, like so:
margin:0 auto 0 auto.

Tested. This will get you what you want:

.ColumnTitles {
TEXT-ALIGN: center;
WIDTH: 33%
PADDING-LEFT: 5px;
margin:0 auto 0 auto;
}

alreadyregistered 10-08-2007 10:44 AM

Re: Mod for subcategories in columns with descriptions and icons
 
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?

miami.mom 10-18-2007 11:10 AM

Re: Mod for subcategories in columns with descriptions and icons
 
Moon Dog (and 27stars and mrkenzie) - thank you so much!!! Your instructions were simple, easy and worked perfectly!!! I really appreciate you taking the time to share this mod!

simplyvacuums 10-23-2007 07:35 AM

Re: Mod for subcategories in columns with descriptions and icons
 
I cant get the images to show up. I have category icons, and detailed product images set to file system and product thumnails set to db and I think thats my problem. When I try to chang it, file system is in red lettering and I get this

Images transferring log ************************************************** ********************

LOG CREATED: 2007-10-16 19:31:16
Category icons
Location: FS

no images are found
Product thumbnails
Location: FS


Product detail images
Location: FS

no images are found

************************************************** ********************

LOG CREATED: 2007-10-23 11:28:32
Product thumbnails
Location: FS

aerogear2000 11-06-2007 02:02 AM

Re: Mod for subcategories in columns with descriptions and icons
 
thanks for the Mod, but my text will not center also

MoonDog 11-06-2007 09:26 PM

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

Post #218 describes what you need to do in order to center the text. The code should be placed in your skin1.css file. And if that doesn't work, then check to see what css file you are using and place that code into the css file that you are using. If you have a skin1_c.css file then add it to the bottom of that file. This should take care of the problem.

- MoonDog -

Bryan Crenshaw 11-07-2007 01:05 AM

Re: Mod for subcategories in columns with descriptions and icons
 
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?
__________________
XCart Gold 4.1.3
Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12 OpenSSL/0.9.6b PHP/5.0.3 mod_perl/1.27
Reply With Quote
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''

Same problem here. Any suggestions?

Bryan

aerogear2000 11-08-2007 01:54 AM

Re: Mod for subcategories in columns with descriptions and icons
 
thanks mod work great

northstar 11-16-2007 04:46 PM

Re: Mod for subcategories in columns with descriptions and icons
 
Mod is great! Works in 4.1.5, too! :) Thanks!

JJO 12-02-2007 07:53 AM

Re: Mod for subcategories in columns with descriptions and icons
 
Thanks very much for this great mod, I am new to X-Cart and got it working in a couple of minutes!

Only thing that took some time was aligning text and thumbnails correctly.
I read that more people were encountering this problem, the solutution for me was very simple.

When you place the new code in skin1.css be sure to place an enter (blank line) above the /*

Kind regards,
JJ

cutterc 12-06-2007 12:01 PM

Re: Mod for subcategories in columns with descriptions and icons
 
This is an awsome mod...works perfect in 4.1.9 that is modified quite a bit....super job...

aerogear2000 12-18-2007 10:44 PM

Re: Mod for subcategories in columns with descriptions and icons
 
any one know how to fix this problem, here is a picture


http://www.eracingworks.com/stuff.JPG

aerogear2000 12-18-2007 10:57 PM

Re: Mod for subcategories in columns with descriptions and icons
 
any pictures we enter in the sub catagories will appear also

rashriaz 12-24-2007 05:43 AM

Re: Mod for subcategories in columns with descriptions and icons
 
did you find a solution to this as I am having the same issue.

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?


MMB 12-31-2007 06:18 PM

Re: Mod for subcategories in columns with descriptions and icons
 
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 -



Version 4.1.9 WORKS PERFECT THANKS MOON DOG




!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!WOOOOO HOOOOOOO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!

Acquamarina 12-31-2007 07:35 PM

Re: Mod for subcategories in columns with descriptions and icons
 
Moon Dog,

It works great except I get a dotted line around each item. Any way to change that?

Thanks! Happy 2008!

MoonDog 12-31-2007 09:08 PM

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

I was a little confused here, but I think you were referring to another post which is the 3 column layout with thumbnail for Related Products where I posted a modified related_products.tpl file.
I've added to that post as to how to change the dashed border around the products. Just click on the link above and it should take you there.

- MoonDog -


All times are GMT -8. The time now is 07:22 PM.

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