开发者

pre-populating DOB fields in Magento registration form

I am trying to pre-populate some fields in Magento's customer registration form. I was able to get the formData from the register block and do th开发者_运维技巧ings like ->setFirstname() which works great, but I am having trouble doing the same with the DOB widget.

Any idea on how this can be done?

Eyal


Got pointed at the right direction by alan storm, answer was to call ->setDob('1999-1-15') on the formData member of the block.

This is all within a class that extends Mage_Customer_AccountController and the outline of the code is:

$year='1999';
$month='1';
$day='15';
$layout=$this->getLayout();

/*
The register block is a type="customer/form_register" template="customer/form/register.phtml" 
i.e. Mage_Customer_Block_Form_Register
*/

$registerBlock=$layout->getBlock('customer_form_register'); 
$register_form_data=$registerBlock->getFormData();
$register_form_data->setDob($year.'-'.$month.'-'.$day);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜