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

Auto update Qty in View Cart

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 02-28-2003, 05:25 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default Auto update Qty in View Cart

On the view cart page and on the checkout step one page I would like to change the quantity box to a drop down menu then automaticaly refreshes the page with the new settings when its changed.

Has anyone already done this ?

V3.3.3
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #2  
Old 03-02-2003, 05:33 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

[skin1]/customer/main/cart.tpl:

Find this line:

Code:
<input type=text size=3 name="productindexes[{$smarty.section.product.index}]" value="{$products[product].amount}">

Delete it out, add some spacing inbetween the other code that is wrapped around it, so you that you can paste the following in:

Code:
{if $config.General.show_in_stock ne "Y"} {assign var="mq" value=$config.General.max_select_quantity} {else} {math equation="min(maxquantity+minamount, productquantity)+1" assign="mq" maxquantity=$config.General.max_select_quantity minamount=$product.min_amount productquantity=$product.avail} {/if} {if $product.min_amount le 1} {assign var="start_quantity" value=1} {else} {assign var="start_quantity" value=$product.min_amount} {/if} <select name="productindexes[{$smarty.section.product.index}]" onchange="document.cartform.submit()"> {section name=quantity loop=$mq start=$start_quantity} <option value="{%quantity.index%}" {if $products[product].amount eq %quantity.index%}selected{/if}>{%quantity.index%}</option> {/section} </select>

I've also adjusted step 1 of the checkout as well:

[skin1]/customer/main/cart_contents.tpl

Locate the following line:

Code:
<input type=text size=3 name="productindexes[{$smarty.section.product.index}]" value="{$products[prod_num].amount}">

Highlight this entire line of code and replace it with:

Code:
{if $config.General.show_in_stock ne "Y"} {assign var="mq" value=$config.General.max_select_quantity} {else} {math equation="min(maxquantity+minamount, productquantity)+1" assign="mq" maxquantity=$config.General.max_select_quantity minamount=$product.min_amount productquantity=$product.avail} {/if} {if $product.min_amount le 1} {assign var="start_quantity" value=1} {else} {assign var="start_quantity" value=$product.min_amount} {/if} <select name="productindexes[{$smarty.section.product.index}]" onchange="document.cartform.submit()"> {section name=quantity loop=$mq start=$start_quantity} <option value="{%quantity.index%}" {if $products[prod_num].amount eq %quantity.index%}selected{/if}>{%quantity.index%}</option> {/section} </select>

I'm not too sure if this will work properly with the quantity or inventory check on the product so if you are using a check on inventory & if you do experience the select field selecting the max, disregarding the amount of products available, let me know.

Donations happily accepted

Kudos
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #3  
Old 03-02-2003, 12:59 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

Cheers mate,

ill take a look at this tomorow
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #4  
Old 04-30-2003, 08:04 AM
  kpriest's Avatar 
kpriest kpriest is offline
 

eXpert
  
Join Date: Apr 2003
Location: Seattle, WA
Posts: 263
 

Default

Has anyone had a problem with even the default template updating the quantity? When I change the quantity while I am viewing the cart and click update - it refreshes, but the quantity reverts to its original value. This is in 3.3.5. Any ideas?
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 07:45 PM.

   

 
X-Cart forums © 2001-2020