При добавлении Data.php в Magento произошла ошибка - PullRequest
4 голосов
/ 18 февраля 2011

После Alan Storm Tutorial в пользовательской конфигурации системы Magento, когда я попытался добавить

Data.php в папке помощника я все еще получаю эту ошибку:

Неустранимая ошибка: класс 'Mage_Helloworld_Helper_Data' не найден в E: \ xampp \ htdocs \ magento \ app \ Mage.php в строке 520

**Alanstormdotcom\Helloworld\Helper\Data.php**
<?php
class Alanstormdotcom_Helloworld_Helper_Data extends Mage_Core_Helper_Abstract
{
} 

**Alanstormdotcom\Helloworld\etc\system.xml**
<?xml version="1.0"?>
<config>    
    <tabs>
        <helloconfig translate="label" module="helloworld">
                <label>Hello Config</label>
                <sort_order>99999</sort_order>
        </helloconfig>  
    </tabs> 
</config>


**Alanstormdotcom\Helloworld\etc\config.xml**
<?xml version="1.0"?>
<config>    
    <modules>
        <Alanstormdotcom_Helloworld>
            <version>0.1.0</version>
        </Alanstormdotcom_Helloworld>
    </modules>
<frontend>
        <routers>
            <helloworld>
                <use>standard</use>
                <args>
                    <module>Alanstormdotcom_Helloworld</module>
                    <frontName>helloworld</frontName>
                </args>
            </helloworld>
        </routers>
    </frontend>
    <global>
      <helpers>
         <class>Alanstormdotcom_Helloworld_Helper</class>
      </helpers>    
    </global>
</config> 

Я просто хотел научиться .. Я знаю, что это работает в тебе, но все же помогает мне понять, почему .. я могу пропустить

что-то .. Спасибо.

1 Ответ

13 голосов
/ 18 февраля 2011

Этот бит неверен:

<global>
  <helpers>
     <class>Alanstormdotcom_Helloworld_Helper</class>
  </helpers>    
</global>

Должно быть:

<global>
    <helpers>
        <helloworld>
            <class>Alanstormdotcom_Helloworld_Helper</class>
        </helloworld>
    </helpers>    
</global>

(тег <helloworld> соответствует module="helloworld" выше)

...