Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Sort Order for menu. please help

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-10-2006, 10:57 AM
 
kostia kostia is offline
 

Member
  
Join Date: Nov 2005
Posts: 15
 

Default Sort Order for menu. please help

Recently I've found mod in this forum for showing categories and subcategories sorted - /customer/categories.tpl
works fine but sorting order for categories doesn't match the one in admin. anyone can suggest why this happens?

Code:
{* $Id: categories.tpl,v 1.23 2004/06/24 09:53:29 max Exp $ *} {capture name=menu} {if $active_modules.Fancy_Categories ne ""} {include file="`$fancycategories_config.modules_path`/fancy_categories.tpl"} {else} {if $config.General.root_categories eq "Y"} {section name=cat_num loop=$categories} {* Determine if this category has a subcategory *} {section name=subcat loop=$allcategories} {if $allcategories[subcat].parentid eq $categories[cat_num].categoryid} {assign var="subs" value="yes"} {/if} {/section} {if $subs ne 'yes'} {* This category has no subcategories, so display the category name with a link *} {if $cat eq $categories[cat_num].categoryid || $current_category.parentid eq $categories[cat_num].categoryid} {$categories[cat_num].category} {else} {$categories[cat_num].category} {/if} {else} {* This category has subcategories, so display the category name without a link *} {if $cat eq $categories[cat_num].categoryid || $current_category.parentid eq $categories[cat_num].categoryid} {$categories[cat_num].category} {else} {$categories[cat_num].category} {/if} {/if} {* Display the subcategories *} {section name=subcat loop=$allcategories} {if $allcategories[subcat].parentid eq $categories[cat_num].categoryid}&rsaquo;{if $cat eq $allcategories[subcat].categoryid}{/if}{$allcategories[subcat].category}{if $cat eq $allcategories[subcat].categoryid}{/if} {/if} {/section} {* reset the subcategory switch *} {assign var="subs" value="no"} {/section} {else} {section name=cat_num loop=$subcategories} <FONT class="CategoriesList">{$subcategories[cat_num].category}</FONT> {/section} {/if} {/if} {/capture} { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu } { $subcat.category|escape }
__________________
Xcart 4.0.17 GOLD
Reply With Quote
  #2  
Old 01-10-2006, 12:38 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

http://forum.x-cart.com/viewtopic.php?t=1695
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 01-11-2006, 12:58 AM
 
kostia kostia is offline
 

Member
  
Join Date: Nov 2005
Posts: 15
 

Default

Quote:
Originally Posted by balinor
http://forum.x-cart.com/viewtopic.php?t=1695

this topic is for old x-cart and the posts are also old. I need the info for 4.0.17 please
__________________
Xcart 4.0.17 GOLD
Reply With Quote
  #4  
Old 01-11-2006, 03:19 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

It still applies.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 01-11-2006, 03:21 AM
 
kostia kostia is offline
 

Member
  
Join Date: Nov 2005
Posts: 15
 

Default

Quote:
Originally Posted by balinor
It still applies.

There is no code like that. please check and you will ensure.
__________________
Xcart 4.0.17 GOLD
Reply With Quote
  #6  
Old 01-11-2006, 03:23 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Of course it is not exact, I mean the concept still applies. Look at the code in include/categories.php and you will see the orderby option.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #7  
Old 01-11-2006, 03:26 AM
 
kostia kostia is offline
 

Member
  
Join Date: Nov 2005
Posts: 15
 

Default

Quote:
Originally Posted by balinor
Of course it is not exact, I mean the concept still applies. Look at the code in include/categories.php and you will see the orderby option.

As I asked I'm newbie, I don't know how to edit that's why I ask for help
please.
__________________
Xcart 4.0.17 GOLD
Reply With Quote
  #8  
Old 03-15-2006, 01:35 PM
 
garryhs garryhs is offline
 

Senior Member
  
Join Date: Sep 2002
Location: Australia
Posts: 159
 

Default Category Sort Order

Why do X-CART do this ?

The Answer is: I do not know, perhaps a bug.

I have not looked at issues relating to making this change, the the reason the categories are in alphabetical order or the order that you enetred them into the admin section is that they are doing a usort on the category path.

Again, I am just quickly looking at a site for a client and found this thread and issue as my client has the same problem.

For anybody with this problem, try and comment out the following line from your /include/categories.php in 4.0.17

Change:

usort($all_categories, "func_categories_sort");

To:

//usort($all_categories, "func_categories_sort");

Somebody else who has looked at this, may explain why xcart is doing this, but I have no time, as we are very busy at present.

X-CART may want to look at this, as it seems that the order_by column is useless.
__________________
All versions of X-Cart

Been in eCommerce 10 years, Coding, PM, SEO, Social. X-Cart 11 years. IT 30+ years.

Head of Web Dev for Australia's largest eCommerce 2 years.

Attended conferences, Velocity 2009 US, CeBit 2009, MySQL 2010 US, Online Retailer 2010, Web 2.0 2011 US, MySQL 2012 US (Percona).

Specialise in High Performance, High Volume, PHP, MySQL, HTML, CSS, JAVASCRIPT, SMARTY, MEMCACHED, APACHE, LIGHTTPD, FREEBSD, LINUX.

Email your requests to xcart@gazwebtech.com
Reply With Quote
  #9  
Old 06-21-2006, 02:22 PM
 
youngvet1 youngvet1 is offline
 

eXpert
  
Join Date: Aug 2005
Posts: 245
 

Default

I have looked through the posts and I am still having trouble making just the subcategories be listed alphabetically.
I would really appreciate if someone could suggest what must be done to make the subcategories list alphabetically.
__________________
x-cart version 4.0.14
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

   

 
X-Cart forums © 2001-2020