Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Quantity Price Breaks Per Product Question


1Putts

Recommended Posts

I'm playing around with this Quantity Price Breaks Per Product contribution:

http://www.oscommerce.com/community/contributions,1242

 

...and I have a few questions that hopefully someone can help me with. Very useful contribution, by the way, if I can just get it to work the way I need it.

 

1. The quantity input box in the product listing page doesn't seem to carry over to the cart. You enter '3' in the quantity, hit "add to cart" and it adds 1. Any ideas?

 

2. This is asking a bit much but here goes. Let's say for each product, I have 3 options (small, medium and large). Someone orders 2 small, 2 medium and 2 large of the same product. Let's say my first price break is at 5 units. They've bought 6 units but don't get the price break (it shows up in the cart as 3 line items which is correct but the quantity discount isn't recognized). Is there a way to reconcile all the options of the same product ordered to calculate the correct price break?

 

Thanks in advance for any advice offered.

Link to comment
Share on other sites

  • 1 month later...
I'm playing around with this Quantity Price Breaks Per Product contribution:

http://www.oscommerce.com/community/contributions,1242

 

...and I have a few questions that hopefully someone can help me with. Very useful contribution, by the way, if I can just get it to work the way I need it.

 

1. The quantity input box in the product listing page doesn't seem to carry over to the cart. You enter '3' in the quantity, hit "add to cart" and it adds 1. Any ideas?

 

2. This is asking a bit much but here goes. Let's say for each product, I have 3 options (small, medium and large). Someone orders 2 small, 2 medium and 2 large of the same product. Let's say my first price break is at 5 units. They've bought 6 units but don't get the price break (it shows up in the cart as 3 line items which is correct but the quantity discount isn't recognized). Is there a way to reconcile all the options of the same product ordered to calculate the correct price break?

 

Thanks in advance for any advice offered.

 

I am with 1Putts.... Is there any one who could help with this script? I have looked at the code and know what I would like it to do, but I am not a programmer.

 

"Let's say for each product, I have 3 options (small, medium and large). Someone orders 2 small, 2 medium and 2 large of the same product. Let's say my first price break is at 5 units. They've bought 6 units but don't get the price break (it shows up in the cart as 3 line items which is correct but the quantity discount isn't recognized). Is there a way to reconcile all the options of the same product ordered to calculate the correct price break?"

 

In PriceFormatter. there is a function computePrice that returns the price to be used in the shopping cart. It decides between the quantity ordered and if there's a Special price set (which ever is lower). I would like to get the quantity ordered to reflect the total amount of the product ordered in the cart regardless of attribute. The problem I have is that the product_id stored in the customers_basket also has the products_attributes appended to it, so if I do a SQL query on one of the products product_ids I am not going to get the data I need.

 

Singularity

-----------------------------------------------------------------------------

Adam

 

Get your osc documentation here:

http://www.oscommerce.info/

Link to comment
Share on other sites

I'm playing around with this Quantity Price Breaks Per Product contribution:

http://www.oscommerce.com/community/contributions,1242

 

...and I have a few questions that hopefully someone can help me with. Very useful contribution, by the way, if I can just get it to work the way I need it.

 

1. The quantity input box in the product listing page doesn't seem to carry over to the cart. You enter '3' in the quantity, hit "add to cart" and it adds 1. Any ideas?

 

 

Did you make sure you changed the product_info.php page to have this:

 

 At the top under the query call:

  $pf->loadProduct((int)$HTTP_GET_VARS['products_id'], (int)$languages_id);
   $products_price=$pf->getPriceString();

and also replace the original quantity field to this:

<?php echo tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="6"'); ?>

 

That's the only thing I can think of, can you post your product_info.php file?

Link to comment
Share on other sites

"Let's say for each product, I have 3 options (small, medium and large). Someone orders 2 small, 2 medium and 2 large of the same product. Let's say my first price break is at 5 units. They've bought 6 units but don't get the price break (it shows up in the cart as 3 line items which is correct but the quantity discount isn't recognized). Is there a way to reconcile all the options of the same product ordered to calculate the correct price break?"

 

As is, not that I know of. I built my own price-breaks solution for attributes that I needed however, and it's not impossible to alter the price calculation code to do this. However, it is going to take some effort.

 

The main file you'll have to modify is catalog\includes\classes\shopping_cart.php, to alter the mods that price_breaks had you do already to take this new scheme into account.

 

However, the effort involved in doing this is a little more than I want to spend here ... but feel free to PM me :)

Link to comment
Share on other sites

OK, if anyone else stumbles across this thread.... I am moving to Zen-cart! The folks here at OSC are very helpful, but in this case there just wasn't a quick solution! Lucky for me I have a new store, so I can make a big change like this with minor consequences.

-----------------------------------------------------------------------------

Adam

 

Get your osc documentation here:

http://www.oscommerce.info/

Link to comment
Share on other sites

Hi I recently installed this contribution and it looks like its gonna do what I've been looking for, which is give my customers the option of getting quantity/bulk discounts.

 

I did run into a problem however, was hoping someone can help me out.

 

When I try to place something into the shopping cart I get this error.

 

Fatal error: Call to undefined function: generate_cart_id() in /var/www/html/catalog/includes/classes/shopping_cart.php on line 114

 

When I look at this line it is:

 

// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure

$this->cartID = $this->generate_cart_id();

 

I'm not a programmer so I'm not sure where to start.

 

Can someone help me out?

 

Thanks

Link to comment
Share on other sites

  • 1 month later...
I'm playing around with this Quantity Price Breaks Per Product contribution:

http://www.oscommerce.com/community/contributions,1242

 

2. This is asking a bit much but here goes. Let's say for each product, I have 3 options (small, medium and large). Someone orders 2 small, 2 medium and 2 large of the same product. Let's say my first price break is at 5 units. They've bought 6 units but don't get the price break (it shows up in the cart as 3 line items which is correct but the quantity discount isn't recognized). Is there a way to reconcile all the options of the same product ordered to calculate the correct price break?

 

Hi,

I added some code to my site that seems to accomplish what you are asking. The price_break contribution adds two calls to $pf->computePrice with quantity as the argument. I wrote a function to add up the quantity of all products in the cart with the same true product id (attributes change the product id's by adding the attributes to the end of the product id - this function ignores the extra code and just uses the true product id).

 

1 program to modify: catalog/includes/classes/shopping_cart.php

 

Here's the function (which I added directly under function get_quantity)

// custom function to get total quantity for the true product id
// instead of counting product id's with attributes as separate products
function get_prid_qty($contents,$uprid){
  $products_qty=0;
  if (is_array($contents)) {
       reset($contents);
       while (list($products_id, ) = each($contents)) {
          if(tep_get_prid($uprid)==tep_get_prid($products_id))
             $products_qty += $contents[$products_id]['qty'];
       }
  }
  return $products_qty; 
}

then search the same program for 

1.  $products_price = $pf->computePrice($qty);
and replace with
    $products_price = $pf->computePrice($this->get_prid_qty($this->contents,$prid));

2.  $products_price = $pf->computePrice($this->contents[$products_id]['qty']);
and replace with
    $products_price = $pf->computePrice($this->get_prid_qty($this->contents,$products_id));

I tested this in my cart and it seems to be working the way I want it to but use at your own risk. It does not change the true quantity - it only uses the custom quantity when determing the product price. Your cart will still show the items with their attributes as different line items in the cart.

 

HTH

Link to comment
Share on other sites

  • 2 weeks later...
<code deleted>

I tested this in my cart and it seems to be working the way I want it to but use at your own risk.  It does not change the true quantity - it only uses the custom quantity when determing the product price. Your cart will still show the items with their attributes as different line items in the cart.

 

HTH

 

I just noticed your follow up to this thread...I added your code, tested it and it works brilliantly. Thanks so much, it's a terrific addition...well done!

Link to comment
Share on other sites

Hi,

 

I also got janz's contrib price break installed ~ but I wanna take it even a bit further then 1Putts and Julinhamp.

 

I need a overal price break :s for each category :s

 

 

Ex.

 

this is your total:

 

20 x Product A (category GC) Attrib b

10 x Product A (category GC) Attrib c

30 x Product C (category GC)

20 x Product F (category K)

40 x Product G (category K)

 

So I now would like a price break when your over 50 products in a category you get discount :s

 

IS this even posible??

 

To get it even more complicated: how about The Quantity: i need two different prices on them. A normal price who will be counted for products ordered in the quantity given in - and a price for customers who get under that amount.

 

Ex.

 

Products is packed in packs of 50.

You are still able to order products by one.

So, for ex. you order 75 x Products A you get 50 at normal prices + 25 at a bit more price.

 

:S

Maybe that last one was asked to much?

 

Anyway,

I need this to work, but have no idea where to start.

Greets,

Tom Maene

Even in this dark place, yes, I am afraid of my own shadow.

 

 

 

Contributions | KnowledgeBase | osCommerce 2.2 pdf

Link to comment
Share on other sites

I just noticed your follow up to this thread...I added your code, tested it and it works brilliantly. Thanks so much, it's a terrific addition...well done!

 

Hello,

 

This seems to do what I am looking for. I have a question, is this adding all the total QTY of all the products in the cart then giving a discount.

 

If i read this right, it sounds like it is adding a discount to groups of products? If so, how are you grouping?

 

Perhaps you can help me with what I am doing,

 

I am selling apples and oranges. My apples, (I have over 1000 types) have one type of quantity discount applied to it, ie, 10 apples get 1% disc. 20 get 2% disc. The Oranges have another discount applied (I have 2000 types of oranges) but 10 oranges get .5 disc and 20 get 1%.

 

How would you set this up?

 

Thanks!!!!

Link to comment
Share on other sites

Hello,

 

This seems to do what I am looking for. I have a question, is this adding all the total QTY of all the products in the cart then giving a discount.

 

If i read this right, it sounds like it is adding a discount to groups of products? If so, how are you grouping?

Thanks!!!!

 

Hi,

I don't think my code snippet above will do what you are looking for. It isn't truly adding a discount to a group of products. The only thing it groups together is the same product that appears to be a different product due to it's attributes. Example. You have 12 items in the cart (2 are oranges but the other 10 are the same product but you have added some of them to the cart with different attributes so they may appear in the cart on separate lines as such):

 

3 apple

---green

3 apple

---red

---mixed

3 apple

---red

---macs

1 apple

2 oranges

 

In this case above - as long as the "apple" above was really the same product (same product id) and you wanted to give a discount to them if they ordered 10 apples whether or not they were all the same color or type then you would want to add my code snippet above since it will ignore the attributes and just look at the product id to sum up how many of that product id are in the cart. So, the code would see 10 apples and give a discount on apples but only 2 oranges so no discount on oranges.

 

The original Qty discount contribution sees each of the entries above as a different product and no discount would be given since there isn't 10 of anything in the cart (in some cases this is desirable because you may not be able to give a discount to someone since the change of an attribute may mean that you can't get "bulk" pricing yourself).

 

I hope I answered your question - If you have thousands of apples it sounds like they are all individual products and this won't help you.

Link to comment
Share on other sites

julin

 

Thank you, I played with you code and your right, it is not what I am looking for.

 

Listen, You seem to be very skilled in this area. The fact you were able to write code is 1 billion times better then me.

 

All I want is to be able to to a bulk discount, and have it show the new sum (discounts) in the subtotal field. I saw the other Global Discount contrib. and it works very well, but the customer will not see the discount untill he is at the check out.

 

Since you understood this code, can you do this?

 

Take that Global Discount contrib. and allow it to show us the new subtotal in the subtotal field, instead of the total field?

 

or, take this current contib, and add a feature where it will add all the QTY in the cart and give it a global discount? I like how this contrib allows the customer to see the new price in the Subtotal that way we can keep those customers who are looking to buy products but they have a budge to see how much they spent with out having to go to the check out.

 

:thumbsup:

Link to comment
Share on other sites

julin

......

Since you understood this code, can you do this?

 

Take that Global Discount contrib. and allow it to show us the new subtotal in the subtotal field, instead of the total field?

 

or, take this current contib, and add a feature where it will add all the QTY in the cart and give it a global discount? I like how this contrib allows the customer to see the new price in the Subtotal that way we can keep those customers who are looking to buy products but they have a budge to see how much they spent with out having to go to the check out.

 

:thumbsup:

 

Sorry,

Don't think I'm going to be much help. I'm in the middle of coding several projects right now and having to file my taxes isn't helping matters. One of the projects I had to code was this contribution but it needed to be modified in a way that someone else on this board was also asking for and since I've gotten so much help from these boards I wanted to make sure to give back by posting what I did. If you have the current contribution, with my code installed and removed the if(tep_get_prid($uprid)==tep_get_prid($products_id)) line from the function then it I think it should sum up the quantity of ALL products in your cart and return that quantity to get the discount. So if you have that line removed and you have 20 products in your cart, it would then look for the price that each one of the products has for qty 20+. I would think something like that would be better done on a global level with the other contribution than a per product level but I guess it would depend on the type of products you are carrying.

 

If you already have qty price break and my code installed it might be worth trying to remove that one "if" statement and give it a test drive and see if it does what you want but my code above doesn't change any prices - that's the original qty contribution that does that. All my code does is adjust the quantity that gets passed to the function that computes the qty price break.

 

Good Luck...Julie

Link to comment
Share on other sites

I have installed price-break contribution and it seems to work ok, just not in the way I need it to.

 

I want to be able to apply volume discounts by percentage as opposed to flat rate.... for example:

 

Buy 1 T-Shirt for ?10

Buy 2 and save 10% i.e. ?18

 

This way, discounts are calculated on my base price as a percentage rather than a fixed amount off the base price.

 

Any help appreciated!

 

Amar

Link to comment
Share on other sites

I have installed price-break contribution and it seems to work ok, just not in? the way I need it to.

 

I want to be able to apply volume discounts by percentage as opposed to flat rate.... for example:

 

Buy 1 T-Shirt for ?10

Buy 2 and save 10% i.e. ?18

 

This way, discounts are calculated on my base price as a percentage rather than a fixed amount off the base price.

 

Any help appreciated!

 

Amar

 

Do you need to do this on a product by product level, or can you apply this on a global level?

Edited by pura vida
Link to comment
Share on other sites

  • 2 weeks later...

Hello,

i want to install "Replying to Quantity Price Breaks Per Product Question" to my oscommerce but in the zip pacikage there isn't install.txt( manualy instructions ) - so for people like me whose osc files are modified befor for another contributions and cannot just replase the files - to edit the files manualy. Can somebody give me this instructions?

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...