0

I'm trying to rewrite the getCheckoutUrl() functions in

Mage/Checkout/Blocks/Onepage/Link.php

and

Mage/Checkout/Helper/Url.php

but the rewrites don't seem to work.

My config.xml file contains the following:

...
<global>
    ...
    <blocks>
        <stores>
            <class>Zzyzzx_Stores_Block</class>
        </stores>
        <checkout>
            <rewrite>
                <onepage_link>Zzyzzx_Stores_Block_Link</onepage_link>
            </rewrite>
        </checkout>
    </blocks>
    <helpers>
        <stores>
            <class>Zzyzzx_Stores_Helper</class>
        </stores>
        <checkout>
            <rewrite>
                <url>Zzyzzx_Stores_Helper_Url</url>
            </rewrite>
        </checkout>
    </helpers>
    ...
</global>
...

Everything else defined in the ocnfig seems to be working fine, only the rewrites don't seem to.

the block rewrite refers to my file

.../app/code/community/Zzyzzx/Stores/Block/Link.php

which contains:

class Zzyzzx_Stores_Block_Link extends Mage_Checkout_Block_Onepage_Link
{
    function getCheckoutUrl()
    {
        //my changes
    }
}

the helpers rewrite refers to

.../app/code/community/Zzyzzx/Stores/Helper/Url.php

which contains:

class Zzyzzx_Stores_Helper_Url extends Mage_Checkout_Helper_Url
{

    function getCheckoutUrl()
    {
        //my changes
    }

}

with the helper, I am able to directly access the function with Mage::helper("stores/url")->getCheckoutUrl(); but the rewrite doesn't work.

Where am I going wrong? How do I get my rewrites working?

3
  • the code looks ok to me. Check if your config.xml is picked up. modify it so it will have an error (unclosed tag for example) and see if you get an error in the page. Also a common mistake can be in the declaration file app/etc/modules/Zzyzzx_Store.xml. Make sure you have <codePool>community</codePool> and not <codepool> as tag or local as value.
    – Marius
    Jun 10, 2015 at 11:58
  • possible duplicate of Fundamentals for debugging a Magento store Jul 16, 2015 at 13:40
  • Please verify that your extension's config is being merged.
    – benmarks
    Jul 16, 2015 at 16:19

1 Answer 1

1

Read the long article about debugging

Make sure your module.xml is loaded, by activating dev mode and then breaking the XML, so you see a simplexml_error, if this is the case break the config.xml to get the same error.

If these two files are loaded, make sure, that the two classes are used, xdebug is your friend get_class is the alternative.

If this all works, check the method names.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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