Post by mldnkslvc » Fri Jan 27, 2012 11: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...

New member

Posts

Joined
Fri Dec 09, 2011 9:17 pm

Post by Qphoria » Fri Jan 27, 2012 11: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


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by mldnkslvc » Fri Jan 27, 2012 11: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?

New member

Posts

Joined
Fri Dec 09, 2011 9:17 pm

Post by Qphoria » Sat Jan 28, 2012 3:16 am

(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


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by crqdesigns » Fri Mar 16, 2012 9: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!

Newbie

Posts

Joined
Fri Mar 16, 2012 9:22 am

Post by fairmount » Wed May 09, 2012 12:31 pm

Hi Q,

Just wanted to say thanks. Your post solved a big question for me.

Newbie

Posts

Joined
Fri Apr 20, 2012 11:42 am

Post by fairmount » Mon May 21, 2012 5:22 am

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

Newbie

Posts

Joined
Fri Apr 20, 2012 11:42 am

Post by ritaylo3 » Wed Jun 06, 2012 6:24 am

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

Newbie

Posts

Joined
Tue May 22, 2012 3:48 am

Newbie

Posts

Joined
Wed Jun 06, 2012 4:58 pm
Location - Malaysia

Post by ritaylo3 » Wed Jun 13, 2012 6:28 am

Can anyone help me with this for version 1.5.2.1 . The code above doesn't seem to work....as is.
Thanks

Newbie

Posts

Joined
Tue May 22, 2012 3:48 am

Post by jdunneirl » Wed Jul 11, 2012 7:37 pm

Look down further around line 369ish

Newbie

Posts

Joined
Wed Jun 06, 2012 11:10 pm

Post by Opencartfan56 » Sat Jul 21, 2012 6:21 am

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 ?

Newbie

Posts

Joined
Thu Jul 19, 2012 3:58 am

Post by Opencartfan56 » Tue Jul 24, 2012 5:36 am

jdunneirl wrote:Look down further around line 369ish
Hmm i checked it but i cant still find it....

Newbie

Posts

Joined
Thu Jul 19, 2012 3:58 am

Post by saintlade » Sat Oct 20, 2012 4:23 am

Hi Guys,


anybody found a workaround for 1.5.4.1 for this? Would greatly appreciate it.

New member

Posts

Joined
Wed Oct 12, 2011 9:12 am

Post by zara0 » Sat Apr 27, 2013 2:55 pm

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)

Newbie

Posts

Joined
Sun Mar 24, 2013 9:04 am

Post by andy12 » Thu Aug 22, 2013 12:11 pm

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

Newbie

Posts

Joined
Thu Aug 22, 2013 12:04 pm

Post by grgr » Mon Sep 02, 2013 2:36 am

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

warnings.png (36.8 KiB) Viewed 10703 times


-
Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by lyochum1 » Wed Sep 04, 2013 4:55 pm

Can you let me know when you have this ready?
Quantity check on minimum input field on product page

Newbie

Posts

Joined
Sun Mar 25, 2012 12:28 am

Post by grgr » Thu Sep 05, 2013 2:53 pm

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

-
Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK
Who is online

Users browsing this forum: No registered users and 3 guests