![]() |
Subcategory images & text for Xcart 4.1.1
Is there a modified Subcategory.tpl mod for XCart 4.1.1 to display Category icons and text on main page they whould like to share?
Tom |
Anyone know the code to display icons from the file system vs. DB? All of the subcat icon posts relate to "{$xcart_web_dir}/icon.php?categoryid={$cat}" and not "{$current_category.icon_url}".
The latter doesn't work for pulling icons onto a subcategories page... anyone? - Mike |
Ummm...I just posted that 2 posts back ;)
|
Thanks P- One has to be thankful to a great forum moderator! Even when the answer was two posts away.
Your code should actually replace the original code as one should only pull image from the DB if they are storing them in there (like who would anyways?).... Thanks, mike.// |
So is this the code I need to run on 4.1.1 to give my subcategories images? Is this the code people have always used? Why isn't this built into X-Cart as an option.. because if it is I can't find it anywhere.
|
Not sure if this will work on 4.1...
|
Quote:
is this how everyone HAS been doing it with previous versions on X-Cart? |
Yep
|
I got this to work for 4.1 with the foreach tag, but has anyone been able to transfer that to a section and loop X columns like this mod in 4.1?
Note to XC Team: This is something that should definitely be in X-Cart. There is no reason why people want a list of catageories without the ability the have the loaded icons display and loop. - Mike |
Does anyone have the updated code to show subcategory images in 4.1 yet?
All features that worked in previous versions would be nice, but at this point I am just looking to display the subcategory icon next to its existing name. It seems a few people are also looking for this on different threads, but no answers have been posted. Mike had mentioned he got this to work using the foreach tag, but I haven't been able to find any information on this either. Any help would be appreciated. |
This works for me to get multiple row categories with icons in 4.1.1. My use doesn't need text or descriptions, so you'll have to add that back if you do. Still needs some cleaning up, but it works. This is just a snip from the template.
Code:
{if $subcategories} |
Close, but use the file system for the cat. images. The code needs to be reworked using sections to allow for multiple columns (am trying it now), but here's your previous code with names and content and using the file system. I have left your database image call to see what was coded out...
Code:
{if $subcategories} |
This is a great mod! I've got an idea for an addition and two questions:
First, I've made the Icon/Category one link, instead of two on top of each other... no big deal. I've also added a title tag to the link, though, so when someone hovers, there can be text... this seems like it should be good for adding keyword density to the link. The problem is, I can't find the smarty tag for the category description, which is, in my opinion, highly appropriate for the title tag. If you can tell me the tag, I'd be very grateful. Second, when a category has no products, there is nothing beneath the Category name. Is there a way for it to say "0 Items" instead of it being blank? Here's my subcategories.tpl: Code:
{* $Id: subcategories.tpl,v 1.43.2.2 2004/10/07 07:08:51 max Exp $ *} Jeremy |
Oh, does anyone know what tag to add so (0 Items) appears when there are no items in a subcategory? Right now, (# Items) only shows up if the subcategory actually has items available.
Thanks, Jeremy |
Code Modified for use with DSEFU
Hey guys, I just got the code working with DSEFU's , v 4.0.17 Pro and figured it would be of use here since both seem to be a popular mod and I had seen at least one request in this thread.
Notes: * This is the entire code for subcatecories.tpl * Modified per Balinor's post on page 8 to use file system for images instead of a call to the database * This code uses 4 columns. You have to set n in "div by n" to the (number of columns + 1). I also changed the width of the table to work with four columns, thus the "25%". Just change that value to the appropriate number for your number of columns (33% for 3, 20% for 5, etc). * I used an image height of 50, so you may need to change that to your needs as well. Thanks for this mod, it's definitely a good one. And thanks for this forum in general. I've found lots of good stuff here and figured I'd give something back with this post. Code:
{* $Id: subcategories.tpl,v 1.43.2.2 2004/10/07 07:08:51 max Exp $ *} |
Quote:
Did you ever make any progress on this? Thanks |
This is the code that I have and works with 4.1.0. I have added several things to this modification. Not only will it display the categories in columns, it will:
1. display the default "No Image Avail." image if one is not assigned 2. display "0 Products" if there are no subcategories or products for a particular category. 3. it will show the subcategory DESCRIPTION if there is one when you hover over the subcategory link. Take it, use it, modify it. Good luck! Here is what you add to the Skin1.css Code:
.ColumnTitles { padding-left: 5px; text-align: center; width: 33%; } Find this in 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); Here is the code that I changed in subcategories.tpl: Code:
{if $subcategories} By Default, it shows 3 columns. 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): Code:
{if $tmp is div by 3} Code:
.ColumnTitles { padding-left: 5px; text-align: center; width: 33%; } I added a blank row between each row of subcategories, just to seperate the rows a little so it does not look so crowded. Let me know if there are any problems. |
Excellent! Works fine in 4.1.2!
Thank you, Louise |
Right on, I've been waiting a while for someone to get the right code, thanks a lot Mike, it works great on 4.1.2 :)
|
Thanks Mike. Works beautifully and a great sign that the forum will commence it's move to supprting 4.1.x users....
- Mike |
Is there any way to get this to work in 4.0.x?
|
Please look at page 3 of this same thread, about half-way down.
Quote:
|
Quote:
|
Good mod is coming out for 4.1.2! Thanks a lot for sharing!
|
Excellent
Thank you for this code. I think this will help a lot of people as they start upgrading to the new version of X-Cart.
|
Well done Mrkenzie! I have no idea why this is not an option in Xcart to begin with!
The only thing that the user will have to be careful of (or at least that I've noticed) is to make sure to resize your images used for the subcats to be all of the same size to keep uniformity, but such a small price to pay for having this! Also, you might add the directories to find the file to change- I was able to find them using dreamweaver to locate the text to be changed- Something that might help the not-so fluent savy xcart users. *raises hand** Once again, thank you for taking the time to come up with this mod, and most of all sharing it with the rest of us! |
Multi column and thumbnails in subcat ver 4.1
Has anyone got this to work with version 4.
here is my code but I cant get the columns. Code:
{if $subcategories} |
I see your using 4.0.12, the mode on forum page 10 is for ver 4.1+
Try backing up to page 7 or 8 But if you do have ver 4.1+ I'm working on that my self. Tom |
I am on 4.1 my other carts are old. My code works just need the column feature. I also want to add columns in products.tpl do you know where that link is? pm me and lets try to solve this. thanks.
|
Thanks Got it to work using mrkenzie code dont know where cat.php is, but it still works.
|
Re: Mod for subcategories in columns with descriptions and icons
Quote:
Where do i find categories.php....so i can change the code. I didn't see skin.css anywhere..i only saw skin1.css. Are they the same? |
Re: Mod for subcategories in columns with descriptions and icons
Categories.php is in the include folder.
You are right, it is skin1.css. |
Re: Mod for subcategories in columns with descriptions and icons
This is not working for me...this is what i'm getting....http://www.tolbert-pkg.com/store/home.php?cat=8
Can u please tell me what i'm doing wrong |
Re: Mod for subcategories in columns with descriptions and icons
In subcategories.tpl:
This line: Code:
<td class="ColumnTitles" valign="top"><a title="{$subcat.description}" href="home.php?cat={ $subcat.categoryid }">[img]{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_web_dir}/default_image.gif{/if}[/img] should be Code:
<td class="ColumnTitles" valign="top"><a title="{$subcat.description}" href="home.php?cat={ $subcat.categoryid }">{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_web_dir}/default_image.gif{/if} I am not sure how the [image] tag got in there, maybe when they updated the forum, |
Re: Mod for subcategories in columns with descriptions and icons
I have replaced the line and there is no change. What else to do?
|
Re: Mod for subcategories in columns with descriptions and icons
My bad -
This is what you should replace it with: Code:
<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="" />{/if} See if that works. |
Re: Mod for subcategories in columns with descriptions and icons
i am getting this on the site....Fatal error: Smarty error: [in customer/main/subcategories.tpl line 29]: syntax error: mismatched tag {/if}. expected {/foreach} (opened line 19). (Smarty_Compiler.class.php, line 2286) in /home/hosts/tolbert-pkg.com/public_html/store/Smarty-2.6.12/Smarty.class.php on line 1095
|
Re: Mod for subcategories in columns with descriptions and icons
Remove the last {/if}
I am not sure if you have the {/if} on the next line or not. |
Re: Mod for subcategories in columns with descriptions and icons
It worked. Thanks you very good.
How can i get the category name under the image?....not to the bottom right of the image |
Re: Mod for subcategories in columns with descriptions and icons
I have implemented this mod for x-cart 4.1.2, but for some reason thumbnails are not being displayed. You can visit my site at http://www.dreamindiamonds.com/store/home.php?cat=253 OR view an example below.
http://www.dreamindiamonds.com/ex.jpg |
All times are GMT -8. The time now is 04:39 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.