2

I've some troubles while trying to override a Enterprise Adminhtml's block.

Here is the Block that I want to override :

app/code/core/Enterprise/Reward/Block/Adminhtml/Customer/Edit/Tab/Reward/Management/Upgrade.php

Here is the top of my config.xml :

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Myself_Reward>
            <version>0.1.0</version>
            <depends>
                <Enterprise_Reward/>
            </depends>
        </Myself_Reward>
    </modules>
    <global>
        <blocks>
            <adminhtml>
                <enterprise_reward>
                    <rewrite>
                        <customer_edit_tab_reward_management_update>Myself_Reward_Customer_Edit_Tab_Reward_Management_Update</customer_edit_tab_reward_management_update>
                    </rewrite>
                </enterprise_reward>
            </adminhtml>
        </blocks>

And the file I've created : app/code/local/Myself/Reward/Block/Adminhtml/Customer/Edit/Tab/Reward/Management/Update.php :

class Myself_Reward_Customer_Edit_Tab_Reward_Management_Update
extends Enterprise_Reward_Block_Adminhtml_Customer_Edit_Tab_Reward_Management_Update
{
    protected function _prepareForm(){
        DIE("I'll KILL YOU");
    }
}

But I didn't see my sweet message... What do I wrong ?

0

I'm not familiar with EE but I reckon your overwrite should be:

<blocks>
    <reward>
        <rewrite>
            <customer_edit_tab_reward_management_update>Myself_Reward_Customer_Edit_Tab_Reward_Management_Update</customer_edit_tab_reward_management_update>
        </rewrite>
    </reward>
</blocks>

Basically the first node under <blocks> should match the first node declared under <blocks> in app/code/core/Enterprise/Reward/etc/config.xml

  • Hi, thanks for the post, I've tried but It didn't works. :( – Pekin Jul 1 '16 at 14:27
0

This should be your block declaration in config file :

<blocks>
    <myself_reward>
        <class>Myself_Reward_Block</class>
    </myself_reward>
    <enterprise_reward>
        <rewrite>
            <adminhtml_customer_edit_tab_reward_management_update>Myself_Reward_Block_Customer_Edit_Tab_Reward_Management_Update</adminhtml_customer_edit_tab_reward_management_update>
        </rewrite>
    </enterprise_reward>
</blocks>

And, your class name should be Myself_Reward_Block_Customer_Edit_Tab_Reward_Management_Update, not Myself_Reward_Customer_Edit_Tab_Reward_Management_Update

  • Hi, thanks for answer, I've tried, but I've : exception 'Mage_Core_Exception' with message 'Type de bloc non valide : Myself_Reward_Block_Customer_Edit_Tab_Reward_Management_Update' in /var/www/app/Mage.php:595 – Pekin Jul 1 '16 at 14:39
0
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
    <Myself_Reward>
        <version>0.1.0</version>            
    </Myself_Reward>
</modules>    
<global>
    <blocks>
        <myself_reward>
            <class>Myself_Reward_Block</class>
        </myself_reward>
        <enterprise_reward>
            <rewrite>   
                <adminhtml_customer_edit_tab_reward_management_update>      Myself_Reward_Block_Adminhtml_Customer_Edit_Tab_Reward_Management_Update</adminhtml_customer_edit_tab_reward_management_update>
            </rewrite>
        </enterprise_reward>
    </blocks>
</global>
</config>

Make sure to include, Enterprise_Reward_Block_Adminhtml_Customer_Edit_Tab_Reward_Management_Update in your local update.php file

  • Hi, thanks for the answer, but by this way I've got the following error in my var/log/exception.log file : exception 'Mage_Core_Exception' with message 'Type de bloc non valide (which mean "Invalid Type Block') : Myself_Reward_Adminhtml_Customer_Edit_Tab_Reward_Management_Update' – Pekin Jul 1 '16 at 14:36
0

I've make a mix of all of them and add some things and now It works.

Here is what I did :

My config.xml looks like that :

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Myself_Reward>
            <version>0.1.0</version>
            <depends>
                <Enterprise_Reward/>
            </depends>
        </Myself_Reward>
    </modules>
    <global>
        <blocks>
            <myself_reward>
                <class>Myself_Reward_Block</class>
            </myself_reward>
            <enterprise_reward>
                <rewrite>
<adminhtml_customer_edit_tab_reward_management_update>Myself_Reward_Block_Adminhtml_Customer_Edit_Tab_Reward_Management_Update</adminhtml_customer_edit_tab_reward_management_update>
                </rewrite>
            </enterprise_reward>
        </blocks>

My Upload.php :

<?php
require_once ('Enterprise/Reward/Block/Adminhtml/Customer/Edit/Tab/Reward/Management/Update.php');
class Myself_Reward_Block_Adminhtml_Customer_Edit_Tab_Reward_Management_Update
    extends Enterprise_Reward_Block_Adminhtml_Customer_Edit_Tab_Reward_Management_Update
{
    protected function _prepareForm(){
        DIE("I'll KILL YOU");
    }
}

My Upload.php file is inside :

app/code/local/Myself/Reward/Block/Adminhtml/Customer/Edit/Tab/Reward/Management/

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.