Magento 后端自定义地址属性
我在 Magento 中创建了一个名为“addresstype”的客户地址属性,它是一个 varchar,在前端具有“住宅”和“商业”单选选项。
该属性在结帐期间保存并显示在数据库中。客户可以编辑他们的个人资料,我可以使用 $address->getAddresstype();
主动提取变量来检查相应的单选按钮。
我唯一的问题是,在各个销售订单页面的后端,变量没有通过。我已经编辑了 /app/code/core/Mage/Customer/Block/Address/Renderer/Default.php (使用 $address->getAddresstype()
),并且可以使用以下命令查看数组中的属性print_r($attributes = Mage::helper('customer/address')->getAttributes());
它在数据库中也被标记为“is_visible”。
I have created a customer address attribute in Magento called 'addresstype' that is a varchar with radio options of 'Residential' and 'Business' on the front-end.
The attribute is saved during checkout and appears in the database. Customers can edit their profiles and I can actively pull the variables using $address->getAddresstype();
to check the appropriate radio button.
My only problem is that in the back-end on individual sales order pages, the variable is not coming through. I have edited /app/code/core/Mage/Customer/Block/Address/Renderer/Default.php (using $address->getAddresstype()
) and can see the attribute in the array using print_r($attributes = Mage::helper('customer/address')->getAttributes());
It is marked as 'is_visible' in the database as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为销售订单/发票页面从不同的表 (sales_flat_order_address) 中提取信息。假设您第一次将其放在正确的位置(看起来您确实如此),那么您只需让 Magento 复制正确的信息即可。
您可能还需要添加另一个字段设置值,以将值从地址复制到报价地址,我一时记不清了。如果您在 Magento 的代码中搜索 *.xml 中的字段集,您应该会找到示例。
This is because the sales order / invoice pages pull the information back from different tables (sales_flat_order_address). Assuming you have it in the right place in the first time (which it seems you do), then you just need to make Magento copy the correct information over.
You might also have to add another field set value in to copy the value from the address to the quote address, off the top of my head I can't remember. If you search Magento's code for fieldsets in *.xml you should find examples.