Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento - Layout file not working for custom module
    primarykey
    data
    text
    <p>I'm creating a custom module for a page with an email form on. Everything seems to work fine but I cant get my layout updates to work. This is my first custom module so any help would be great. Thank you.</p> <p><strong>app/code/local/Adtrak/ArrangeSurvey/ect/config.xml</strong></p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;config&gt; &lt;modules&gt; &lt;adtrak_arrangesurvey&gt; &lt;version&gt;0.1.0&lt;/version&gt; &lt;/adtrak_arrangesurvey&gt; &lt;/modules&gt; &lt;global&gt; &lt;rewrite&gt; &lt;adtrak_arrangesurvey&gt; &lt;from&gt;&lt;![CDATA[#^/arrangesurvey/#]]&gt;&lt;/from&gt; &lt;to&gt;/adtrakArrangeSurvey/&lt;/to&gt; &lt;/adtrak_arrangesurvey&gt; &lt;/rewrite&gt; &lt;/global&gt; &lt;frontend&gt; &lt;routers&gt; &lt;adtrak_arrangesurvey&gt; &lt;use&gt;standard&lt;/use&gt; &lt;args&gt; &lt;module&gt;Adtrak_ArrangeSurvey&lt;/module&gt; &lt;frontName&gt;adtrakArrangeSurvey&lt;/frontName&gt; &lt;/args&gt; &lt;/adtrak_arrangesurvey&gt; &lt;/routers&gt; &lt;layout&gt; &lt;updates&gt; &lt;adtrak_arrangesurvey&gt; &lt;file&gt;adtrakArrangeSurvey.xml&lt;/file&gt; &lt;/adtrak_arrangesurvey&gt; &lt;/updates&gt; &lt;/layout&gt; &lt;/frontend&gt; &lt;/config&gt; </code></pre> <p><strong>app/design/frontend/doorfit/deafult/layout/adtrakArrangeSurvey.xml</strong></p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;layout version="0.1.0"&gt; &lt;adtrak_arrangesurvey_index_index&gt; &lt;label&gt;Arrange A Survey&lt;/label&gt; &lt;reference name="root"&gt; &lt;action method="setTemplate"&gt;&lt;template&gt;page/1column.phtml&lt;/template&gt;&lt;/action&gt; &lt;action method="setHeaderTitle" translate="title" module="arrangesurvey"&gt;&lt;title&gt;Arrange A Survey&lt;/title&gt;&lt;/action&gt; &lt;/reference&gt; &lt;reference name="content"&gt; &lt;block type="core/template" name="surveyForm" template="arrangesurvey/index.phtml"/&gt; &lt;/reference&gt; &lt;/adtrak_arrangesurvey_index_index&gt; &lt;adtrak_arrangesurvey_thanks_index&gt; &lt;label&gt;Thank You&lt;/label&gt; &lt;reference name="root"&gt; &lt;action method="setTemplate"&gt;&lt;template&gt;page/1column.phtml&lt;/template&gt;&lt;/action&gt; &lt;action method="setHeaderTitle" translate="title" module="contacts"&gt;&lt;title&gt;Thank You&lt;/title&gt;&lt;/action&gt; &lt;/reference&gt; &lt;reference name="content"&gt; &lt;block type="core/template" name="surveyForm" template="arrangesurvey/thanks.phtml"/&gt; &lt;/reference&gt; &lt;/adtrak_arrangesurvey_thanks_index&gt; &lt;/layout&gt; </code></pre> <p><strong>app/code/local/Adtrak/ArrangeSurvey/controllers/IndexController.php</strong></p> <p>I've inserted the form block here because I couldnt get the layout file working so hopefully I can remove that after.</p> <p> <p>require_once 'Mage/Contacts/controllers/IndexController.php';</p> <pre><code>class Adtrak_ArrangeSurvey_IndexController extends Mage_Contacts_IndexController { public function indexAction() { $this-&gt;loadLayout(); $block = $this-&gt;getLayout()-&gt;createBlock( 'Mage_Core_Block_Template', 'arrangesurvey.form', array('template' =&gt; 'arrangesurvey/index.phtml') ); $this-&gt;getLayout()-&gt;getBlock('content')-&gt;append($block); $this-&gt;renderLayout(); } public function postAction() { Mage::log('postAction rewritten'); $post = $this-&gt;getRequest()-&gt;getPost(); if ( $post ) { $translate = Mage::getSingleton('core/translate'); /* @var $translate Mage_Core_Model_Translate */ $translate-&gt;setTranslateInline(false); try { $postObject = new Varien_Object(); $postObject-&gt;setData($post); $error = false; if (!Zend_Validate::is(trim($post['name']) , 'NotEmpty')) { $error = true; } if (!Zend_Validate::is(trim($post['comment']) , 'NotEmpty')) { $error = true; } if (!Zend_Validate::is(trim($post['email']), 'EmailAddress')) { $error = true; } if ($error) { throw new Exception(); } $mailTemplate = Mage::getModel('core/email_template'); /* @var $mailTemplate Mage_Core_Model_Email_Template */ $mailTemplate-&gt;setDesignConfig(array('area' =&gt; 'frontend')) -&gt;setReplyTo($post['email']) -&gt;sendTransactional( Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE), Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER), Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT), null, array('data' =&gt; $postObject) ); if (!$mailTemplate-&gt;getSentSuccess()) { throw new Exception(); } $translate-&gt;setTranslateInline(true); $this-&gt;_redirect('arrangesurvey/thanks'); return; } catch (Exception $e) { $translate-&gt;setTranslateInline(true); Mage::getSingleton('customer/session')-&gt;addError(Mage::helper('contacts')-&gt;__('Unable to submit your request. Please, try again later')); $this-&gt;_redirect('*/*/'); return; } } else { $this-&gt;_redirect('*/*/'); } } } </code></pre> <p>Any help or advice would be great.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload