X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Change product quantity from drop down to number input field (https://forum.x-cart.com/showthread.php?t=2428)

ChristineP 12-31-2008 08:03 AM

Re: Change product quantity from drop down to number input field
 
1 Attachment(s)
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>


ChristineP 01-05-2009 05:10 AM

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

ChristineP 01-05-2009 11:38 AM

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

navjot2121 01-07-2009 09:31 AM

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?

ChristineP 01-07-2009 11:04 AM

Re: Change product quantity from drop down to number input field
 
1 Attachment(s)
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?


christindall 01-15-2009 10:32 PM

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"


All times are GMT -8. The time now is 11:07 AM.

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