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
  #11  
Old 10-11-2003, 11:45 AM
 
chatfield chatfield is offline
 

Advanced Member
  
Join Date: Aug 2003
Location: Amarillo TX USA
Posts: 38
 

Default

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.
Reply With Quote
  #12  
Old 10-11-2003, 11:57 AM
 
chatfield chatfield is offline
 

Advanced Member
  
Join Date: Aug 2003
Location: Amarillo TX USA
Posts: 38
 

Default

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.
Reply With Quote
  #13  
Old 10-11-2003, 12:19 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Excellent thinking!

Thanks!
Reply With Quote
  #14  
Old 07-15-2004, 09:37 AM
  BCSE's Avatar 
BCSE BCSE is offline
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,060
 

Default

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
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #15  
Old 12-20-2004, 03:09 AM
 
QVS QVS is offline
 

Senior Member
  
Join Date: Nov 2004
Posts: 136
 

Default

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.
__________________
xcart version 4.1.6
UK - Brighton

QVS ELECTRICAL SUPPLIES - http://www.qvsdirect.com

We supply a huge range of cables, electrical accessories, heating, ventilation, fire and security products, consumer units & circuit distribution, indoor and outdoor lighting, showers and water heating, tools and fixings, timer switches, sockets, switches, air conditioning, trunking, and much much more.
Reply With Quote
  #16  
Old 12-20-2004, 04:38 AM
  CC's Avatar 
CC CC is offline
 

eXpert
  
Join Date: Jun 2004
Posts: 349
 

Default

Ditto
__________________
XC 4.2 inc (unofficial) patch release.
Reply With Quote
  #17  
Old 12-20-2004, 10:18 AM
  CC's Avatar 
CC CC is offline
 

eXpert
  
Join Date: Jun 2004
Posts: 349
 

Default

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...
__________________
XC 4.2 inc (unofficial) patch release.
Reply With Quote
  #18  
Old 02-12-2005, 12:23 PM
 
AztecOne AztecOne is offline
 

Member
  
Join Date: May 2004
Posts: 26
 

Default

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

whew!!
__________________
Christy
xcart gold
http://SoberCamel.com
Reply With Quote
  #19  
Old 02-13-2005, 08:13 AM
 
zilker zilker is offline
 

Advanced Member
  
Join Date: Feb 2003
Posts: 89
 

Default

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.
__________________
~zilker

uummm...perhaps you should tell me again.

http://www.designertrends.com
Version 4.0.6
Unix
Reply With Quote
  #20  
Old 04-07-2005, 06:01 AM
 
mocara mocara is offline
 

Advanced Member
  
Join Date: Apr 2005
Posts: 55
 

Default

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?
__________________
4.0.15
Linux
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 03:01 AM.

   

 
X-Cart forums © 2001-2020