Magento:在结帐时保存自定义地址属性

Magento: save custom address attribute in checkout(Magento:在结帐时保存自定义地址属性)
本文介绍了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, until 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.

我可以在这里做什么??

what can i do here??

谢谢

推荐答案

在查看 Magento 的代码并阅读 wiki 后,我能够完成它,我的新属性保存在配置文件中的地址编辑表单中,但是当我在结帐表单中输入它时没有保存,那是因为我需要覆盖一些 Magento 核心文件,第一步是将新属性添加到 appcodecoreMageCustomeretcconfig.xml,我复制到 appcodecoreMycompanyCustomeretcconfig.xml,因为我的新属性代码是 rfc,我找到了 条目和

After looking in the Magento's code and reading the wiki, I was able to complete it, 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 appcodecoreMageCustomeretcconfig.xml, I copied to appcodecoreMycompanyCustomeretcconfig.xml, as my new attribute code is rfc, I located the <fieldsets> entry and

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

现在我需要将新属性添加到 appcodecoreMageCustomerModelEntitySetup.php 我做了同样的覆盖,复制到我的本地命名空间,并在函数 getDefaultEntities() 中找到

now I need to add the new attribute to the appcodecoreMageCustomerModelEntitySetup.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,
    ),
)  

现在,我也需要在 appcodecoreMageSalesetcconfig.xml 中做同样的事情,但现在应该看起来像这样

now, I need to do also the same in appcodecoreMageSalesetcconfig.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>

希望能帮到别人

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

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)