이것은 도우미를 호출하는 올바른 방법이지만 오류는 모듈을 올바르게 설정하지 않았 음을 나타냅니다. 귀하의 모듈이 app/code/local/Test/Helperclass
에 있고, app/etc/modules/Test_Helperclass.xml
파일로 모듈을 활성화했다고 가정합니다.
당신이 젠토의 공장을 전화
같은
Mage::getModel()
,
Mage::getSingleton()
, 또는
Mage::helper()
, 당신은 전체 클래스 이름을 제공하지 않지만, 당신이하고 싶은 클래스에 대한 참조가 인스턴스화.
이 형식은 modulename/classname
입니다. 우리의 경우
는 모듈 이름은 helperclass
가 (모듈의 실제 이름에 대한 관계를 베어가없는, 그냥뿐만 아니라 foobar
수), 우리의 클래스 이름 data
입니다. 따라서 우리는 근본적으로 Mage::helper('helperclass/data')
이라고 부릅니다. Magento는이를 Mage::helper('helperclass')
으로 줄일 수 있습니다.
Magento에게 확장 뒤의 규칙 helperclass/data -> Test_Helperclass_Helper_Data
을 알릴 필요가 있습니다. 우리는 app/code/local/Test/Helperclass/etc/config.xml
에서 모듈의 구성 파일에서이 작업을 수행 :
<?xml version="1.0"?>
<config>
...
<global>
<helpers>
<!-- Here is where we define the mapping rule -->
<helperclass>
<class>Test_Helperclass_Helper</class>
</helperclass>
</helpers>
</global>
...
</config>
을하고 도우미가 config.xml 파일에 정의 된 파일은 지역/테스트/Helperclass/도우미/Data.php 경로 응용 프로그램/코드 /에 존재? –