Magento:在结帐中保存自定义地址属性 [英] Magento: save custom address attribute in checkout

查看:45
本文介绍了Magento:在结帐中保存自定义地址属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在我的网站做的:管理 - >客户 - >属性 - >管理客户地址属性并添加一个新的属性,用户可以看到在他/她的个人资料,在我的地址选项,新属性可以编辑和保存创建新的地址时,我还可以看到它在后端,和编辑,直到这里一切都很好,我的问题是,在结账时,我已经在开票发货形式的领域,和我要当用户点击下订单"按钮,但是,结账似乎并不一无所知的新属性要保存新的属性,该属性不会被保存,如果我救一个值从用户配置文件没有按结账"吨加载它在外地.

this is what i did in my website: Admin->Customers->Attributes->Manage Customer Address Attributes and add a new attribute , the user can see it in his/her profile, under My Addresses option, the new attribute can be edited and is saved when creating a new address, i also can see it in the backend, and edited, untill here everything is ok, my problem is in the checkout, i already have the field in the billing and shipping forms and i want the new attribute to be saved when the user click "Place Order" button, but, checkout seems it doesn't know nothing about the new attribute, the attribute is not saved and if i save one value from the user profile checkout doesn't load it in the field.

我在这里可以做什么?

谢谢

推荐答案

在查看了magento的代码并阅读了Wiki之后,我能够完成操作,我的新属性保存在配置文件中的地址编辑表单中,但是当我在结账的形式进入,这是因为我需要重写一些Magento的核心文件,第一步是增加新的属性不会保存到,我复制到,因为我的新的属性代码是<强> RFC 下,我找到条目和

After looking in the magento's code and reading the wiki, i was able to completed, my new attribute was saved in the address edit form in the profile, but was not saved when i enter it in the checkout form, that was because i need to override some magento core files, the first step was adding the new attribute to app\code\core\Mage\Customer\etc\config.xml, i copied to app\code\core\Mycompany\Customer\etc\config.xml, as my new attribute code is rfc, i locate the <fieldsets> entry and

<customer_dataflow>
    ....
    <rfc><billing>1</billing><shipping>1</shipping></rfc>
</customer_dataflow>

现在我需要添加新的属性到我没有覆盖同样的,复制到我的本地命名空间,在功能<4>我找到

now i need to add the new attribute to the app\code\core\Mage\Customer\Model\Entity\Setup.php i did the same to override, copied to my local namespace, and in the function getDefaultEntities() i locate the

'customer_address'=>array(
    ....
            'rfc' => array(
            'label'         => 'RFC',
            'required'      => false,
            'sort_order'    => 135,
    ),
)  

现在,我也需要做同样的,但现在看起来应该是这样

now, i need to do also the same in app\code\core\Mage\Sales\etc\config.xml, but now should look like this

<sales_copy_order_billing_address>
    .....
    <rfc><to_order>*</to_order></rfc>
</sales_copy_order_billing_address>

<sales_copy_order_shipping_address>
    ......
    <rfc><to_order>*</to_order></rfc>
</sales_copy_order_shipping_address>

<sales_convert_quote_address>
    ........
    <rfc><to_order_address>*</to_order_address><to_customer_address>*</to_customer_address></rfc>
</sales_convert_quote_address>

<sales_convert_order_address>
    .........
    <rfc><to_quote_address>*</to_quote_address></rfc>
</sales_convert_order_address>

<customer_address>
    .......
    <rfc><to_quote_address>*</to_quote_address></rfc>
</customer_address>

希望它能够helpe别人

Hope it can helpe someone else

这篇关于Magento:在结帐中保存自定义地址属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆