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)

chatfield 10-11-2003 11:45 AM

I use almost the same line as above.

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

This gives a little bigger field to type in and it sets the default to whatever the minimum order amount that you set for that item.

Good luck.

chatfield 10-11-2003 11:57 AM

I use almost the same line as above.

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

This gives a little bigger field to type in and it sets the default to whatever the minimum order amount that you set for that item.

Good luck.

adpboss 10-11-2003 12:19 PM

Excellent thinking!

Thanks!

BCSE 07-15-2004 09:37 AM

I implemented this before even finding this post. I did some Javascript validation to make sure they input greater than minimum amount.

Here's what I did. In 3.4.x, I changed the FormValidation at the top of skin1/customer/product.tpl to:
Code:

function FormValidation()

{/literal}
{if $javascript_code}
{$javascript_code}
return false;
{else}
if(parseInt(document.orderform.amount.value) >= parseInt(document.orderform.minamount.value))

        return true;

else
{literal}
{
{/literal}
        alert("{"The quantity you entered was invalid.  Please enter the appropriate quantity to add this product to your cart."|replace:"\n":" "|replace:"\r":" "}");
        return false;
{literal}
}
{/literal}
{/if}
{literal}
}


and I added this before the other hidden inputs:

Code:

{* BCSE Begin *}
<input type=hidden name=minamount value="{$product.min_amount}">
{* BCSE End *}



FIXED! This should work now if you want to use a text box instead of a quantity drop down box.

Carrie

QVS 12-20-2004 03:09 AM

anyone know how to do this for version 4.08?

tried following the above information, but it doesnt seem to match up with my version.

any help would be great.

CC 12-20-2004 04:38 AM

Ditto :(

CC 12-20-2004 10:18 AM

Teaches me to look without checking correctly...

I replaced this:
Code:

<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{/if}>{%quantity.index%}</OPTION>
{/section}
</SELECT>


With this:
Code:

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

Seems to work well...

AztecOne 02-12-2005 12:23 PM

Thank You!! Thank You!! Worked well for me in 4.0.9

:D whew!!

zilker 02-13-2005 08:13 AM

QVS, below is the javascript form validation for version 4.0.6. I'm going to go out on a limb and say that it should work for any version 4 cart. Highlight the entire code and paste it over the existing code in /form_validation_js.tpl.

It worked for me ~ BUT ~ back up your original before you try the change ~ just to be safe.

Code:

{* $Id: form_validation_js.tpl,v 1.2.2.3 2004/08/11 12:04:13 max Exp $ *}
<SCRIPT type="text/javascript" language="JavaScript 1.2">
function FormValidation() {ldelim}

    {if $active_modules.Product_Options ne '' && $product_options ne ''}
    if(!check_exceptions()) {ldelim}
        alert(exception_msg);
        return false;
    {rdelim}
        {if $product_options_js ne ''}
        {$product_options_js}
        {/if}
    {/if}

        if(document.getElementById('product_avail'))
            if(document.getElementById('product_avail').value == 0) {ldelim}
                alert("{$lng.txt_out_of_stock|replace:"\n":"
"|replace:"\r":" "|replace:'"':'\"'}");
                return false;
            {rdelim}
if(parseInt(document.orderform.amount.value) >= parseInt(document.orderform.minamount.value))

  return true;

else
{ldelim}
  alert("{"The quantity you entered was invalid.  Please enter the appropriate quantity to add this product to your cart."|replace:"\n":" "|replace:"\r":" "}");
  return false;
{rdelim}

    return true;
{rdelim}
</SCRIPT>


Let me know how it works.

mocara 04-07-2005 06:01 AM

Quote:

Originally Posted by CC
Teaches me to look without checking correctly...

I replaced this:
Code:

<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{/if}>{%quantity.index%}</OPTION>
{/section}
</SELECT>


With this:
Code:

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

Seems to work well...


Which file are you editing here? Will these changes work if you are using the product_options module?


All times are GMT -8. The time now is 09:05 AM.

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