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

Change product quantity from drop down to number input field

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #41  
Old 12-31-2008, 08:03 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Change product quantity from drop down to number input field

Hi Stuart,
I've been searching for this answer... Your code works!

Can you tell me if there's something different I need to do for v4.1.9 with the buy_now.tpl? I still need to remove the quantity drop down box. I found the section for buy_now.tpl, but in my v4.1.9 it's a little different than previously posted:
{if $product.min_amount le 1}
{assign var="start_quantity" value=1}
{else}
{assign var="start_quantity" value=$product.min_amount}
{/if}
{if $config.General.unlimited_products eq "Y"}
{math equation="x+y" assign="mq" x=$mq y=$start_quantity}
{/if}
<select name="amount">
{section name=quantity loop=$mq start=$start_quantity}
<option value="{%quantity.index%}"{if $smarty.get.quantity eq %quantity.index%} selected="selected"{/if}>{%quantity.index%}</option>
{/section}
</select>

...when I try to comment this out and add <input name=amount type="text" value="{$product.min_amount}" size="2" maxlength="2">
Nothing changes. Any suggestions?

Thank you,
Christine


Quote:
Originally Posted by stuartn
in product template

<tr>
<td width="30%">{$lng.lbl_quantity}</td>
<td><input type="text" name="amount" size="2" maxlength="2" value="{$product.min_amount}"/></td>
</tr>
Attached Thumbnails
Click image for larger version

Name:	QuantityBox.jpg
Views:	135
Size:	26.3 KB
ID:	1296  
__________________
______________
version 4.1.9 Gold

Last edited by ChristineP : 12-31-2008 at 08:20 AM. Reason: Added image
Reply With Quote
  #42  
Old 01-05-2009, 05:10 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Change product quantity from drop down to number input field

I've tested this over the holiday and when I change the text box quantity to higher number than 1, it does not change when adding to my shopping cart. Is there something missing for v4.1.9 for the text quantity to work?

Christine
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #43  
Old 01-05-2009, 11:38 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Change product quantity from drop down to number input field

For v4.1.9.... I have this working now for the quantity to multiply when the text number is changed, and I was able to remove the "drop down".

In customer/main/product.tpl to add the text quantity:
<tr>
<td width="30%">{$lng.lbl_quantity}</td>
<td><input type="text" style="text-align:right" name="amount" size="4" maxlength="4" value="{$product.min_amount}"/></td>
</tr>
<!--<tr><td height="25" width="30%">{$lng.lbl_quantity}{if $product.min_amount gt 1}<br /><font class="ProductDetailsTitle">{$lng.txt_need_min_amo unt|substitute:"items":$product.min_amount}</font></td>-->

and comment out this section to remove the drop down:
<!--<select id="product_avail" name="amount"{if $active_modules.Product_Options ne '' && $product_options ne ''} onchange="check_wholesale(this.value);"{/if}>
{section name=quantity loop=$mq start=$start_quantity}
<option value="{%quantity.index%}"{if $smarty.get.quantity eq %quantity.index%} selected="selected"{/if}>{%quantity.index%}</option>
{/section}
</select>-->


Christine
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #44  
Old 01-07-2009, 09:31 AM
 
navjot2121 navjot2121 is offline
 

Member
  
Join Date: Aug 2008
Posts: 13
 

Default Re: Change product quantity from drop down to number input field

Using X-Cart Gold 4.1.10
I want to remove drop down, instead the customer can put any number. I also want to restrict to add the number to 200000, Can this be pssible?
__________________
X-Cart Gold 4.1.10
Reply With Quote
  #45  
Old 01-07-2009, 11:04 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Change product quantity from drop down to number input field

You can try the same code as I've posted for your customer/main/product.tpl to remove the drop down and have only a text box for your customer to put any number up to 200000 (see attached image). This code works for v4.1.9.

In customer/main/product.tpl to add the text quantity:
<tr>
<td width="30%">{$lng.lbl_quantity}</td>
<td><input type="text" style="text-align:right" name="amount" size="6" maxlength="6" value="{$product.min_amount}"/></td>
</tr>
<!--<tr><td height="25" width="30%">{$lng.lbl_quantity}{if $product.min_amount gt 1}<br /><font class="ProductDetailsTitle">{$lng.txt_need_min_amo unt|substitute:"items":$product.min_amount}</font></td>-->

and comment out this section to remove the drop down:
<!--<select id="product_avail" name="amount"{if $active_modules.Product_Options ne '' && $product_options ne ''} onchange="check_wholesale(this.value);"{/if}>
{section name=quantity loop=$mq start=$start_quantity}
<option value="{%quantity.index%}"{if $smarty.get.quantity eq %quantity.index%} selected="selected"{/if}>{%quantity.index%}</option>
{/section}
</select>-->

I changed the size values of quantity to allow up to 6 numbers, but you will also need to change the size of the quantity text box in the checkout page where the customer is allowed to 'update' their purchase. I haven't tested any of the checkout templates to guide you in changing the size value for the quantity text box, though the experts here can point you in that direction. Also, you will need to add 200000 to the maximum allowed in your admin>General Settings under Purchase limitations "Maximum allowed total quantity of products in an order (0 means no maximum limit):"

Good luck.

Quote:
Originally Posted by navjot2121
Using X-Cart Gold 4.1.10
I want to remove drop down, instead the customer can put any number. I also want to restrict to add the number to 200000, Can this be pssible?
Attached Thumbnails
Click image for larger version

Name:	Quantity.jpg
Views:	142
Size:	41.8 KB
ID:	1314  
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #46  
Old 01-15-2009, 10:32 PM
  christindall's Avatar 
christindall christindall is offline
 

eXpert
  
Join Date: Dec 2007
Location: Everett, WA
Posts: 264
 

Default Re: Change product quantity from drop down to number input field

I just implemented this in 4.1.11 - it's been up for like 2 minutes, so haven't tested it - other than to note that if you have (in General Options) inventory tracking enabled, it will not allow the customer to add more to their cart than you have in stock.

For me, since many items are ordered direct from the manufacturer upon MY order (similar to drop ship, but not exact) I want them to be able to order as many as they want - thus I had to check "Disable Inventory Tracking"
__________________
Chris Tindall
x-cart 4.7.5 Gold Plus
www.theweedpatchstore.com
AlteredCart: On-Sale, One Page Checkout, Checkout One Payments (although that's not working yet)
BCSE: Back in stock Notify, Checkbox Radio Mod, Upselling Links
SMACK: CDSEO Pro, Product Map
X-Cart: Gold+, Mobile
(still trying to get working: Gahela Support Suite)
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 07:00 AM.

   

 
X-Cart forums © 2001-2020