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)
-   -   Changing quantity selectbox amount for individual product (https://forum.x-cart.com/showthread.php?t=25043)

frankdux 09-18-2006 02:49 PM

Changing quantity selectbox amount for individual product
 
Is there a way to change the quantity dropdown amount for individual product? For example you have "Maximum number of selections in quantity selectbox:" set to 100, but for one product you want it to be only 50.

frankdux 09-19-2006 10:48 AM

Re: Changing quantity selectbox amount for individual product
 
After a little more digging I realized that quantity changes in the dropdown selectbox are tied to inventory levels. Since I have disable inventory on this site, I decided to just go the route of replacing the dropdown select with a text input field. Here is what I did in case anyone else has this need:

I took this code in product.tpl:
HTML Code:


<SELECT id="product_avail" name="amount"{if $active_modules.Product_Options ne '' && $product_options ne ''} onchange="check_options();"{/if}>
        {section name=quantity loop=$mq start=$start_quantity}
        <OPTION value="{%quantity.index%}" {if $smarty.get.quantity eq %quantity.index%}selected{/if}>{%quantity.index%}</OPTION>
        {/section}
</SELECT>


and replaced it with this:
HTML Code:


<input type="text" name="amount" size="3">
{* hide dropdown selectbox
<SELECT id="product_avail" name="amount"{if $active_modules.Product_Options ne '' && $product_options ne ''} onchange="check_options();"{/if}>
        {section name=quantity loop=$mq start=$start_quantity}
        <OPTION value="{%quantity.index%}" {if $smarty.get.quantity eq %quantity.index%}selected{/if}>{%quantity.index%}</OPTION>
        {/section}
</SELECT>
  *}


Basically I just added a text input fieLd with the same name as the selectbox, "amount". Then I just commented out the select in case I ever want to use it again.

vixnfox 09-25-2006 08:06 PM

Re: Changing quantity selectbox amount for individual product
 
Nice !!!

vbworm7 10-27-2006 12:19 PM

Re: Changing quantity selectbox amount for individual product
 
Make sure to set a default value of 1 by adding value="1" to the code like shown below...

<input type="text" name="amount" size="3" value="1">
{* hide dropdown selectbox
<SELECT id="product_avail" name="amount" {if $active_modules.Product_Options ne '' && $product_options ne ''} onchange="check_options();"{/if}>
{section name=quantity loop=$mq start=$start_quantity}
<OPTION value="{%quantity.index%}" {if $smarty.get.quantity eq %quantity.index%}selected{/if}>{%quantity.index%}</OPTION>
{/section}
</SELECT>
*}

paperlion 01-02-2007 07:47 PM

Re: Changing quantity selectbox amount for individual product
 
Debra's fix for this was similar, but she also added a variable to set the default value the same way as the product's minimum:

<input type="text" name=amount size="4" value="{$product.min_amount}">

Here: http://forum.x-cart.com/showpost.php?p=109039&postcount=7


The problem I'm having (if you haven't noticed from some related posts -- please excuse the possible duplication), is with multiple ('wholesale') pricing levels. Am not sure how to execute this js function with a text box when it replaces the drop-down --- the javascript is supposed to update the price immediately based on the quantity being 'moused over', (er, mouseovered?).

inebriate 01-03-2007 10:36 AM

Re: Changing quantity selectbox amount for individual product
 
why dont you change it to "onchange" instead of "onmouseover"?

paperlion 01-03-2007 10:50 AM

Re: Changing quantity selectbox amount for individual product
 
am not sure where that js file is, but that's an idea. Main problem right now though, is that the price isn't being updated even when the product lands in the cart!


All times are GMT -8. The time now is 02:58 PM.

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