1

I have a block that I have overwritten but it doesn't seem to work. I saw a guide on the web and it didn't seem that difficult, but I can't seem to get it to work properly.

It's just using default - here is some code :o)

etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Namespace_Bundle>
            <version>0.1.0</version>
        </Namespace_Bundle>
    </modules>

    <global>
        <blocks>
            <catalog>
                <product>
                    <view>
                        <type>
                            <bundle>
                                <rewrite>
                                    <option>Namespace_Bundle_Block_Catalog_Product_View_Type_Bundle_Option</option>
                                </rewrite>
                            </bundle>
                        </type>
                    </view>
                </product>
            </catalog>
        </blocks>
    </global>
</config>

I've created the class

class Namespace_Bundle_Block_Catalog_Product_View_Type_Bundle_Option extends Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option{

    public function getSelectionTitlePrice($_selection, $includeContainer = true){

        return 'TEST';

    }

}

Namespace_Bundle.xml

<config>
    <modules>
        <Namespace_Bundle>
            <active>true</active>
            <codePool>local</codePool>
        </Namespace_Bundle>
    </modules>
</config>

I've checked to see that the module is active and it is.

UPDATE

Altered the config.xml to:

<rewrite>
    <product_view_type_bundle_option>Namespace_Bundle_Block_Catalog_Product_View_Type_Bundle_Option</product_view_type_bundle_option>
</rewrite>

UPDATE 2

Altered the module name to MyBundle instead - still no difference

UPDATE 3

Was not calling the right module / file

1

It's not the right way of overriding a block, your config.xml should look like this:

<?xml version="1.0"?>
<config>
    <modules>
        <Namespace_Bundle>
            <version>0.1.0</version>
        </Namespace_Bundle>
    </modules>

    <global>
        <blocks>
            <catalog>
                <rewrite>
                    <product_view_type_bundle_option>Namespace_Bundle_Block_Catalog_Product_View_Type_Bundle_Option</product_view_type_bundle_option>
                </rewrite>
            </catalog>
        </blocks>
    </global>
</config>
8
  • To complete @Digital Pianism answer you can find a tutorial how to override Core files by Inchoo : inchoo.net/magento/… Jan 21 '16 at 14:30
  • I already tried that and it doesn't seem to work either... Jan 21 '16 at 14:43
  • That means you've probably another module rewriting the same block. Disable all non Magento modules and try again. Jan 21 '16 at 14:46
  • I have now disabled all module except Mage_ and it is still not working. Jan 21 '16 at 14:50
  • 1
    Try naming your module with a non Magento module name: e.g. Mybundle instead of Bundle. Are your modules files sitting under app/code/local ? Jan 21 '16 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.