public function blockToHtmlBefore(Varien_Event_Observer $observer) { $event = $observer->getEvent(); $block = $event->getBlock(); if (get_class($block) == 'Mage_Customer_Block_Form_Register') { $block->setTemplate('customerattribute/customer/form/register.phtml'); $childrenblock = new Magestore_Customerattribute_Block_Customer_Form(); $childrenblock->setFormCode('customer_account_create'); $childrenblock->setEntityModelClass('customer/customer'); $childrenblock->setParentBlock($block); $childrenblock->loadTemplate(); $childrenblock->setTemplate('customerattribute/customer/form/userattributes.phtml'); $block->setChild('customer_form_user_attributes', $childrenblock); } elseif (get_class($block) == 'Mage_Customer_Block_Form_Edit') { $block->setTemplate('customerattribute/customer/form/edit.phtml'); } }
/** * */ public function createAccountAction() { $this->loadLayout(); $layout = $this->getLayout(); $block = $layout->createBlock('idpas400/register'); $block->setTemplate('customerattribute/customer/form/register.phtml'); $childrenblock = new Magestore_Customerattribute_Block_Customer_Form(); $childrenblock->setFormCode('customer_account_create'); $childrenblock->setEntityModelClass('customer/customer'); $childrenblock->setParentBlock($block); $childrenblock->loadTemplate(); $childrenblock->setTemplate('customerattribute/customer/form/userattributes.phtml'); $block->setChild('customer_form_user_attributes', $childrenblock); echo $block->toHtml(); }