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

Order of items added to cart

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 02-21-2007, 08:13 AM
 
danbass danbass is offline
 

Member
  
Join Date: Mar 2005
Posts: 13
 

Default Order of items added to cart

When someone ads an item to the shopping cart is there anyway to have that item appear on the top of the list in the cart?

I am just thinking that when they add and item to the cart they will want to verify what they just added as being correct and if they have 20 items in their cart they are going to have to scroll all the way to the bottom to find the item they just added to verify it but if it appeared at the top it would be the first item they would see.
Thanks
__________________
Dan
XCart 4.1.6 Pro
XCart 4.1.6 Gold
Redhat 7.2
Perl 5.006001
PHP 4.1.2
Reply With Quote
  #2  
Old 02-26-2007, 06:35 PM
 
phpmattk phpmattk is offline
 

Advanced Member
  
Join Date: Jan 2007
Posts: 44
 

Default Re: Order of items added to cart

Interesting idea... this should work. In /include/cart_process.php in the func_add_to_cart function, around line 248 you can see where it tacks the latest addition on the end of an array, it looks like this:

$cart["products"][] = array( ... etc etc

Change $cart['products'][] to $temp_arr[]
then after the array is defined do this

array_unshift($cart['products'],$temp_arr);

I don't know if thats all you'd need to do, but it'd be a quick fix and worth a shot.
__________________
-matt
version 4.1.5
Reply With Quote
  #3  
Old 02-26-2007, 07:04 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: Order of items added to cart

all you need to do is edit cart.tpl and look for the section loop for the products and change the stepping to -1
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #4  
Old 02-27-2007, 10:50 AM
 
danbass danbass is offline
 

Member
  
Join Date: Mar 2005
Posts: 13
 

Default Re: Order of items added to cart

Looking in /customer/main/cart.tpl
I find this section:

{section name=product loop=$products}
{if $products[product].hidden eq ""}
<tr><td class="PListImgBox">
<a href="product.php?productid={$products[product].productid}">{if $products[product].is_pimage eq 'W' }{assign var="imageid" value=$products[product].variantid}{else}{assign var="imageid" value=$products[product].productid}{/if}{include file="product_thumbnail.tpl" productid=$imageid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].pimage_url type=$products[product].is_pimage}</a>

What do I change to -1?
__________________
Dan
XCart 4.1.6 Pro
XCart 4.1.6 Gold
Redhat 7.2
Perl 5.006001
PHP 4.1.2
Reply With Quote
  #5  
Old 02-27-2007, 11:58 AM
 
phpmattk phpmattk is offline
 

Advanced Member
  
Join Date: Jan 2007
Posts: 44
 

Default Re: Order of items added to cart

Yeah, i guess that would be easier, but you'll probably have to do this in more than one place (mini cart, etc).

{section name=product loop=$products step="-1"}
__________________
-matt
version 4.1.5
Reply With Quote
  #6  
Old 02-27-2007, 01:03 PM
 
danbass danbass is offline
 

Member
  
Join Date: Mar 2005
Posts: 13
 

Default Re: Order of items added to cart

Thanks it works perfectly!
__________________
Dan
XCart 4.1.6 Pro
XCart 4.1.6 Gold
Redhat 7.2
Perl 5.006001
PHP 4.1.2
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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:25 PM.

   

 
X-Cart forums © 2001-2020