سؤال

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

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top