![]() |
Change product quantity from drop down to number input field
Which template do I need to change and (with what code) do I need to change to replace the product quantity drop down menu in a normal product table, to a normal quantity input field?
|
This is in products.tpl
|
What provisions need to be made to ensure that the field is numeric and not going to cause complications?
|
That is already inbuilt into cart.php and will not cause a problem.
8) |
Excuse the newbie question, but which code should I replace, with what?
|
Code:
<select name=amount> Replace with this code and that should do it: Code:
<input type="text" name="amount" size="3"> |
:D Sweeeeeet! Thanks!
|
made the modification - now Access Denied problem
I've changed my quantity field as described above - but now have this problem:
Product has a minimum quantity - must purchase 100. If user enters a number less than 100, resulting page reads "Access Denied! You are not allowed to access that resource!". Any ideas? I'm assuming the cart is trying to redirect me to a page alerting me that I didn't enter a valid quantity, but for some reason isn't getting there. thanks in advance! Glen |
If I was using minimum and/or maximum quantity I'd stick with the drop down box personally.
|
How would I set the default value of this text box to "1"?
So the box would read "1" but the user could change that number via highlight or delete and add their own number. Make sense? |
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. |
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. |
Excellent thinking!
Thanks! |
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() and I added this before the other hidden inputs: Code:
{* BCSE Begin *} FIXED! This should work now if you want to use a text box instead of a quantity drop down box. Carrie |
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. |
Ditto :(
|
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}> With this: Code:
<input type="text" name=amount size="4" value="{$product.min_amount}"> Seems to work well... |
Thank You!! Thank You!! Worked well for me in 4.0.9
:D whew!! |
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 $ *} Let me know how it works. |
Quote:
Which file are you editing here? Will these changes work if you are using the product_options module? |
that is in products.tpl and yes, you can still use your product options with that mod.
|
Has anyone tried this with 4.0.13? Looking at the 2 changes:
1. products.tpl I changed this: Code:
<SELECT id="product_avail" name="amount"{if $active_modules.Product_Options ne '' && $product_options ne ''} onchange="check_wholesale(this.value);"{/if}> to this: Code:
<input name=amount type="text" value="{$product.min_amount}" size="6" maxlength="4"> That appears to work no probs. BUT... 2. form_validation.tpl I replaced the entire contents of this file with the suggestion in zilker's post of Sun Feb 13, 2005 The problem... Whenever I now submit the form to 'add to cart', I get the Jscript error "document.orderform.minamount.value' is null or not an object. Has anyone else had any luck making this mod on 4.0.13? Cheers, JB |
I'm looking at skin1/main/products.tpl and I can't seem to find the code to replace. Used the 'find' function with parts of the code and even scanned through the file (since file is fairly short, 3k). Still not finding it. Is this even the right products.tpl file?
Looked at products.php in the root too but code's not in there either. Somebody please help! |
sorry - maybe a typo...try product.tpl
|
Ok well, looked at both product.tpl products.tpl in the skin1/main/ directory. Search function doesn't even find the words "select" or "amount" anywhere in either document (searching code not text).
I'm using 4.0.13, why the hell can't I find that string? Is the file in another directory? |
OK, i'm looking at a vanilla, XC 4.0.13 install.
1. Goto skin1/customer/main/product.tpl 2. Look at lines 92-96, for the code in my post above (or, try searching code for '<SELECT id="product_avail" ' ) 3. Replace that code with the code from my post above. Should work no probs, - i've just replicated again to test i'm not going mad. If you still don't have any luck, PM me or post your tpl here.. Cheers, |
I tried this code because I too prefer the input field as oppose to the drop down. The problem I'm having is some of my products have variants and if that product is out of stock customers are still able to order the out of stock variant, which should not be since I have that option disable in general settings. Anyone have this problem or better yet a fix.
Thanks |
Nothing to do with this fix in 4.0.14, is it?
Quote:
|
Quote:
If someone could assist me in getting the input field to work on the detail page the way it works on the shopping cart page it would be greatly appreciated. |
Any updates to this mod for 4.0.14? Obviously ensuring that we have in stock what we sell is vital :-)
Mocara. |
make sure to add this to the product.tpl
<Input type="hidden" name="minamount" value="{$product.min_amount}"> That will allow the javascript toknow the minimum ammount. I placed it with the text box but you can also place it with the other hidden inputs. scott |
Works like a charm when the customer is viewing the product details! Thanks!
How can I make this happen when a customer is viewing all the products in a category? |
Quote:
I opened /skin1/customer/main/buy_now.tpl and replaced Code:
<SELECT name="amount"> with Code:
<input name=amount type="text" value="{$product.min_amount}" size="7" maxlength="5"> |
Re: Change product quantity from drop down to number input field
Im on version 4. 0. 18,
are you guys still doing this <input name=amount type="text" value="{$product.min_amount}" size="7" maxlength="5"> In product.tpl? OR ..... is there something in tha admin panel that i can set? I tried setting the quantity select box to 0, but it just went back to 50. :) |
Re: Change product quantity from drop down to number input field
Quote:
Dawn, did you ever come up with a solution for this? After making all the changes previously described in this thread, I am running into the same problem. When the customer is viewing the product details page (/cart/product.php, modified using product.tpl ) the JavaScript alert works fine if they try to order below the minimum. However, when the customer is on the page that lists all the products in one category (cart/home.php?cat=255, modified using buy_now.tpl) they do not get the alert and they still get the message "You are not allowed to access that resource!". The changes I made to product.tpl and buy_now.tpl are identical. The problem seems to be that the Javascript FormValidation is not availalbe on the category listing pages. Is there an appropriate way to make this available on all pages? |
Re: Change product quantity from drop down to number input field
An update to this issue...it was simple enough to include the necessary JavaScript on each page by adding: {include file="form_validation_js.tpl"} to /cart/home.php .
That still didn't solve the problem. The reason the Javascript alert works on the individual detail pages is that there is only one form on these pages and its name is "orderform" and that is picked up by the "document.orderform.amount.value" in the FormValidation() function. The reason its not working on the catagory pages that list multiple products, is that there is a different form for each product. Each one has a different name that is dynamically created and is something like "orderform_16152_1154021436". The Javascript FormValidation() function will only be triggered on forms named "orderform". Anyway, if anyone has an idea how to handle this wrinkle, I would appreciate it as I am stuck at this point. |
Re: Change product quantity from drop down to number input field
I have a problem with qty's, no matter what qty you input the amount sent to cart is always 1
Any clues ? X-Cart version 4.0.18 |
Re: Change product quantity from drop down to number input field
I am on version 4.1.9 - is there an update for changing the quanity from drop down to number input?
|
Re: Change product quantity from drop down to number input field
anyone? please
|
Re: Change product quantity from drop down to number input field
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> |
All times are GMT -8. The time now is 03:13 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.