开发者

Magento 1.4.2 - Set Address Fields During Registration

开发者 https://www.devze.com 2023-02-10 04:47 出处:网络
I am trying to populate address fields during registration, using data from another system. In my observer, I am able to use

I am trying to populate address fields during registration, using data from another system. In my observer, I am able to use

$customer = $observer->getCustomer();
$customer->setFirst开发者_高级运维name($value);
$customer->setLastname($value);

and the information is saved in the database, but

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

do not. How would I set address fields? Thanks!


Addresses are not stored in the Mage_Customer_Model_Customer object. You should instead do something like:

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


I found some good posts: this was easier for me:-) http://www.pauldonnellydesigns.com/blog/magento-display-address-fields-in-create-an-account/ and longer post: http://www.magentocommerce.com/boards/viewthread/11110/

It's working, I checked.

I need show fields form address in orders, controller: /checkout/onepage on the page with form login and register (I want add fields personal and address in step register)

Do someone saw code to create for this functionality?

0

精彩评论

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