Hi,
I make a little change to the add to cart option.
If you wish to use multiple quantity and discount prices for a product in the option boxes you can download my contibution here:
http://www.opencart.com/index.php?route ... ion_id=411
Enjoy.
I make a little change to the add to cart option.
If you wish to use multiple quantity and discount prices for a product in the option boxes you can download my contibution here:
http://www.opencart.com/index.php?route ... ion_id=411
Enjoy.
Attachments
sample - change_quantity_into_menu.png (17.06 KiB) Viewed 14865 times
Last edited by i2Paq on Thu Oct 14, 2010 12:01 am, edited 1 time in total.
Reason: Topic moved
Reason: Topic moved
This is tested for 1.3.4 and works fine, but it will work also in 1.4.0 because its a minor change in the code of one file.
I have a site that sells several different products in various case sizes but we list all the prices by individual unit price.
Now I know that there is a Minimum Quantity option under the product data which would make sure that a customer could only order the mimimum quantity but does mean for example if I set minimum quantity to 12 then a customer could still order 18 units (a case and a half).
I have managed to change the qty box on the products page to read only meaning someone can't overtype the qty but can only order 1 case at a time, but if you require 2 cases you have to click add to cart twice and also means if someone views their cart they can once again start ordering part cases.
Any advise would be very welcome and congratulations on producing such a professional and easy to use cart system.
Sorry forgot to mention am using 1.4.8b
Now I know that there is a Minimum Quantity option under the product data which would make sure that a customer could only order the mimimum quantity but does mean for example if I set minimum quantity to 12 then a customer could still order 18 units (a case and a half).
I have managed to change the qty box on the products page to read only meaning someone can't overtype the qty but can only order 1 case at a time, but if you require 2 cases you have to click add to cart twice and also means if someone views their cart they can once again start ordering part cases.
Any advise would be very welcome and congratulations on producing such a professional and easy to use cart system.
Sorry forgot to mention am using 1.4.8b
maybe its better to use the discount option
You set the minimum order to 12 (price 12.000) and the discount to:
e.g.
quantity = 16, price = 10.000
quantity = 18, price = 9.000
quantity = 24, price = 8.000
You set the minimum order to 12 (price 12.000) and the discount to:
e.g.
quantity = 16, price = 10.000
quantity = 18, price = 9.000
quantity = 24, price = 8.000
Had thought of this but we don't offer discounts for ordering more than 1 case and also this wouldn't solve the problem of being able to order part cases when viewing your cart.
I have used a few different carts before finding opencart (wish I had found this open first and saved myself hours of work) and I do remember changing oscommerce so that you could set quantity groups. Was just wondering if open cart has this anywhere???
I have used a few different carts before finding opencart (wish I had found this open first and saved myself hours of work) and I do remember changing oscommerce so that you could set quantity groups. Was just wondering if open cart has this anywhere???
Mmm... I don't have the time to look into that right now.
But maybe you can ask Qphoria (he is one of the experts).
But maybe you can ask Qphoria (he is one of the experts).
If you find your answer somewhere..... please post it here
So if I understand correctly, you want to be able to a set quantities
12, 24, 36, 48
But not:
18, 26, 31 etc
correct?
Try this. (1.4.x only)
1. Set your minimum qty to 12
2. EDIT: system/library/cart.php
3. FIND:
4. REPLACE WITH:
(1.5.x)
1. EDIT: catalog/controller/checkout/cart.php
2. FIND (THE FIRST INSTANCE ONLY!):
3. BEFORE, ADD:
4. FIND:
5. AFTER, ADD:
This should always increase the cart qty to the next set qty
Examples:
If you add 11, it will force 12
if you add 13, it will force 24
if you add 25, it will force 36
12, 24, 36, 48
But not:
18, 26, 31 etc
correct?
Try this. (1.4.x only)
1. Set your minimum qty to 12
2. EDIT: system/library/cart.php
3. FIND:
Code: Select all
public function setMinQty() {
foreach ($this->getProducts() as $product) {
if ($product['quantity'] < $product['minimum']) {
$this->session->data['cart'][$product['key']] = $product['minimum'];
}
}
}
Code: Select all
public function setMinQty() {
foreach ($this->getProducts() as $product) {
if ($product['quantity'] < $product['minimum']) {
$this->session->data['cart'][$product['key']] = $product['minimum'];
} else {
$this->session->data['cart'][$product['key']] = ceil($product['quantity'] / $product['minimum']) * $product['minimum'];
}
}
}
1. EDIT: catalog/controller/checkout/cart.php
2. FIND (THE FIRST INSTANCE ONLY!):
Code: Select all
unset($this->session->data['shipping_methods']);
Code: Select all
foreach($this->request->post['quantity'] as $product_id => $qty) {
foreach($this->cart->getProducts() as $product) {
if ($product['product_id'] == $product_id) {
$quantity = ceil($product['quantity'] / $product['minimum']) * $product['minimum'];
$this->cart->update($product_id, $quantity);
}
}
}
Code: Select all
$this->cart->add($this->request->post['product_id'], $quantity, $option);
Code: Select all
foreach($this->cart->getProducts() as $product) {
if ($product['product_id'] == $this->request->post['product_id']) {
$quantity = ceil($product['quantity'] / $product['minimum']) * $product['minimum'];
$this->cart->update($this->request->post['product_id'], $quantity);
}
}
Examples:
If you add 11, it will force 12
if you add 13, it will force 24
if you add 25, it will force 36
Even if it is not what f1nutter is looking for .... its very usefull.
Thanks Q
Thanks Q
I edited my product.tpl in catalog/view/theme/YOURTHEME/template/product and changed this:
to this:
so it automatically provides a dropdown menu on quantity discounts, which only gives the option to order in the quantities specified in the discount tab.
Though my shop is still in the works (not satisfied with what I got right now; want the price fields per piece to either display 3 decimals (only there), or maybe I'll mod the product.tpl another way) you can view the results here: http://www.buttonsmaken.nl/onderdelen-o ... onderdelen.
You might notice I also added a "total" field to the quantity discount table.
Code: Select all
<input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" />
Code: Select all
<?php if ($discounts) { ?>
<select name="quantity">
<?php foreach ($discounts as $discount) { ?>
<option value="<?php echo $discount['quantity']; ?>"><?php echo $discount['quantity']; ?></option>
<?php } ?>
</select>
<?php } else { ?>
<input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" />
<?php } ?>
Though my shop is still in the works (not satisfied with what I got right now; want the price fields per piece to either display 3 decimals (only there), or maybe I'll mod the product.tpl another way) you can view the results here: http://www.buttonsmaken.nl/onderdelen-o ... onderdelen.
You might notice I also added a "total" field to the quantity discount table.
I likez teh beerz & foodz.
hehe, so, already modded some more to get what I want. In case someone is interested (I did some frontend-output mods, in the backend the quantities are per 250 pcs, so 500 pcs output on frontend is quantity 2(*250) in the backend) I'm happy to post them.
I likez teh beerz & foodz.
This is great if you want to automatically give the next order size up, but customers may not like it if they order 13 and the system selects 24 if that is the case price.public function setMinQty() {
foreach ($this->getProducts() as $product) {
if ($product['quantity'] < $product['minimum']) {
$this->session->data['cart'][$product['key']] = $product['minimum'];
} else {
$this->session->data['cart'][$product['key']] = ceil($product['quantity'] / $product['minimum']) * $product['minimum'];
}
}
}
to correct this replace the ceil command with floor and the app will round down.
That is:
if the minimum is 12 in a case, and they order 12 they will get 1 case
If they order 11 they will get 12 which is the minimum order.
if they order any number higher than 12 the system will select the next lower case size.
I don't know what i'm doing, but its fun anyway.
Yes please post. i really need this aswell.merchboer wrote:hehe, so, already modded some more to get what I want. In case someone is interested (I did some frontend-output mods, in the backend the quantities are per 250 pcs, so 500 pcs output on frontend is quantity 2(*250) in the backend) I'm happy to post them.
Who is online
Users browsing this forum: No registered users and 21 guests