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

How do I overload a function within a magento class? 
 
seans
Jr. Member
 
Total Posts:  4
Joined:  2008-09-04
 

When you have a bundle product, the options the user selects to configure the product, do not show a sku for each option.

I would like to have the product sku beside the product title and I have achieved this by directly modifying the class (located at: /app/code/core/Mage/Bundle/Catalog/Product/View/Type/Bundle/Option.php) My modified function is shown below.

public function getSelectionTitlePrice($_selection$includeContainer true)
    
{                      
        $price 
$this->getProduct()->getPriceModel()->getSelectionPreFinalPrice($this->getProduct(), $_selection1);
        return 
$_selection->getSku() . '&nbsp;' $_selection->getName() . ' &nbsp; ' . ($includeContainer '<span class="price-notice">':'') . '+' .
            
$this->formatPriceString($price$includeContainer) . ($includeContainer '</span>':'');
    
}

This works just fine and accomplished my goal but now I need to find a way to overload the fucntion so that im not modifying magento souce and so that I can enjoy regular updates.

This tutorial looked very promising but I still seem to be missing something
http://labs.justsearching.co.uk/magento-class-overloading-updateproof-hack-47.html

Could someone please direct me in the right direction to make this into a module that overloads the above function?

Thanks!

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