1

I am having troubles overriding one of magento's core blocks.

The one I am interested with is Wishlist. Module's default location is app/Core/Mage/Wishlist. I tried following the instructions I've been given here by @Marius, but my block class still doesn't fire up.

I can clearly see in Administration panel that my module is Enabled, so it must be some kind of typo in my configuration.

My entire config.xml file has the following structure:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Acme_Demo>
            <version>1.0</version>
        </Acme_Demo>
    </modules>
    <global>
        <blocks>
            <wishlist>
                <rewrite>
                    <customer_wishlist>Acme_Demo_Block_Wishlist</customer_wishlist>
                </rewrite>
            </wishlist>
        </blocks>
    </global>
</config>

My configuration file in etc/modules

<Acme_Demo>
        <active>true</active>
        <codePool>local</codePool>
        <depends>
            <Mage_Wishlist />
        </depends>
</Acme_Demo>

I only need to override the _prepareLayout() method in my block, so it's a really basic class.

<?php

class Acme_Demo_Block_Wishlist extends Mage_Wishlist_Block_Customer_Wishlist {

    protected function _prepareLayout() {
        var_dump('I am loaded');
    }

}

But magento still loads the default Mage_Wishlist_Block_Customer_Wishlist. So I would really appreciate if anyone tells me what did I messed up?

-Update-

A bit more info - whatever I try do about this block class only, it does not get executed. I've succesfuly tried to override random parts of Wishlist module - for example Wishlist/Model/Item.php. Cache is cleared everytime I update my files. I have no idea what is going on here.

  • can you post your config.xml ? – Keyur Shah Jun 1 '15 at 10:24
  • @KeyurShah I've added my missing config nodes as well as my module configuration. – user26123 Jun 1 '15 at 11:13
  • 1
    just check wthr this block is already overriden by someone or check wther any one had put the same block file into the local in the same path as the core – Pradeep Sanku Jun 1 '15 at 14:06
  • i think block is already overriden by another extension ,,,,just run this script to check magento.stackexchange.com/questions/1594/… – Keyur Shah Jun 2 '15 at 4:50
  • Absolutely right! There was an extra file that somehow I missed and was causing the problem because it was overriding different part of the Wishlist module. Although there wasnt any listed conflict, the script helped me to look further. My problem is solved, so feel free to add this as an answer if you like. – user26123 Jun 2 '15 at 6:33
0

Did u check in you exception and system log?also you can enable developer mode to find if there is any error are being thrown.If everything looks good try to override another method and check.

  • Exception log does not display errors related to that block. Also I've copy/pasted the entire block class and nothing happens. – user26123 Jun 1 '15 at 13: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.