Magento 1.4.2 - 注册期间设置地址字段

时间:2011-02-11 19:09:58

标签: magento

我正在尝试使用来自其他系统的数据在注册期间填充地址字段。在我的观察者中,我能够使用

$customer = $observer->getCustomer();
$customer->setFirstname($value);
$customer->setLastname($value);

并且信息保存在数据库中,但

$customer->setStreet($value);
$customer->setPostcode($value);
$customer->setTelephone($value);

不要。我该如何设置地址字段? 谢谢!

2 个答案:

答案 0 :(得分:1)

地址未存储在Mage_Customer_Model_Customer对象中。你应该做一些像:

$address = Mage::getModel('customer/address');
$address->setStreet(...);
...
$customer->addAddress($address);

答案 1 :(得分:0)

我找到了一些好帖子: 这对我来说比较容易:-) http://www.pauldonnellydesigns.com/blog/magento-display-address-fields-in-create-an-account/ 更长的帖子: http://www.magentocommerce.com/boards/viewthread/11110/

它正在工作,我查了一下。

我需要在订单中显示字段表单地址,控制器:/ checkout / onepage页面上有表单登录和注册(我想在步骤寄存器中添加字段个人和地址)

是否有人看到要为此功能创建的代码?