3

I'm trying to override a part of an helper of Help Desk MX extension. So I created a module with the following file: app/etc/modules/company.xml

<?xml version="1.0" encoding="utf-8"?>
<config>
     <modules>
        <Company_Helpdesk>
            <active>true</active>
            <codePool>local</codePool>
        </Company_Helpdesk>
    </modules>
</config>

app/code/local/Company/Helpdesk/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Company_Helpdesk>
            <version>1.0.0</version>
        </Company_Helpdesk>
    </modules>
    <global>
        <helpers>
            <mirasvit_helpdesk>
                <rewrite>
                    <email>Company_Helpdesk_Helper_Email</data>
                </rewrite>
            </mirasvit_helpdesk>
        </helpers>
    </global>
</config>

app/code/local/Company/Helpdesk/Helper/Email.php

<?php
class Company_Helpdesk_Helper_Email extends Mirasvit_Helpdesk_Helper_Email
{
    public function getHiddenSeparator()
    {
        return "<span style='color:transparent;font-size:0;margin:0px;padding:0px;'>".$this->getSeparator().'</span>';
    }   
}

Following this guide: http://inchoo.net/magento/overriding-magento-blocks-models-helpers-and-controllers/

But it doesn't work.

Where am I wrong?

  • In the original module that you are overwriting, how does the <helpers> tag look like? – Marius Jun 30 '17 at 13:24
  • ` <helpers> <helpdesk> <class>Mirasvit_Helpdesk_Helper</class> </helpdesk> </helpers> ` – krybbio Jun 30 '17 at 13:29
4

change this in your config.xml

<global>
    <helpers>
        <mirasvit_helpdesk>
            <rewrite>
                <email>Company_Helpdesk_Helper_Email</data>
            </rewrite>
        </mirasvit_helpdesk>
    </helpers>
</global>

to this

<global>
    <helpers>
        <helpdesk><!-- this needs to match the tag in the original module -->
            <rewrite>
                <email>Company_Helpdesk_Helper_Email</email>
            </rewrite>
        </helpdesk>
    </helpers>
</global>

also, in your app/etc/modules/company.xml add this inside the Company_Helpdesk tag

<depends>
     <Mirasvit_Helpdesk />
</depends>
  • 1
    in <rewrite> tag Helper class has different closing tag – Piyush Jun 30 '17 at 13:39
0

Here i am show you how to Extend community Or third party module helper class in your own modules. Now here i am extend asmaty extension helper.

  1. create your module register xml app/etc/modules/Myextend_Shopbyextend.xml

    <?xml version="1.0"?> <config> <modules> <Myextend_Shopbyextend> <active>true</active> <codePool>local</codePool> <depends> <Amasty_Shopby /> </depends> </Myextend_Shopbyextend> </modules> </config>

  2. create module config.xml file app/code/local/Myextend/Shopbyextend/etc/

<?xml version="1.0"?> <config> <modules> <Myextend_Shopbyextend> <version>0.1.0</version> </Myextend_Shopbyextend> </modules> <global> <helpers> <shopbyextend> <class>Myextend_Shopbyextend_Helper</class> </shopbyextend> <amshopby> <rewrite> <data>Myextend_Shopbyextend_Helper_Data</data> </rewrite> </amshopby> </helpers>
</global> </config>

  1. Last create your help file app/code/local/Plumtree/Shopbyextend/Helper/Data.php and extends Amasty_Shopby_Helper_Data class

class Myextend_Shopbyextend_Helper_Data extends Amasty_Shopby_Helper_Data { public function getCurrentCategory() { \\ Write your code here } }

I hope this will help you

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review – Piyush Apr 12 '18 at 10:07
  • Ok. thank you for your suggestion @Piyush – Shorabh Apr 12 '18 at 10:40

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.