I would like to find out if there is a way to limit selling an one item per customer. For example, lets say the price is really low for some product since its on promotion. How do I limit the sell that it would be LIMIT 1 PER CUSTOMER order?
Thanks!
Thanks!
I suppose a similar concept to the "min qty" would be needed for max qty. It is odd to ever do this which is why I didn't add it.. cash is green no matter who it's from... but i digress
A quick mod would be to use the Location field or Cost field (since it is not used for anything programmatically) and pretend it is the max qty field. Put a number like 1 in that location field or cost field
Then
1. EDIT: system/library/cart.php
2. FIND:
3. AFTER, ADD:
4. FIND (2 PLACES):
5. AFTER, ADD (Both places):
6. FIND:
7. BEFORE, ADD:
A quick mod would be to use the Location field or Cost field (since it is not used for anything programmatically) and pretend it is the max qty field. Put a number like 1 in that location field or cost field
Then
1. EDIT: system/library/cart.php
2. FIND:
Code: Select all
'minimum' => $product_query->row['minimum'],
Code: Select all
'location' => $product_query->row['location'],
Code: Select all
$this->setMinQty();
Code: Select all
$this->setMaxQty();
Code: Select all
public function setMinQty() {
Code: Select all
public function setMaxQty() {
foreach ($this->getProducts() as $product) {
if ($product['location'] != '') {
if ($product['quantity'] > $product['location']) {
$this->session->data['cart'][$product['key']] = $product['location'];
}
}
}
}
Johnathan wrote:You could reverse the minimum quantity field, and flip its greater-than/less-than sign in the code.
However, the problem is its for only certain products. Not all products, but that coding will effect all products...
Maybe there is some other way to work with this issue without changing effects all the products?Johnathan wrote:Yes, but you can just set the "minimum" (now the maximum) to something higher (like 99) for the other products.
Like an option to be added with a check that applies to this specific item.
Big companies have limit 1 per customer not to abuse it I guess.Qphoria wrote:I suppose a similar concept to the "min qty" would be needed for max qty. It is odd to ever do this which is why I didn't add it.. cash is green no matter who it's from... but i digress
A quick mod would be to use the Location field (since it is not used for anything) and pretend it is the max qty field. Put a number like 1 in that location field
Well i know for retail brick and mortar it makes sense because you want people to come to your store.. the mentality that while they are in your store they will make impromptu purchases of other products.. so you want to keep more people coming to the store... But a website is a different mentality usually.. tho perhaps you are right... I suppose it could be applied the same for big discounts that you want others to look around your store and not leave because the main deal is sold out already. I'll add it to the next version or so
You could also use the "cost" field if that isn't currently used. leave it empty for products you don't want a maxqty set for. I've updated the code above to first check if the field has a value and if not it just ignores it
You could also use the "cost" field if that isn't currently used. leave it empty for products you don't want a maxqty set for. I've updated the code above to first check if the field has a value and if not it just ignores it
This works well but how do I prevent it from showing the quantity to 4 decimal places:
I enter quantity of 5 on product lage in admin but on front it shows 5.000 in cart which doesn't look quite right.
Rob
I enter quantity of 5 on product lage in admin but on front it shows 5.000 in cart which doesn't look quite right.
Rob
I know my place...!
Actually scrub that. I changed my chosen field to SKU and it all works fine.
However, now I need to run a query to update all my 2000 products to insert quantity of 1 in SKU field for each product so that I don't have to manually do it. Any ideas what that query should be?
Also, how do I set a default figure of 1 in the SKU field (99.9% of my products are maximum 1 so I want to be able to just change the 0.1% that need a higher maximum on an as and when basis) - for future products.
Cheers
Rob
However, now I need to run a query to update all my 2000 products to insert quantity of 1 in SKU field for each product so that I don't have to manually do it. Any ideas what that query should be?
Also, how do I set a default figure of 1 in the SKU field (99.9% of my products are maximum 1 so I want to be able to just change the 0.1% that need a higher maximum on an as and when basis) - for future products.
Cheers
Rob
Last edited by robster on Tue Sep 20, 2011 4:42 pm, edited 2 times in total.
I know my place...!
Yes money is green and the more we sell the better
... but in rare cases we need to limit the quantity of promotional items... so yes min and max are both important...
Using oc v1.5.1.2 and following these instructions to add product field "maximum". Instead of changing "location"... I added new field "maximum". Made the changes to controller, model, admin template, and altered product table for maximum. Field shows up in admin product... and when saved .. saves into database... to test I have one product set at maximum 30... on frontend.. I can still add 30+ to cart...
Steps 4-7... I do not have in my system/library/cart.php ... not sure which version the instructions were for... but obviously somethings changed in version 1.5.1.2 ... any ideas? Not asking for handouts just a little help in the right direction .... thanx



Using oc v1.5.1.2 and following these instructions to add product field "maximum". Instead of changing "location"... I added new field "maximum". Made the changes to controller, model, admin template, and altered product table for maximum. Field shows up in admin product... and when saved .. saves into database... to test I have one product set at maximum 30... on frontend.. I can still add 30+ to cart...
Steps 4-7... I do not have in my system/library/cart.php ... not sure which version the instructions were for... but obviously somethings changed in version 1.5.1.2 ... any ideas? Not asking for handouts just a little help in the right direction .... thanx

Qphoria wrote:I suppose a similar concept to the "min qty" would be needed for max qty. It is odd to ever do this which is why I didn't add it.. cash is green no matter who it's from... but i digress
A quick mod would be to use the Location field or Cost field (since it is not used for anything programmatically) and pretend it is the max qty field. Put a number like 1 in that location field or cost field
Then
1. EDIT: system/library/cart.php
2. FIND:3. AFTER, ADD:Code: Select all
'minimum' => $product_query->row['minimum'],
4. FIND (2 PLACES):Code: Select all
'location' => $product_query->row['location'],
5. AFTER, ADD (Both places):Code: Select all
$this->setMinQty();
6. FIND:Code: Select all
$this->setMaxQty();
7. BEFORE, ADD:Code: Select all
public function setMinQty() {
Code: Select all
public function setMaxQty() { foreach ($this->getProducts() as $product) { if ($product['location'] != '') { if ($product['quantity'] > $product['location']) { $this->session->data['cart'][$product['key']] = $product['location']; } } } }
Moved to extenstion store - see later post.davidkimm wrote:Yes money is green and the more we sell the better![]()
![]()
... but in rare cases we need to limit the quantity of promotional items... so yes min and max are both important...
Not asking for handouts just a little help in the right direction .... thanx![]()
Last edited by grgr on Thu Sep 22, 2011 2:37 am, edited 2 times in total.
-
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS
thanks grgr
..... searched high and low and the few I found were for previous versions... Prefer the vqmod but already started hard coding and got it working....
Compared to the vqmod you supplied... I missed a step in the catalog/controller/checkout/checkout.php also I did the error_maximum a little different. The limited qty item maximum is 30 and for some reason doing it the way below... it did not behave correctly... maybe it was user error... and the db table maximum I have default set at 9999 ...
So I did mine
Same thing but flip flopped....
Thanks.. it allowed me to check my work.... definitely using the vqmod version for my next project... I don't know about the vqmod but everything was same as the hard code .... which works perfectly on ver1.5.1.2... just to let you know...
will post back if there is a problem...
Edit------
I can change the quantity in "shopping cart" and it allows to change regardless of the minimum and maximum set for that product... no warning messages either...


Compared to the vqmod you supplied... I missed a step in the catalog/controller/checkout/checkout.php also I did the error_maximum a little different. The limited qty item maximum is 30 and for some reason doing it the way below... it did not behave correctly... maybe it was user error... and the db table maximum I have default set at 9999 ...
Code: Select all
if ($product_info['maximum'] < ($product_total + $quantity)) {
$json['error']['warning'] = sprintf($this->language->get('error_maximum'), $product_info['name'], $product_info['maximum']);
}
Code: Select all
if (($product_total + $quantity) > $product_info['maximum']) {
$json['error']['warning'] = sprintf($this->language->get('error_maximum'), $product_info['name'], $product_info['maximum']);
}
Thanks.. it allowed me to check my work.... definitely using the vqmod version for my next project... I don't know about the vqmod but everything was same as the hard code .... which works perfectly on ver1.5.1.2... just to let you know...

Edit------
I can change the quantity in "shopping cart" and it allows to change regardless of the minimum and maximum set for that product... no warning messages either...
Indeed, the default OC install doesn't either, it does however catch it when you hit the checkout button and won't let you continue.davidkimm wrote: I can change the quantity in "shopping cart" and it allows to change regardless of the minimum and maximum set for that product... no warning messages either...
-
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS
I've updated this so that it works without a max quantity (uses a 0 as default) and put it in the extension store (free to download).
Two versions 1.5.0.x and 1.5.1.x because there was a slight difference in one of the files and the vQmod wouldn't work.
Again, not entirely tested but it seems to be working OK.
http://www.opencart.com/index.php?route ... on_id=3327
Two versions 1.5.0.x and 1.5.1.x because there was a slight difference in one of the files and the vQmod wouldn't work.
Again, not entirely tested but it seems to be working OK.
http://www.opencart.com/index.php?route ... on_id=3327
-
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS
Who is online
Users browsing this forum: No registered users and 18 guests