Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Small patch attribute options json config event
 
hesselbom
Jr. Member
 
Avatar
Total Posts:  1
Joined:  2011-11-27
 

This is a very small change, but would help immensely if patched.

When Magento is generating super attribute prices on frontend with the method Mage_Catalog_Block_Product_View_Type_Configurable::getJsonConfig() it dispatches the following event (with surrounding code):

foreach ($prices as $value{
    
if(!$this->_validateAttributeValue($attributeId$value$options)) {
        
continue;
    
}
    $currentProduct
->setConfigurablePrice(
        
$this->_preparePrice($value['pricing_value']$value['is_percent'])
    );
    
$currentProduct->setParentId(true);
    
Mage::dispatchEvent(
        
'catalog_product_type_configurable_price',
        array(
'product' => $currentProduct)
    );
    
$configurablePrice $currentProduct->getConfigurablePrice();

...
Now, this isn’t much help when observing that event. You only get the product as a parameter but not the attribute. So how can you set the configurable price without knowing what attribute value it’s currently generating a price for?

My proposed patch is to send the following array as parameters instead (adding ‘price_value’ so you get attribute value information):

array('product' => $currentProduct'price_value' => $value)

What do you think?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top