Community Forums

Quantity check on minimum input field on product page

Enter all OpenCart 1.x feature requests here. One idea per topic. Please search the forum to see if your feature has already been requested

Quantity check on minimum input field on product page

Postby mldnkslvc » Fri Jan 27, 2012 3:25 pm

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

Postby Qphoria » Fri Jan 27, 2012 3:39 pm

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
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18200
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: Quantity check on minimum input field on product page

Postby mldnkslvc » Fri Jan 27, 2012 3:42 pm

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

Postby Qphoria » Fri Jan 27, 2012 7:16 pm

(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!';   
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18200
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: Quantity check on minimum input field on product page

Postby crqdesigns » Fri Mar 16, 2012 1:25 am

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!
crqdesigns
 
Posts: 8
Joined: Fri Mar 16, 2012 1:22 am

Re: Quantity check on minimum input field on product page

Postby fairmount » Wed May 09, 2012 4:31 am

Hi Q,

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

Postby fairmount » Sun May 20, 2012 9:22 pm

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
fairmount
 
Posts: 14
Joined: Fri Apr 20, 2012 3:42 am

Re: Quantity check on minimum input field on product page

Postby ritaylo3 » Tue Jun 05, 2012 10:24 pm

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
ritaylo3
 
Posts: 6
Joined: Mon May 21, 2012 7:48 pm


Re: Quantity check on minimum input field on product page

Postby ritaylo3 » Tue Jun 12, 2012 10:28 pm

Can anyone help me with this for version 1.5.2.1 . The code above doesn't seem to work....as is.
Thanks
ritaylo3
 
Posts: 6
Joined: Mon May 21, 2012 7:48 pm

Re: Quantity check on minimum input field on product page

Postby jdunneirl » Wed Jul 11, 2012 11:37 am

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

Postby Opencartfan56 » Fri Jul 20, 2012 10:21 pm

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

Postby Opencartfan56 » Mon Jul 23, 2012 9:36 pm

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

Postby saintlade » Fri Oct 19, 2012 8:23 pm

Hi Guys,


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

Postby zara0 » Sat Apr 27, 2013 6:55 am

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)
zara0
 
Posts: 10
Joined: Sun Mar 24, 2013 1:04 am


Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 4 guests

Hosted by Arvixe Web Hosting