Magento 1: Get Final Price of Configurable Associated Product

Here I will show you how we can get the final price of an associated product which is associated with a configurable product.

<?php
$product        = Mage::getModel('catalog/product')->load(357); //configurable product
$optProduct     = Mage::getModel('catalog/product')->load(282); //associated simple product
$confAttributes = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
$pdtOptValues   = array();
foreach ($confAttributes as $attribute) {
    $attrCode    = $attribute['attribute_code'];
    $attrId      = $attribute['attribute_id'];
    $optionValue = $optProduct->getData($attrCode);
    $pdtOptValues[$attrId] = $optionValue;
}
$product->addCustomOption('attributes', serialize($pdtOptValues));
echo $product->getFinalPrice();

Here above code is very simple to understand. Basically we have instances of both configurable product and associated product. Now we need to add Attribute Custom Options in configurable product instance in order to correctly retrieve the final price of associate product.

For that, we are looping through configurable attributes and prepare attribute options corresponding to the associated product (see the foreach loop section) and then add that information to configurable product ($product->addCustomOption()).

That’s it.

Rajeev K Tomy

15,236 thoughts on “Magento 1: Get Final Price of Configurable Associated Product

  1. Pingback: 2address
  2. Prescription Drug Information, Interactions & Side. Comprehensive side effect and adverse reaction information.
    ivermectin price
    Get here. Prescription Drug Information, Interactions & Side.

  3. drug information and news for professionals and consumers. Some are medicines that help people when doctors prescribe.
    https://lisinopril.science/# lisinopril 20 mg brand name
    Comprehensive side effect and adverse reaction information. earch our drug database.

  4. Get warning information here. Prescription Drug Information, Interactions & Side.
    https://nexium.top/# can i buy cheap nexium without prescription
    Get here. drug information and news for professionals and consumers.

  5. Comprehensive side effect and adverse reaction information. Medicament prescribing information.
    https://clomiphenes.online where can i buy cheap clomid without a prescription
    What side effects can this medication cause? Top 100 Searched Drugs.

  6. Great blog here! Additionally your website rather a lot up very fast! What host are you the usage of? Can I get your associate link for your host? I desire my website loaded up as fast as yours lol

  7. Im impressed. I dont think Ive met anyone who knows as much about this subject as you do. Youre truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog youve got here.

  8. Cool. I spent a long time looking for relevant content and found that your article gave me new ideas, which is very helpful for my research. I think my thesis can be completed more smoothly. Thank you.

  9. Can I just say what a relief to seek out someone who actually knows what theyre speaking about on the internet. You positively know find out how to bring a problem to mild and make it important. Extra individuals have to read this and perceive this side of the story. I cant believe youre not more in style because you positively have the gift.

  10. Hi there! I just wanted to ask if you ever have any trouble with hackers? My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to no back up. Do you have any solutions to protect against hackers?

  11. Beneficial Blog! I had been simply just debating that there are plenty of screwy results at this issue you now purely replaced my personal belief. Thank you an excellent write-up.

  12. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here It’s always nice when you can not only be informed, but also entertained I’m sure you had fun writing this article.

  13. Hello there I am so delighted I found your weblog, I really found you by mistake, while I was searching on Google for something else, Anyhow I am here now and would just like to say cheers for a remarkable post and a all round exciting blog (I also love the theme/design), I don’t have time to browse it all at the moment but I have book-marked it and also included your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the superb work.

  14. My brother suggested I might like this websiteHe was once totally rightThis post truly made my dayYou can not imagine simply how a lot time I had spent for this information! Thanks!

  15. Sweet blog! I found it while browsing on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Thank you

  16. Nice blog here! Also your web site loads up very fast! What host are you using? Can I get your affiliate link to your host? I wish my web site loaded up as fast as yours lol

  17. Borrowers who are considering a payday advance should be aware of the potential influence on their credit standing and financial well-being, and will only borrow what they are able to afford to. https://sites.google.com/view/loans-info/online-payday-loans-canada Some payday lenders may need borrowers to provide collateral or a co-signer to be able to secure the credit, which may make it hard for some borrowers to qualify. Some payday lenders might require borrowers to offer a copy of the visa or another immigration documentation in order to approve the money. Borrowers who will be considering a cash advance should carefully review the conditions and terms of the money, including any prepayment penalties or other fees. Payday loans could be more expensive for borrowers that have no other supply of income, as lenders may view them like a higher risk for default. Some employers may offer salary advances or other forms of emergency assistance to employees in financial need. Some payday lenders may offer loans to borrowers with a low credit score, but these financing options may come with very high rates and fees. Payday loans can be an extremely expensive method to borrow money, and borrowers should look into other options, such as personal loans or cards, before taking out a payday loan. https://sites.google.com/view/loans-info/no-refusal-payday-loans-canada Some lenders may report payday cash advances to credit bureaus, potentially damaging the borrower’s credit score and so that it is more difficult gain access to credit in the foreseeable future. Borrowers must be cautious of payday lenders who make promises that seem too good to be real, like guaranteed approval or instant cash. Some payday lenders may need borrowers to deliver a copy with their passport and other government-issued identification to be able to approve the loan. Borrowers who will be considering a payday advance should be alert to the potential consequences of default, including law suit and damage with their credit score. Some payday lenders may offer rollover or extension options, which permit borrowers to supply the repayment period of the credit in exchange for extra fees and interest. Borrowers that are considering a cash advance should carefully review the terms and conditions of the credit, like the interest rate, fees, and repayment terms. Payday loans could possibly be more expensive for borrowers who’ve a history of bankruptcy or any other financial difficulties, as lenders may view them being a higher risk for default. Borrowers who’re considering a payday loan should review their budget and ensure that they can afford to repay the credit on time. Payday loans might be more expensive for borrowers who’ve no additional options for borrowing money, like family or friends.

  18. This is my first time i visit here. I found so many helpful stuff in your website especially its discussion. From the tons of responses on your posts, I guess I am not the only one having all the enjoyment here! keep up the excellent work

  19. This is my first time i visit here. I found so many helpful stuff in your website especially its discussion. From the tons of responses on your posts, I guess I am not the only one having all the enjoyment here! keep up the excellent work

  20. I think I will become a great follower.Just want to say your post is striking. The clarity in your post is simply striking and i can take for granted you are an expert on this subject.

  21. An impressive share, I just given this onto a colleague who was doing a little analysis on this. And he in fact bought me breakfast because I found it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to discuss this, I feel strongly about it and love reading more on this topic. If possible, as you become expertise, would you mind updating your blog with more details? It is highly helpful for me. Big thumb up for this blog post!

  22. I received my bags yesterday. This is the first time ordering shoes from this website and I am definitely satisfied with them. actually I would give this website a 20 on a scale from 1-10 and would certainly recommend this site to all. prefer the I will definitely be purchasing more items in the future. either way It has been a pleasure.

  23. I received my jordans yesterday. This is the first time ordering shoes from this website and I am definitely satisfied with them. or I would give this website a 20 on a scale from 1-10 and would certainly recommend this site to all. for example I will definitely be purchasing more items in the future. in any event It has been a pleasure.
    cheap jordan shoes https://www.cheapretrojordansshoes.com/

  24. I received my jordans yesterday. This is the first time ordering shoes from this website and I am definitely satisfied with them. or possibly a I would give this website a 20 on a scale from 1-10 and would certainly recommend this site to all. prefer the I will definitely be purchasing more items in the future. regardless It has been a pleasure.
    cheap jordans for sale https://www.realcheapretrojordanshoes.com/

  25. Pingback: blackhatlinks.com
  26. This site is the truth. I’m always on checking release dates, but I never bought from this site. or a A lot of people said good things, so I ordered a pair and they were delivered to my door before I could even buy clothes to go with the sneakers. as good as the Very fast shipping. you ultimately choose You guys have a loyal customer.
    cheap real jordans https://www.realcheapjordan.com/

  27. Hello there, just became aware of your blog through Google, and found that it is truly informative. I am going to watch out for brussels. I will appreciate if you continue this in future. Lots of people will be benefited from your writing. Cheers!