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)

brett 11-23-2004 01:03 PM

thanks works great in 4.07 too

rapsearch 12-08-2004 04:43 AM

This is working great :)

I do got a request though. Is it possible to have a category display more columns?

I want all categories at 2 columns what this code does great but one needs to be at 4 or it will get way to long.


is this possible?

nfc5382 12-08-2004 05:48 AM

any differences for 3.5.x branch?

adpboss 12-08-2004 05:54 AM

You should be able to use the 3.4 code and just watch the Smarty tags for database items to make sure the verbage isn't different. It shouldn't be because 3.5 is really just an extension of 3.3, 3.4

rapsearch 12-09-2004 01:31 PM

I use the code from "grimscot" given above.

Is it possible to shorten the amount of subcategories displayed? I have for example over 50 subcategories in one section. I get a huge list now and people have to scroll down a lot.

Can i get more columns so people don't have to scroll down so much? 3 or 4 for example?

adpboss 12-09-2004 01:57 PM

Change this I believe

Code:

{if %cat_num.index% is div by 2}

Dmitri 12-13-2004 02:27 AM

category description
 
now that wouldn't display description for each subcategory, would it?
It didn't in my 4.0.8...

Alhtough I clearly see: { $subcategories[cat_num].description|escape }
but it returns nothing...

any ideas?

Thanks!

GM 12-14-2004 10:25 PM

MOST EXCELLENT! :wink:

rapsearch 12-15-2004 03:16 AM

Changing that works... but how can i set x amount od columns for a specific subcategory?? I want one section to be 3 columns and my others must be 2.

Chris B 12-15-2004 01:10 PM

display only 10 per page
 
Since we have so many sub categories, is there a method to display only 10 on a page and then have a "next" and "previous" button?

Thank you,
Chris

adpboss 12-15-2004 01:14 PM

There is probably a way BUT it will affect how your webpages get crawled by the search engines. Surely there is a nice way to organise them rather than bogging down the navigation with multiple pages...

QVS 12-16-2004 04:27 AM

nice one, cheers for the mod.....exactly what i was looking for.

QVS 12-17-2004 04:18 AM

anyone know why the catagorys in columns 2,3,4 shift to the right?

any help would be great.

example: http://www.qvsdiscountelectrical.co.uk/qvsshop/home.php?cat=249

subcatagories.tpl

Code:

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

{section name=cat_num loop=$subcategories}
{ if %cat_num.first% }
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
<script language="JavaScript">
<!-- Hide script from older browsers
document.write('<P ALIGN="CENTER">')
document.write("<FORM>")
document.write('<INPUT TYPE = "BUTTON" VALUE = "<-- Go Back" onClick="window.history.go(-1);">')
document.write("</FORM>")
document.write("</P>")
//-->
</script> 
{/if}
{ if %cat_num.index% is div by 4}
<tr>
{/if}
<td align="center" valign="top">

{ $subcategories[cat_num].description|escape }
{if $config.Appearance.count_products eq "Y"}
{if $subcategories[cat_num].product_count}
 
({ $subcategories[cat_num].product_count } Products)
{elseif $subcategories[cat_num].subcategory_count}
({ $subcategories[cat_num].subcategory_count } Subcategories)
{/if}
{/if}

<a href="home.php?cat={ $subcategories[cat_num].categoryid }">
[img]{$xcart_web_dir}/icon.php?categoryid={$subcategories[cat_num].categoryid}[/img]</a>


 
<a href="home.php?cat={ $subcategories[cat_num].categoryid }">
<font size="1">{ $subcategories[cat_num].category|escape }</font></a>



 
</td>
{ if %cat_num.last% }
</tr>
</table>
{/if}
{/section}

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


Chris B 12-17-2004 07:21 AM

By default, the x-cart templates expand to the full size of your computer display settings. Therefore the table in which the categories are displayed expands to fit as well, leaving a lot of space between your category images.

In order to maintain consistent size viewable on most system settings, we generally set the width of the entire site to 760 pixels. This will allow you to left justify or center your cart also.

For example: http://www.uneedabirkenstock.com
This site is left justified as well as using the 3 column category layout.

To do this, modify the rectangle_top.tpl

from this:

Code:

<TABLE align=center border=0 cellPadding=0 cellSpacing=0 width="100%" height="100%">

to this:

Code:

<TABLE align=center border=0 bgcolor="#FFFFFF" cellPadding=0 cellSpacing=0 width="760" bordercolor="#000000">

Depending on which version you are using there may be 2 instances of this table. (One for the customer end, and one for the administration section.)

I hope this helps...

pcdoktorn 12-26-2004 04:41 AM

Tried this in 4.0.9 and did paste in the code that was made for 4.0.8 and nothing changed at all on the page.Was there updates in categories.tpl that prevents this mod from working in 4.0.9 ?

pcdoktorn 12-26-2004 04:46 AM

Please ignore my stupidity.
Did not know I had to change the welcome.tpl file.Works fine now :)

rjcbear 12-31-2004 07:37 AM

Hello guy,

I amd kind of confused now! amd her eis ther reason why.

I implemented this mod and is working properly displaying the Icon when the cart is in the dynamic part. whent the HTML catalog is created is displaying a broken link to the images.

I my case I move all the images and icons out of the DB and place the proper code on the .htaccess file so images and Icons will display properly.

I guess I am sure where the images should be place for the HTML to display it. below is the code

Code:

<td align="center" valign="top"> <a href="LADS_Competition_Latin-p-1-c-278.html">
                              [img]../icon.php?categoryid=278[/img]
                             


if you like to see what is doing here is the link

http://www.ballroomdancingshoe.com/LADS_Competition-p-1-c-276.html

thank you in advance.

HAPPY NEW YEAR!!!!

Kind regards
Ricky

adpboss 12-31-2004 10:04 AM

RJC, I cannot understand your last post at all... :roll:

rjcbear 12-31-2004 10:47 AM

What I am trying to say is the HTML catalog is not displaying the icons at all for the subcategories. The Dynamic cart show the Icons for the subcategories.

Look at the links and see.

http://www.ballroomdancingshoe.com/LADS_Competition-p-1-c-276.html

The above show the broken links.

http://www.ballroomdancingshoe.com/store/customer/home.php?cat=276

The above link shoes the Icons.

is that better?

Kind regards,
Ricky

adpboss 12-31-2004 11:06 AM

Yup, got it now. LOL. The spelling and grammar was a little rough in the other post, I was getting confused. :?

Something is definitely wrong as I have this working on a 3.5 development no problem. The html cat pages should not be outputting icon.php but creating the actual http location of the images stored on your server.

These are just a couple of shot-in-the-dark ideas to check.

html_catalog.php, check the script array against the latest distribution (note i have included my code from an older version it could be different in the latest distro)
Code:

$php_scripts = array("search.php","giftcert.php","help.php", "cart.php", "product.php","register.php", "home.php", "pages.php", "pconf.php", "giftregs.php");

Check that your images location is set correctly in the database. Image-path in xcart-icons table. I have had a lot of troubles setting this properly.

Nice 404 page btw. :D

Good luck.

rjcbear 01-01-2005 06:39 AM

Adpboss

Thank you for your help. I went and look at my html_catalog.php and here is the line from my php.

Code:

$php_scripts = array("search.php","giftcert.php","help.php", "cart.php", "product.php","register.php", "home.php", "pages.php", "pconf.php", "icon.php");


I went I look at the subcategories.tpl and I think the line of code below is the one that is producing the broken links and I do not know how to fix it.

Code:

[img]../icon.php?categoryid={$subcategories[cat_num].categoryid}[/img]

My Icons are in the File System and in that folder I have the .htaccess file with "Access from all"

THank you for the kuddos on the 404 page.

Thank you for all your help


Kind regards,
Ricky

adpboss 01-01-2005 07:57 AM

http://www.ballroomdancingshoe.com/store/icon.php?categoryid=277

on php page

http://www.ballroomdancingshoe.com/icon.php?categoryid=277

on html page

see the problem?

How did you generate this catalog in the site root?

hooter 01-01-2005 10:43 AM

Quote:

Originally Posted by rjcbear
My Icons are in the File System and in that folder I have the .htaccess file with "Access from all"


Not sure if this is related but your .htaccess file should read:
Allow from All

rjcbear 01-01-2005 03:19 PM

Adpboss,

I see the difference now between them. I guess I will have to find a way to put an IF stament in the tpl so It will get executed only for the html_catalog.php to correct that little problem.

Quote:

How did you generate this catalog in the site root?

Yes the catalog is generated in the root of my syte.

Thank you Adpboos for all your help.

Quote:

Not sure if this is related but your .htaccess file should read:
Allow from All

Sorry my mistake the line in my .htacess is "Allow" not "Access"


Kind regards,
Ricky

Chris B 01-03-2005 09:13 AM

category pagination
 
Since we have so many sub categories, is there a method to display only 10 on a page and then have a "next" and "previous" button?

I'm still stuck with this issue using this modification... Any Ideas?

johnwhdavies 01-10-2005 04:15 PM

Quick Question
 
Great Stuff by the way!!!

My Question is, How can I get it to display without all the images and just like this, http://www.gamehead.com.au/home.php?cat=260

Thanks

John

Chris B 01-10-2005 07:44 PM

To eliminate the image, change the following code:


Code:


<a href="home.php?cat={ $subcategories[cat_num].categoryid }">
[img]{$xcart_web_dir}/icon.php?categoryid={$subcategories[cat_num].categoryid}[/img]</a>



to

Code:

[img]{$ImagesDir}/spacer.gif[/img]

This will keep a 100 pixel clear image within the <td> </td>and keep a consistant format.

zilker 01-13-2005 03:16 PM

I tried using the mod that grimsot posted on page 3 but I'm not having any luck. I have 4.0.6 installed on this site.

Here is my subcategories.tpl code:

Code:

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

{section name=cat_num loop=$subcategories}
{ if %cat_num.first% }
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
{/if}
{ if %cat_num.index% is div by 2}
<tr>
{/if}
<td align="center" valign="top">
<a href="home.php?cat={ $subcategories[cat_num].categoryid }">
[img]{$xcart_web_dir}/icon.php?categoryid={$subcategories[cat_num].categoryid}[/img]</a>

 
<a href="home.php?cat={ $subcategories[cat_num].categoryid }">
<font size="3">{ $subcategories[cat_num].category|escape }</font></a>



 
{ $subcategories[cat_num].description|escape }
{if $config.Appearance.count_products eq "Y"}
{if $subcategories[cat_num].product_count}
 
({ $subcategories[cat_num].product_count } Products)
{elseif $subcategories[cat_num].subcategory_count}
({ $subcategories[cat_num].subcategory_count } Subcategories)
{/if}
{/if}
</td>
{ if %cat_num.last% }
</tr>
</table>
{/if}
{/section}

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


Here is what it's outputting:

http://www.puttinggreensturf.com/home.php?cat=248

Does anyone know why it's not listing the description under the category name?

jkirkpatrick 01-21-2005 09:37 AM

Is it possible to modify the subcategories.tpl file to include a "blurb" at the top of each category page (mostly for Search Engine Optimization purposes)? And then underneath that is the subcategories displayed as has been discussed in this post.

The trick is to be able to have a different "blurb" at the top of each page...

My fingers are crossed that someone knows how to do this!

Jennifer

P.S. If you're not familiar with what a "blurb" is, all I mean is a paragraph of text.

balinor 02-08-2005 02:46 PM

You could fill in the category description on the edit categories page, and it will show up as that 'blurb' :)

weckie 02-15-2005 04:36 AM

very nice mod no pictures
 
hi,

i copied this into my xcart version 4.011

The mod seems to work but i dont see the icons.

example: www.weckonline.nl/xcart

Can anyone help me please, because i like this visual very much.

balinor 02-15-2005 06:16 AM

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?

weckie 02-15-2005 06:45 AM

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?


my icons are in the database, yep i can see the icons in my admin.

when i use an other subcategories.tpl it works fine. see it working on www.weckonline.nl/xcart.

Regards
Herman

alexming 02-17-2005 08:19 AM

Very nice.

Works perfectly with 4.0.11 Gold with images in the file system.

ian_fs 02-17-2005 09:55 AM

Weckie

I just looked at your website and it was the first time I have seen a Fashion Mosaic template used for real. It looks very nice and I like the colour scheme.

But my question is, I looked on the Register page that you have states for UK, Germany, France, USA etc. Now I know USA, Australia, UK and Canada have states supplied, but did you input the other states for other countries or is there a special list you got from somewhere?

As I would like to do a similiar thing for our new website, however I do not fancy spending how ever long typing each one in.

Cheers

Jez

weckie 02-17-2005 10:25 AM

hmmm

i got the states from this forum somewhere. but i forgot were.

I can always send you an sql dump from my database which has all the states.

Just let me know.

weckie 02-19-2005 04:02 AM

this on is for version 4.0.11
 
ok, i took an example from the forum, changed it to fit it into version 4.011, and it works fine. I also removed the hardcoded "Products" en replaced it with lbl_items so it will suite for every language.
For instance English=Item(s) German=Artikel Dutch=Artikel(en) etc.


Code:

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

{section name=cat_num loop=$subcategories}
{ if %cat_num.first% }
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
{/if}
{ if %cat_num.index% is div by 2}
<tr>
{/if}
<td align="center" valign="top">
<a href="home.php?cat={ $subcategories[cat_num].categoryid }">
[img]{$xcart_web_dir}/icon.php?categoryid={$subcategories[cat_num].categoryid}[/img]</a>

<a href="home.php?cat={ $subcategories[cat_num].categoryid }">
<font size="1">{ $subcategories[cat_num].category|escape }</font></a>
 
{ $subcategories[cat_num].description|escape }
{if $config.Appearance.count_products eq "Y"}
{if $subcategories[cat_num].product_count}
{ $subcategories[cat_num].product_count } {$lng.lbl_items}
{elseif $subcategories[cat_num].subcategory_count}
({ $subcategories[cat_num].subcategory_count } Subcategories)
{/if}
{/if}
</td>
{ if %cat_num.last% }
</tr>
</table>
{/if}
{/section}

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


Hope i can help people with this "modified"mod.

balinor 02-19-2005 05:19 AM

Modified your post using code tags, makes it much easier to read.

weckie 02-19-2005 06:46 AM

yeah i know,

But i don't know how to do that (i dont know what code tags really are.

ah wait something like this....

Code:

TES TEST TEST


Lets see, if this works i will use it next time...

balinor 02-19-2005 06:48 AM

There you go! :)


All times are GMT -8. The time now is 02:00 PM.

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