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

发布于 2024-10-31 06:50:57 字数 280 浏览 0 评论 0原文

这就是我在我的网站中所做的:管理->客户->属性->管理客户地址属性并添加新属性,用户可以在他/她的个人资料中看到它,在我的地址选项下,新属性可以编辑并在创建新地址时保存,我也可以在后端看到它并进行编辑,直到这里一切正常,我的问题出在结帐中,我已经在帐单和运输表格中包含该字段,并且我希望当用户单击“下订单”按钮时保存新属性,但是,checkout 似乎对新属性一无所知,该属性不会保存,如果我从用户配置文件中保存一个值,checkout 不会保存“ t 将其加载到现场。

我可以在这里做什么?

谢谢

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??

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

廻憶裏菂餘溫 2024-11-07 06:50:57

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

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

现在我需要将新属性添加到 app\code\core\Mage\Customer\Model\Entity\Setup.php 我做了同样的覆盖,复制到我的本地命名空间,并在函数 getDefaultEntities() 我找到了

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

现在,我还需要在 app\code\core\Mage\Sales\etc\config.xml 中执行相同的操作,但现在应该看起来像这样

<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>

希望它可以帮助别人

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 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 located the <fieldsets> entry and

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

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>

Hope it can help someone else

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文