Post by Bear » Sat May 12, 2012 4:29 pm

I have searched for quite some time looking for a vQmod or extension that would do the following:

If a customer attempts to add 500 widgets to their carts and only 450 are in stock, I want the mod to change the amount in their cart automatically to the maximum in stock. Ideally, this would work directly from the product page so no errors need to be corrected by the customer at checkout. This way, they do not get an error and I don't have to publicly display stock numbers.

So far, this mod was the closest I found to doing what I want, as it does update a carts quantity without any customer involvement. Sadly, I'm not masterful enough at coding to tweak it to do what I want.

Any help would be greatly appreciated =)

User avatar
Newbie

Posts

Joined
Sat May 12, 2012 10:34 am


Post by Qphoria » Thu May 24, 2012 10:25 am

Don't have time to make a vQmod of it yet, but try this for now

(1.5.x)
1. EDIT: catalog/controller/checkout/cart.php

2. FIND:

Code: Select all

$quantity = $this->request->post['quantity'];
3. REPLACE WITH:

Code: Select all

$quantity = ($this->request->post['quantity'] > $product_info['quantity']) ? $product_info['quantity'] : $this->request->post['quantity'];
Not tested

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 34 guests