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)
-   -   Display Added Products in Cart, in Reverse -- one line code. (https://forum.x-cart.com/showthread.php?t=2394)

Alan 04-22-2003 01:05 AM

Display Added Products in Cart, in Reverse -- one line code.
 
Hello X-carters.
X-cart displays products added from top to bottom (oldest to newest),
Customers might find it irritating to scroll down your Cart page, to see if s/he added the products successfully.

A very simple 1 liner code to display them from Newest added to Oldest.

In your {x-cart-skin1-dir}/customers/main/cart.tpl locate line no.14:
Code:

{section name=product loop=$products}
Ammend this code to
Code:

{section name=product loop=$products start=-1 step=-1}

1. Start=-1 <=> Tells loop to start at the end of array
2. Step =-1 <=> loops backward 1 step at a time

Hope it helps some of you out.

magnumkp 04-22-2003 01:47 AM

I thought this was already a feature. In the General Settings there is:
"List products in reversed order" with a tick box. (I've got 3.3.4 IIRC) Dunno if this is what it does though. :?

Alan 04-22-2003 03:07 AM

Hello Magnumkp,

Actually this small tweak is for the pre-checkout cart page.

Customer JonDoe buys "some candles", the cart will show
---------------
Some Candles
---------------

He then add to cart "K-Y-Jelly", and then add to cart "Hand Cuffs".

The cart will now show
-----------------
Some Candles
K-Y-Jelly
Hand Cuffs
-----------------

JonDoe might get frustrated because he have to scroll down to see his newly added products. If we make the cart display products like
-----------------
Hand Cuffs
K-Y-Jelly
Some Candles
-----------------

It'd be more convenient for our customers, in my H. opinion

So JonDoe happily purchases his goods, and off he goes to do stuff that we won't disguss in this thread.

***Disclaimer*** GoodOrient does not in anyway, any circumstances, sell hand cuffs and K-Y-Jellies. However we do have some lovely candles if it fancies you. :wink:

bluecat 07-23-2005 04:18 AM

Works in 4.0.14, thanks.

nfc5382 02-04-2007 01:13 PM

Re: Display Added Products in Cart, in Reverse -- one line code.
 
nice, thanks!


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

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