0

I am creating a module for exporting Creditmemo data in xml but I am getting following error. I have checked everything but I am unable to find the bug please help me.

Config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Ninobambino_CreditmemoExport>
            <version>1.0.0</version>
        </Ninobambino_CreditmemoExport>
    </modules>
    <global>
        <helpers>
            <Ninobambino_CreditmemoExport>
                <class>Ninobambino_CreditmemoExport_Helper</class>
            </Ninobambino_CreditmemoExport>
        </helpers>
        <models>
            <Ninobambino_CreditmemoExport>
                <class>Ninobambino_CreditmemoExport_Model</class>
            </Ninobambino_CreditmemoExport>
        </models>
        <resources>
            <Ninobambino_CreditmemoExport_setup>
                <setup>
                    <module>Ninobambino_CreditmemoExport</module>
                </setup>
            </Ninobambino_CreditmemoExport_setup>
        </resources>
        <events>
            <sales_order_creditmemo_save_after>
                <observers>
                    <Ninobambino_CreditmemoExport_order_creditmemo_save_after>
                        <type>singleton</type>
                        <class>Ninobambino_CreditmemoExport_Model_Observer</class>
                        <method>creditmemoExport</method>
                    </Ninobambino_CreditmemoExport_order_creditmemo_save_after>
                </observers>
            </sales_order_creditmemo_save_after>
        </events>
    </global>
</config>

Data.php

<?php
class Ninobambino_CreditmemoExport_Helper_Data extends Mage_Core_Helper_Abstract
{
    const LOG_ENABLED_CONFIG_PATH = 'productimport/general_config/log_enabled';
    const LOG_FILE_NAME = 'creditmemoexport.log';
    /**
     * Utility function to log a message to the log file, if logging is enabled
     * @param string log message
     */
    public function log($message) {
        if (Mage::getStoreConfig(self::LOG_ENABLED_CONFIG_PATH)) {
            Mage::log($message, null, self::LOG_FILE_NAME);
        }
    }
}
  • how you are calling this helper ? – Minesh Patel Nov 14 '17 at 5:17
  • $_helper = Mage::helper('creditmemoexport'); – Piyush Nov 14 '17 at 5:32
  • <helpers> <Ninobambino_CreditmemoExport> <class>Ninobambino_CreditmemoExport_Helper</class> </Ninobambino_CreditmemoExport> </helpers> magento identifyhelper by this. – Minesh Patel Nov 14 '17 at 6:05
  • try Mage::helper(ninobambino_creditmemoExport'); – Minesh Patel Nov 14 '17 at 6:05
1

You have to change below code

<helpers>
    <Ninobambino_CreditmemoExport>
         <class>Ninobambino_CreditmemoExport_Helper</class>
    </Ninobambino_CreditmemoExport>
</helpers>

Here change Ninobambino_CreditmemoExport to creditmemoexport

Then to use your helper function use below code

Mage::helper('creditmemoexport')->yourMethod()

Note: Alias name for helper, models and resources node should be in lowercase, you can also use your module name(without namespace) in lowercase for this

Update: your nodes for helper, models and resource should be like below code

<helpers>
    <creditmemoexport>
        <class>Ninobambino_CreditmemoExport_Helper</class>
    </creditmemoexport>
</helpers>
<models>
    <creditmemoexport>
        <class>Ninobambino_CreditmemoExport_Model</class>
    </creditmemoexport>
</models>
<resources>
    <creditmemoexport_setup>
        <setup>
            <module>Ninobambino_CreditmemoExport</module>
        </setup>
    </creditmemoexport_setup>
</resources>
  • that error stile papering. – Piyush Nov 14 '17 at 5:46
  • try after clearing cache, also check your path as well – Piyush Nov 14 '17 at 5:49
  • After editing my code my config.xml is looks like <helpers> <Ninobambino_CreditmemoExport> <class>Ninobambino_creditmemoexport_Helper</class> </Ninobambino_CreditmemoExport> </helpers> and Data.php is looks like class Ninobambino_creditmemoexport_Helper_Data extends Mage_Core_Helper_Abstract and observer.php $_helper = Mage::helper('creditmemoexport')->log(); – Piyush Nov 14 '17 at 5:49
  • i clean my cache also and checked path as well. – Piyush Nov 14 '17 at 5:55
  • check my updated answer – Piyush Nov 14 '17 at 5:57

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.