X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   category sort listing issue (https://forum.x-cart.com/showthread.php?t=34822)

luxor 10-22-2007 08:13 PM

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}


Dongan 10-23-2007 04:07 AM

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.

alru111 11-12-2007 07:40 AM

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?

Dongan 11-12-2007 07:44 AM

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

alru111 11-12-2007 07:54 AM

Re: category sort listing issue
 
how do I change to descending direction? do you know?

Dongan 11-12-2007 08:09 AM

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.

glsp 09-07-2008 04:47 PM

Re: category sort listing issue
 
Brilliant! Thanks a million, Dongan!


All times are GMT -8. The time now is 10:54 PM.

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