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

category sort listing issue

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-22-2007, 08:13 PM
 
luxor luxor is offline
 

Senior Member
  
Join Date: Apr 2007
Posts: 120
 

Default category sort listing issue

Hi,

I have modified categories.tpl navigation in order to list top category, and subcat liek in example:

Main Cat A
A Sub Cat 1
A Sub Cat 2
A Sub Cat 3

The below code works great for this, but the only problem with this code is that it does not respect the sort order i have placed on the categories. I know that the functionality is working since it is listed in sorted order on the actual category page.

So if anyone can figure out how to have the below code respect the category sort order?


Code:
{{* $Id: categories.tpl,v 1.26 2005/11/17 06:55:37 max Exp $ *} {capture name=menu} {if $active_modules.Fancy_Categories ne ""} {include file="modules/Fancy_Categories/categories.tpl"} {assign var="fc_cellpadding" value="0"} {else} {if $config.General.root_categories eq "Y"} {foreach from=$categories item=c}<br /> {if $c.order_by < 500} <a href="home.php?cat={$c.categoryid}" class="rootcatlink"> {$c.category}</a><br> {/if} {foreach from=$allcategories item=cat} {if $cat.parentid eq $c.categoryid} {if $c.order_by < 500} <a href="home.php?cat={$cat.categoryid}" class="catlink">{$cat.category}</a><br> {/if} {/if} {/foreach}{/foreach} {/if} {/if} {/capture} {include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu cellpadding=$fc_cellpadding}
__________________
v4.1.8 GOLD
Reply With Quote
  #2  
Old 10-23-2007, 04:07 AM
  Dongan's Avatar 
Dongan Dongan is offline
 

X-Wizard
  
Join Date: Jul 2005
Location: www.mercuryminds.com
Posts: 1,531
 

Default Re: category sort listing issue

try commenting out include/categories.php

around line 171

uasort($all_categories, "func_categories_sort");

but, not sure this is what you are looking for. Try it, it not works, roll back it.
Reply With Quote
  #3  
Old 11-12-2007, 07:40 AM
 
alru111 alru111 is offline
 

eXpert
  
Join Date: Dec 2005
Posts: 244
 

Default Re: category sort listing issue

I had a similar issue, tried commenting it out and got a ascending list of categories. What does this function do? will it affect something else?
__________________
X-Cart version 4.0.19
Reply With Quote
  #4  
Old 11-12-2007, 07:44 AM
  Dongan's Avatar 
Dongan Dongan is offline
 

X-Wizard
  
Join Date: Jul 2005
Location: www.mercuryminds.com
Posts: 1,531
 

Default Re: category sort listing issue

Quote:
Originally Posted by alru111
I had a similar issue, tried commenting it out and got a ascending list of categories. What does this function do? will it affect something else?

It will not affect anything i believe
Reply With Quote
  #5  
Old 11-12-2007, 07:54 AM
 
alru111 alru111 is offline
 

eXpert
  
Join Date: Dec 2005
Posts: 244
 

Default Re: category sort listing issue

how do I change to descending direction? do you know?
__________________
X-Cart version 4.0.19
Reply With Quote
  #6  
Old 11-12-2007, 08:09 AM
  Dongan's Avatar 
Dongan Dongan is offline
 

X-Wizard
  
Join Date: Jul 2005
Location: www.mercuryminds.com
Posts: 1,531
 

Default Re: category sort listing issue

uasort() function sorts an array such that array indices maintain their correlation with the array elements they are associated with. This is used mainly when sorting associative arrays where the actual element order is significant.
Reply With Quote
  #7  
Old 09-07-2008, 04:47 PM
 
glsp glsp is offline
 

Member
  
Join Date: Dec 2007
Location: Northampton, MA
Posts: 27
 

Default Re: category sort listing issue

Brilliant! Thanks a million, Dongan!
__________________
X-Cart Gold version 4.1.9

PS: This is what part of the alphabet would look like if Q and R were eliminated.
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 08:03 PM.

   

 
X-Cart forums © 2001-2020