Saturday, 24 August 2013

Magento - How to get pricing_value for Super Attribute Option

Magento - How to get pricing_value for Super Attribute Option

Somehow I can't figure out how to get the pricing values for a
configurable product's super attribute options.
Currently I have an array of attribute id and attribute option id which
looks like this:
2013-08-24T15:35:01+00:00 DEBUG (7): Array Combination :Array
(
[135] => 3
[139] => 19
[138] => 6
[140] => 20
[141] => 22
[142] => 24
[143] => 26
[144] => 28
[145] => 34
)
Now I want to calculate the total price for the configurable product with
all the super attributes additional prices added.
I spend hours looking through the configurable product templates and
javascript and still haven't figured out how the new price is calculated.
Through this link
http://www.ayasoftware.com/content/magento-update-fly-super-product-attributes-configuration
I figured out how to get the configurable options for my product. The data
also contains a field "price_value" for each attribute option, but I
totally don't know how to simply access the right object values.
I would love to just do something like:
$price = $configurableProductBasePrice;
foreach ($attributeCombination as $attribute => attributeOption)
{
$attributeOptionPrice =
$attribute->getAttributeOption($attributeOption)->getPrice();
$price = $price + $attributeOptionPrice;
}
Thanks in advance for every hint :)

No comments:

Post a Comment