[ic] item-list sort order

Ed LaFrance interchange-users@interchange.redhat.com
Fri Oct 5 12:17:59 2001


At 02:37 PM 10/05/2001 +0100, you wrote:
>Hi Folks,
>
>Could some please enlighten me as to how I would change the sort order for
>items in a basket so that the last item added to the basket appears at the
>top and not the bottom.
>
>Thanks
>
>Sheamus

Hmmm... I don't think there is an existing feature to do what you 
want.  You can (or could, but perhaps not now) use the [sort] tag in the 
item list to sort the line items, but only by the value of some related 
field in a table.

Here's a stupid hack that does the job, you should put it at the top of the 
ord/basket.html page, and any other page in which the cart cotents can be 
modified (like ord/checkout.html):

[calc]
         my $cart = $Carts->{main};
         if ($#{$cart} > 0 && $#{$cart} > $Scratch->{last_item_count}) {
                 unshift @{$cart}, (splice @{$cart}, $#{$cart}, 1);
         }
         $Scratch->{last_item_count} = $#{$cart};
[/calc]


- Ed L.


===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================