douyu9433 2015-09-14 15:09
浏览 38

too long

I am trying to create a script for creating a customer programmatically in magento. I am able to store all my fields using the magento's own methods. But I have a custom field called 'landmark' which I need to save it to the customer's account. How do I do it? I am a newbie in Magento. Help needed.

Currently the code for storing all the other fields looks like this
$address = Mage::getModel("customer/address"); $address->setCustomerId($customer->getId()) ->setFirstname($customer->getFirstname()) ->setMiddleName($customer->getMiddlename()) ->setLastname($customer->getLastname()) ->setCountryId('IN') ->setRegion($state) ->setPostcode($pincode) ->setCity($city) ->setTelephone($mobile) ->setStreet($addressArray) ->setIsDefaultBilling('1') ->setIsDefaultShipping('1') ->setSaveInAddressBook('1');

How do I store the value of my custom field 'landmark' to the address object?

  • 写回答

2条回答 默认 最新

  • drd94483 2015-09-14 15:35
    关注

    You can treat custom attributes same as any default magento attribute. Just get the value from customer model and set the value in customer address model.

    $address->setLandmark($customer->getLandmark());
    
    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)