Quantity check on minimum input field on product page
15 posts
• Page 1 of 1
Quantity check on minimum input field on product page
it would be nice to add a function that checks product quantity when adding product to cart... opencart 1.5.1.3 does not have this function... you can easily add ie.100 units of a product into cart regardless of product availibility in stock... to be specific: there's 5 units of a product in stock but it doesn't prevetn user to insert greater value than that in quantity field on product page... i think you see my point here...
- mldnkslvc
- Posts: 53
- Joined: Fri Dec 09, 2011 1:17 pm
Re: Quantity check on minimum input field on product page
The validation is done at the checkout step instead. If you have allow checkout set to NO.. it will not allow you to purchase 100 of an item you only have 5 of

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: Quantity check on minimum input field on product page
i know that,but wouldn't it be better to have a function that validates that on product's page? i think it would... because a customer always likes a good usability... do you agree with me?
- mldnkslvc
- Posts: 53
- Joined: Fri Dec 09, 2011 1:17 pm
Re: Quantity check on minimum input field on product page
(1.5.x)
1. EDIT: catalog/controller/checkout/cart.php
2. FIND:
3. BEFORE, ADD:
4. EDIT: catalog/language/english/checkout/cart.php
5. FIND:
6. AFTER, ADD:
1. EDIT: catalog/controller/checkout/cart.php
2. FIND:
- Code: Select all
if ($product_info['minimum'] > ($product_total + $quantity)) {
3. BEFORE, ADD:
- Code: Select all
if ($product_info['quantity'] < $quantity) {
$json['error']['warning'] = sprintf($this->language->get('error_understock'), $product_info['quantity']);
}
4. EDIT: catalog/language/english/checkout/cart.php
5. FIND:
- Code: Select all
$_['error_minimum'] = 'Minimum order amount for %s is %s!';
6. AFTER, ADD:
- Code: Select all
$_['error_understock'] = 'Requested quantity greater than stock quantity: %s!';

Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
-

Qphoria - Administrator
- Posts: 18200
- Joined: Mon Jul 21, 2008 7:02 pm

Re: Quantity check on minimum input field on product page
Hi
I was wondering the same thing.
on the product page, i can enter 0 qty and message comes up:
Success: You have added ''product'' to your shopping cart!
I was wondering the same thing.
on the product page, i can enter 0 qty and message comes up:
Success: You have added ''product'' to your shopping cart!
- crqdesigns
- Posts: 8
- Joined: Fri Mar 16, 2012 1:22 am
Re: Quantity check on minimum input field on product page
Hi Q,
Just wanted to say thanks. Your post solved a big question for me.
Just wanted to say thanks. Your post solved a big question for me.
- fairmount
- Posts: 14
- Joined: Fri Apr 20, 2012 3:42 am
Re: Quantity check on minimum input field on product page
Hi ,
Just realised that I had a problem with this code. When I have options in products, I need to check for the quantity from the options.
How do I modify the code to check the quantity from options when I have at least one option for a product.
Tried few variations, based on my measly knowledge of OC and php...but nothing is working.
Please help.
Regards,
FM
Just realised that I had a problem with this code. When I have options in products, I need to check for the quantity from the options.
How do I modify the code to check the quantity from options when I have at least one option for a product.
Tried few variations, based on my measly knowledge of OC and php...but nothing is working.
Please help.
Regards,
FM
- fairmount
- Posts: 14
- Joined: Fri Apr 20, 2012 3:42 am
Re: Quantity check on minimum input field on product page
This is exactly what I am looking for, however, the code above does not work for me.
in catalog/controller/checkout/cart.php
I do not have the line:
if ($product_info['minimum'] > ($product_total + $quantity)) {
instead, I have:
if ($product['minimum'] > $product_total) {
when I place the edited code above by Qphoria, nothing happens. I'm sure it is just a simple fix and I just need to change a couple of words. If anyone could help, that would be great.
Thanks
ritaylo3
in catalog/controller/checkout/cart.php
I do not have the line:
if ($product_info['minimum'] > ($product_total + $quantity)) {
instead, I have:
if ($product['minimum'] > $product_total) {
when I place the edited code above by Qphoria, nothing happens. I'm sure it is just a simple fix and I just need to change a couple of words. If anyone could help, that would be great.
Thanks
ritaylo3
- ritaylo3
- Posts: 6
- Joined: Mon May 21, 2012 7:48 pm
- jarrodlsb
- Posts: 2
- Joined: Wed Jun 06, 2012 8:58 am
- Location: Malaysia
Re: Quantity check on minimum input field on product page
Can anyone help me with this for version 1.5.2.1 . The code above doesn't seem to work....as is.
Thanks
Thanks
- ritaylo3
- Posts: 6
- Joined: Mon May 21, 2012 7:48 pm
Re: Quantity check on minimum input field on product page
Look down further around line 369ish
- jdunneirl
- Posts: 6
- Joined: Wed Jun 06, 2012 3:10 pm
Re: Quantity check on minimum input field on product page
ritaylo3 wrote:This is exactly what I am looking for, however, the code above does not work for me.
in catalog/controller/checkout/cart.php
I do not have the line:
if ($product_info['minimum'] > ($product_total + $quantity)) {
instead, I have:
if ($product['minimum'] > $product_total) {
when I place the edited code above by Qphoria, nothing happens. I'm sure it is just a simple fix and I just need to change a couple of words. If anyone could help, that would be great.
Thanks
ritaylo3
I have the same problen
anyone ?
- Opencartfan56
- Posts: 2
- Joined: Wed Jul 18, 2012 7:58 pm
Re: Quantity check on minimum input field on product page
jdunneirl wrote:Look down further around line 369ish
Hmm i checked it but i cant still find it....
- Opencartfan56
- Posts: 2
- Joined: Wed Jul 18, 2012 7:58 pm
Re: Quantity check on minimum input field on product page
Hi Guys,
anybody found a workaround for 1.5.4.1 for this? Would greatly appreciate it.
anybody found a workaround for 1.5.4.1 for this? Would greatly appreciate it.
- saintlade
- Posts: 71
- Joined: Wed Oct 12, 2011 1:12 am
Re: Quantity check on minimum input field on product page
Can someone please help me to add an alert message on the product page.
If the product quantity entered is 0, an error message "Quantity entered is 0, no products have been added to the cart!"
At the moment, when the product quantity is 0, nothing is added to the cart but there is no notification.
Thank you for you any assistance.
(OC v1.5.5.1)
If the product quantity entered is 0, an error message "Quantity entered is 0, no products have been added to the cart!"
At the moment, when the product quantity is 0, nothing is added to the cart but there is no notification.
Thank you for you any assistance.
(OC v1.5.5.1)
- zara0
- Posts: 10
- Joined: Sun Mar 24, 2013 1:04 am
15 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 4 guests













