Page 1 of 2
Quantity check on minimum input field on product page
Posted: Fri Jan 27, 2012 11:25 pm
by mldnkslvc
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...
Re: Quantity check on minimum input field on product page
Posted: Fri Jan 27, 2012 11:39 pm
by Qphoria
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
Re: Quantity check on minimum input field on product page
Posted: Fri Jan 27, 2012 11:42 pm
by mldnkslvc
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?
Re: Quantity check on minimum input field on product page
Posted: Sat Jan 28, 2012 3:16 am
by Qphoria
(1.5.x)
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!';
Re: Quantity check on minimum input field on product page
Posted: Fri Mar 16, 2012 9:25 am
by crqdesigns
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!
Re: Quantity check on minimum input field on product page
Posted: Wed May 09, 2012 12:31 pm
by fairmount
Hi Q,
Just wanted to say thanks. Your post solved a big question for me.
Re: Quantity check on minimum input field on product page
Posted: Mon May 21, 2012 5:22 am
by fairmount
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
Re: Quantity check on minimum input field on product page
Posted: Wed Jun 06, 2012 6:24 am
by ritaylo3
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
Re: Quantity check on minimum input field on product page
Posted: Wed Jun 06, 2012 5:29 pm
by jarrodlsb
Thanks
Re: Quantity check on minimum input field on product page
Posted: Wed Jun 13, 2012 6:28 am
by ritaylo3
Can anyone help me with this for version 1.5.2.1 . The code above doesn't seem to work....as is.
Thanks
Re: Quantity check on minimum input field on product page
Posted: Wed Jul 11, 2012 7:37 pm
by jdunneirl
Look down further around line 369ish
Re: Quantity check on minimum input field on product page
Posted: Sat Jul 21, 2012 6:21 am
by Opencartfan56
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 ?
Re: Quantity check on minimum input field on product page
Posted: Tue Jul 24, 2012 5:36 am
by Opencartfan56
jdunneirl wrote:Look down further around line 369ish
Hmm i checked it but i cant still find it....
Re: Quantity check on minimum input field on product page
Posted: Sat Oct 20, 2012 4:23 am
by saintlade
Hi Guys,
anybody found a workaround for 1.5.4.1 for this? Would greatly appreciate it.
Re: Quantity check on minimum input field on product page
Posted: Sat Apr 27, 2013 2:55 pm
by zara0
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)
Re: Quantity check on minimum input field on product page
Posted: Thu Aug 22, 2013 12:11 pm
by andy12
Hi,
I also tried to use the code but i guess that is not working with OC v1.5.5.1 . If anyone has found the solution and can share here would be much helpful.
Thanks in advance.
Andy
Re: Quantity check on minimum input field on product page
Posted: Mon Sep 02, 2013 2:36 am
by grgr
I have already dealt with this by way of a new extension that builds on top of my max quantity one.
Currently, the new extension deals with preventing adding to cart of too few products, too many products or more products than are in stock by way of the following:
- - Minimum order quantity validation / warning message on product page and cart;
- Maximum order quantity validation / warning message on product page and cart;
- Stock quantity validation / warning message on product page;
- Options Stock validation / warning message (displays warning for option with lowest available stock) on product page;
Example warnings shown below.
Not released yet, still testing and tweaking but should be ready this week sometime.
warnings.png (36.8 KiB) Viewed 10751 times
Re: Quantity check on minimum input field on product page
Posted: Wed Sep 04, 2013 4:55 pm
by lyochum1
Can you let me know when you have this ready?
Quantity check on minimum input field on product page
Re: Quantity check on minimum input field on product page
Posted: Thu Sep 05, 2013 2:53 pm
by grgr
lyochum1 wrote:Can you let me know when you have this ready?
Quantity check on minimum input field on product page
It's nearly done, some more testing to do yet but very close.
I have it working at the moment on a test site, have a play with the following products:
http://vger.co.uk/two/index.php?route=p ... duct_id=44
http://vger.co.uk/two/index.php?route=p ... duct_id=30
http://vger.co.uk/two/index.php?route=p ... duct_id=48
Re: Quantity check on minimum input field on product page
Posted: Sun Sep 08, 2013 9:27 pm
by grgr