Magento Tier Prices for Configurable Products

The way Magento handles tier prices related to configurable products is a little bit strange. Assuming we have a basic T-Shirt which is available in red and blue and normally costs 10 Euro. If you purchase 10 or more shirts, the price is only 9 Euro. I (and many others of you out there, too!) would expect to get the cheaper price if you buy e.g. 6 blue and 4 red shirts. Anyways, this is not the case in Magento. In order to achieve this behaviour, the guys from Tridian wrote a nice piece of code. Unfortunately, it seems to be old and unsupported. So I updated the script to Magento 1.4.1.1 and removed a little bug. The script from Tridian works fine for configurable products that have tiering prices. Sadly, there are problems with configurable products that do not have tier prices but a special price. In my version below, this bug is fixed.

Basically, the module rewrites the class Mage_Catalog_Model_Product_Type_Configurable_Price and the method getFinalPrice($qty=null, $product) in that class. If the given product has tiering prices configured, the new method calcConfigProductTierPricing($product) is called. This method generally does the following:

  1. gets all items from the quote
  2. iterates over all these items
  3. creates an array mapping the sku of the current item to the quantity
  4. gets the entry at the base products sku
  5. sums up all quantities
  6. calculates the tier price with the computed quantity and the parent product

The reason why this does the job is that the items collection in the quote has instances of the parent and the child product.

UPDATE March 12, 2012:
The above information explaining how the extension works is outdated. The extension development has been moved to GitHub. You can also download the latest version from there. Anyway, the extension is also available on Magento Connect.

If you use and like the extension, I am happy to read your comment or message.
If you have any problem with the extension, please open an issue on GitHub.

38 Gedanken zu „Magento Tier Prices for Configurable Products“

  1. I fixed one bug:

    if($product->getTierPriceCount() > 0) {
    $tierPrice = $this->calcConfigProductTierPricing($product);
    if($tierPrice < $finalPrice)
    $finalPrice = $tierPrice;
    }
    if($tierPrice this condition resolve lower special price then tier price.

  2. Good extension.

    But i have a problem when configurable product haven’t tier price and attribute have a lower price (ex -10$). So the price in cart isn’t good.
    To fix my bug i have modified the code in getFinalPrice function :
    New code :
    $product->setFinalPrice($basePrice);
    Old code :
    $product->setFinalPrice($finalPrice);

    Sorry for my english, i’m french !!

    1. Thanks for your feedback. Unfortunately, I do not exactly understand the problem, so that I am not able to reproduce it. Anyway, if more of you have this problem, just explain it again and I will fix it.

  3. This looks like the thing I am missing. It works perfectly for me.
    Is it possible to add a line to make notice on the discount?
    Like “ Normal price xx.xx quantity discount xx.xx“?

    1. I think this is not an easy task. You will have to extend the price template under app/design/frontend/interface/theme/template/catalog/product/price.phtml…
      Sorry, but I do not have the time to dig deeper into the topic right now…

  4. An excellent extension. Very needed.

    I am on 1.6.1 and i am wondering how i get this to work. I have manually copied all the files to their respective directories as they are in the zip file. Do i need to do anything more because it is not working as planned.

    1. I tested this extension only up to Magento 1.5.1.0. Until end of January, I do not have the time to fix it for 1.6.1.0, but I will definitely have a look at it then. If anyone else finds the problem, feel free to share 🙂

          1. There is ONE line that is new in the 1.6.1 version, compared with 1.5.1. It is inserted in line 67.
            $product->setParentId(true);

            That is it. Any ideas?

  5. I installed this module on Magento 1.4.2 and it does the job perfectly. It has improved the shopping experience for my customers and may have increased sales as well. Thank you very much for making it available to us!

    But I am experiencing a strange problem with configurable product pricing, and I need to know whether this module is the problem or whether the problem is with Magento 1.4.2.

    Let’s say I have a configurable product with two sizes: Small & Large. I set the Large size to be $5 more (+5$). This displays on the product page.

    When I put the Large size into the shopping cart, it doubles the additional cost. So instead of being $5 more than the Small size, it becomes $10 more once it’s in the cart.

    It works for negative pricing too. Now, let’s say the Small size is $2 less (-$2). When you put the Small size into the shopping cart, the price becomes $4 less.

    So it multiples the variable pricing (+/- amount) by a factor of 2. I have searched for hours on the Internet to see if this is a problem with Magento 1.4.2. I haven’t found any reference to this problem so now I wonder if it is caused by this module.

    Do you know if this problem is possibly caused by the module? How could I temporarily disable your Spranks module so that I can test if it is the problem or not?

    Thanks in advance for your advice.

    1. Open the file app/etc/modules/Spranks_ConfigurableTierPrices.xml, change the “true” to “false” and refresh the cache. Then, check if the problem still exists.
      I can not imagine that my module causes this issue, but who knows…

      1. I followed your directions and I’ve confirmed that the problem is caused by the Spranks module.

        First, I disabled the Spranks module and then tested the variable pricing for a configurable product. It worked perfectly (as normal.)

        When I enabled the Spranks module again, the problem came back. Basically, the Spranks module will double any variable pricing (+/- price) for configurable products.

        Can you provide a fix for this problem?

          1. I understand how busy you can get as a programmer, and I appreciate your hard work and effort. I’ll look forward to seeing the fix for this problem, when you get the chance to work on it. Thanks!

  6. Callum – we noticed the same thing on our site. After some detective work, we determined that it was only happening to products that had no tiers. So, for the time being, what we did was just add tiers to any configurable products without them, and that solved the problem for us until a proper fix can be made.

    1. Matt, thanks for the info. That’s an interesting discovery, but in my case, all my configurable products already have tiers … so this won’t work for my installation (1.4.2). =(

      1. Sorry I couldn’t have been more helpful, mate. We are running a different installation (1.9.1) so I’m sure that plays into it. We’ve since switched to a new module because we need tiers across both configurable and grouped products.

        Good luck to you!

  7. Hi, I installed the extension (I am running 1.7) but something happened to my product prices index. I get the error, cannot run indexor after I installed. Can you please provide a suggestion to help me fix it?

    Thanks

    1. Hi Ravi,

      I am sorry, but I do not have a glue which problem you have. It is quite unlikely that it has something to do with my extension. Anyway, if you really think it is a problem with my extension, open a bug with a detailed bug description on Github.

      Cheers
      Simon

    1. I plan to implement this as a paid extension for Magento 2. Unfortunately, this is much more complicated in M2 due to new pricing and admin features. I do not have any idea when I will be able to implement it.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert