2

The extension I am attempting to override is installed to the local folder. The extension information:

 app/code/local/Xtento/OrderExport/Model/Export/Data.php
 class Xtento_OrderExport_Model_Export_Data extends Mage_Core_Model_Abstract {
      ...
      public function getExportData($entityType, $collectionItem = false, $getConfiguration = false){
           ...
      }
 }

My Module Information:

 app/code/local/AimlessMedia/XtentoOrderExportMod/etc/config.xml
<?xml version="1.0"?>
<config>
    <modules>
        <AimlessMedia_XtentoOrderExportMod>
            <version>1.5.5</version>
        </AimlessMedia_XtentoOrderExportMod>
    </modules>
    <global>
        <models>
            <xtento_orderexport>
                <rewrite>
                    <export_data>AimlessMedia_XtentoOrderExportMod_Model_Export_Data</export_data>
                </rewrite>
            </xtento_orderexport>
        </models>
    </global>
</config>

Extended ModeL:

 app/code/local/AimlessMedia/XtentoOrderExportMod/Model/Export/Data.php
class AimlessMedia_XtentoOrderExportMod_Model_Data extends Xtento_OrderExport_Model_Export_Data
{    
    public function removeAccents($str)
    {
        $a = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ',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'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o', 'Α', 'α', 'Ε', 'ε', 'Ο', 'ο', 'Ω', 'ω', 'Ι', 'ι', 'ι', 'ι', 'Υ', 'υ', 'υ', 'υ', 'Η', 'η');
        return str_replace($a, $b, $str);
    }

    public function getExportData($entityType, $collectionItem = false, $getConfiguration = false)
    {
         ...
     }
 }

app/etc/modules/AimlessMedia_XtentoOrderExportMod.xml

 <?xml version="1.0" encoding="UTF-8"?>
 <config>
<modules>
    <AimlessMedia_XtentoOrderExportMod>
        <active>true</active>
        <codePool>local</codePool>
        <depends>
            <Xtento_OrderExport/>
        </depends>
    </AimlessMedia_XtentoOrderExportMod>
</modules>
 </config> 

1 Answer 1

1

In your config.xml

 <models>
            <XtentoOrderExportMod>
                <rewrite>
                    <export_data>AimlessMedia_XtentoOrderExportMod_Model_Export_Data</export_data>
                </rewrite>
            </XtentoOrderExportMod>
        </models>

Should be:

  <models>
                <xtento_orderexport>
                    <rewrite>
                        <export_data>AimlessMedia_XtentoOrderExportMod_Model_Export_Data</export_data>
                    </rewrite>
                </xtento_orderexport>
            </models>

Whevener re-writing models or for that matter blocks or helpers you need to give the module handle of the module you are trying to overwrite than your own. Here in this case it is: xtento_orderexport

This is what tells Magento that when the model Mage::getModel('xtento_orderexport/export_data') is bring instantiated it has to instantiate your class: AimlessMedia_XtentoOrderExportMod_Model_Export_Data

1
  • That is a variation that I tried earlier. I just reverted back to your suggestion but it is still not working. Just FYI, my app/etc/modules/AimlessMedia_XtentoOrderExportMod.xml file contains a <depend> parameter. <?xml version="1.0" encoding="UTF-8"?> <config> <modules> <AimlessMedia_XtentoOrderExportMod> <active>true</active> <codePool>local</codePool> <depends> <Xtento_OrderExport/> </depends> </AimlessMedia_XtentoOrderExportMod> </modules> </config> Commented Dec 17, 2014 at 20:50

Your Answer

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

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