2

I'm getting the following error:

Warning: include(Mage/Afe/Custmail/Helper/Data.php): failed to open stream: No such file or directory

I've been searching for the cause of this error for hours.

Here is the config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Afe_Custmail>
            <version>1.0.0</version>
        </Afe_Custmail>
    </modules>
    <global>
        <helpers>
            <custmail>
                <class>Afe_Custmail_Helper</class>
            </custmail>
        </helpers>      
        <models>
            <custmail>
                <class>Afe_Custmail_Model</class>
            </custmail>
        </models>
        <events>
            <sales_order_save_commit_after>
                <observers>
                    <mail_status_change>
                        <type>singleton</type>
                        <class>custmail/observer</class>
                        <method>invoicedStatusChange</method>
                    </mail_status_change>
                </observers>
            </sales_order_save_commit_after>
        </events>
        <template>
            <email>
                <custom_order_tpl module="Afe_Custmail">
                    <label>Status Mail Invoice</label>
                    <file>statusmail_processing.html</file>
                    <type>html</type>
                </custom_order_tpl>
            </email>
        </template>
    </global>
</config>

Here is the Data.php located in app/code/local/Afe/Custmail/Helper/

<?php
class Afe_Custmail_Helper_Data extends Mage_Core_Helper_Abstract {
 }

Here is the Observer.php located in app/code/local/Afe/Custmail/Model/

<?php
class Afe_Custmail_Model_Observer
{
    public function invoicedStatusChange($event)
    {
        $order = $event->getOrder();
        $orderStatus = $order->getStatus();
        if ($order->getState() == Mage_Sales_Model_Order::STATE_CANCELED)
            $this->_sendStatusMail($order);
    }

    private  function _sendStatusMail($order)
    {
        $emailTemplate  = Mage::getModel('core/email_template');

        $emailTemplate->loadDefault('custom_order_tpl');
        $emailTemplate->setTemplateSubject('Your order was holded');

        // Get General email address (Admin->Configuration->General->Store Email Addresses)
        $salesData['email'] = Mage::getStoreConfig('trans_email/ident_general/email');
        $salesData['name'] = Mage::getStoreConfig('trans_email/ident_general/name');

        $emailTemplate->setSenderName($salesData['name']);
        $emailTemplate->setSenderEmail($salesData['email']);

        $emailTemplateVariables['username']  = $order->getCustomerFirstname() . ' ' . $order->getCustomerLastname();
        $emailTemplateVariables['order_id'] = $order->getIncrementId();
        $emailTemplateVariables['store_name'] = $order->getStoreName();
        $emailTemplateVariables['store_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
        $emailTemplate->send($order->getCustomerEmail(), $order->getStoreName(), $emailTemplateVariables);
    }
}

Here is the Afe_Custmail.xml located in app/etc/modules/

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

That's the whole thing. It works at sending emails so it is registered but when I go to Transactional Emails > Add New Template I get the Helper not found. I've tried every conceivable combination of configuration adjustments i.e. relocating the position of the <helpers> changing the <custmail> to <afe_custmail> adding _Data to the end of <class>Afe_Custmail_Helper</class> nothing works so far. The compiler is not enabled also. I'm very curious why it's giving he error. I'm not sure what a Helper is supposed to do but it's not helping!

Any help would be greatly appreciated. Thanks

  • Sanity check: have you cleared your cache? – Robbie Averill Jul 30 '16 at 0:41
  • Yes, I even rename the var/cache to cache.disabled and Magento had to create a new one. Then I reverted back after it still didn't work. – Freejoy Jul 30 '16 at 0:45
3

It's probably this part:

<custom_order_tpl module="Afe_Custmail">

This will probably be looking for a helper under that vendor namespace for translation, ie Afe_Custmail/data.

Try changing it to your helper alias:

module="custmail"

Make sure you clear your cache after changing XML configuration.

  • You got it. Don't know why it worked but it does. The Edit Email Template section is blank except for one empty input field. I guess that's because I don't have the config for those or maybe some Helpers to load the email temple. Thanks – Freejoy Jul 30 '16 at 1:02
  • I don't get the error but I can't load any templates. Just a empty Load default template Template * field. What would cause that? – Freejoy Jul 30 '16 at 1:09
  • Nevermind it was a stray leftover echo hello i put in the helper earlier. – Freejoy Jul 30 '16 at 1:11

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.