Magento Custom Form With Notification
Step1: you need to creat a XML file same at location given below, if folder does not exist please create it [php]/app/etc/modules/MageWorks_Contact.xml[/php] and paste the content below in MageWorks_Contact.xml [php]
[/php] Step 3: Now create controller at the folloing location [php] app/code/local/MageWorks/Contact/controllers/IndexController.php [/php] now paste the content below to controller [php] class MageWorks_Contact_IndexController extends Mage_Core_Controller_Front_Action { public function indexAction() { //Get current layout state $this->loadLayout(); $block = $this->getLayout()->createBlock( ‘Mage_Core_Block_Template’, ‘mageworks.contact’, array( ‘template’ => ‘mageworks/contact.phtml’ ) ); $this->getLayout()->getBlock(‘content’)->append($block); //$this->getLayout()->getBlock(‘right’)->insert($block, ‘catalog.compare.sidebar’, true); $this->_initLayoutMessages(‘core/session’); $this->renderLayout(); } public function sendemailAction() { //Fetch submited params $params = $this->getRequest()->getParams(); $mail = new Zend_Mail(); $mail->setBodyText($params[‘comment’]); $mail->setFrom($params[’email’], $params[‘name’]); $mail->addTo(‘somebody_else@example.com’, ‘Some Recipient’); $mail->setSubject(‘Test MageWorks_Contact Module for Magento’); try { $mail->send(); } catch(Exception $ex) { Mage::getSingleton(‘core/session’)->addError(‘Unable to send email. Sample of a custom notification error from MageWorks_Contact.’); } //Redirect back to index action of (this) mageworks-contact controller $this->_redirect(‘mageworks-contact/’); } } [/php] Step 4: Create view [php] app/design/frontend/default/default/template/mageworks/contact.phtml [/php] paste content below to contact.phtml [php]
* Required Fields
Hi, how about adding custom field at signup page?