Я пытаюсь создать свою собственную форму каталога запросов в Magento, основанную на модуле «Контакты», который поставляется из коробки. Я настроил свои XML-файлы:
- . / Приложение / и т.д. / модули / RequestCatalog_RequestCatalog.xml
- . / Дизайн / интерфейс / по умолчанию / {тема} /layout/requestcatalog.xml
- . / Код / местные / {имен} / {} модуль /etc/config.xml
В моем config.xml я установил свое имя фронта 'requestcatalog' и сказал ему использовать контроллер моего модуля. Однако при посещении http://app.com/requestcatalog я получаю сообщение об ошибке:
Неустранимая ошибка: вызов функции-члена setFormAction () для необъекта
в
/path/to/root/public_html/app/code/local/RequestCatalog/RequestCatalog/controllers/IndexController.php
по линии 55
Строка 55 файла IndexController.php выглядит следующим образом:
$this->getLayout()->getBlock('requestcatalog')->setFormAction( Mage::getUrl('*/*/post') );
Мой блок с именем 'requestcatalog' определен в XML моего макета.
Я искал SO и нашел пользователя с той же проблемой, однако решение не было предоставлено: Пользовательский модуль Magento, Неустранимая ошибка: вызов функции-члена setFormAction ()
Мой запрос catalogalog.xml:
<layout version="0.1.0">
<default>
<reference name="footer_links">
<action method="addLink" translate="label title" module="requestcatalog" ifconfig="requestcatalog/requestcatalog/enabled"><label>Request a Catalog</label><url>requestcatalog</url><title>Request a Catalog</title><prepare>true</prepare></action>
</reference>
</default>
<requestcatalog_index_index>
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
<action method="setHeaderTitle" translate="title" module="requestcatalog"><title>Request a Catalog</title></action>
</reference>
<reference name="content">
<block type="core/template" name="requestcatalog" template="requestcatalog/form.phtml"/>
</reference>
</requestcatalog_index_index>
My IndexAction ():
public function indexAction()
{
$this->loadLayout();
$this->getLayout()->getBlock('requestcatalog')
->setFormAction( Mage::getUrl('*/*/post') );
$this->_initLayoutMessages('customer/session');
$this->_initLayoutMessages('catalog/session');
$this->renderLayout();
}