简体   繁体   English

Magento-客户地址中的自定义属性,在结帐时未复制到sales_flat_order_address和sales_flat_quote_address

[英]Magento - Custom attribute in customer address, not copied to sales_flat_order_address and sales_flat_quote_address on checkout

I have created a new attribute 'county' in customer address. 我在客户地址中创建了一个新属性“县”。 It is working fine and I am able to save values in this field from the frontend. 它工作正常,我可以从前端在此字段中保存值。

I want this field available in address of orders. 我希望此字段在订单地址中可用。 So I have added a column 'county' in the tables 因此,我在表格中添加了“县”列

'sales_flat_quote_address' and 'sales_flat_order_address' “ sales_flat_quote_address”和“ sales_flat_order_address”

Then I have modified Sales/etc/config.xml to include this field in fieldsets. 然后,我修改了Sales / etc / config.xml以将该字段包括在字段集中。 I have added entries for this field in 我已经在此字段中添加了条目

sales_copy_order_billing_address, sales_copy_order_billing_address,
sales_copy_order_shipping_address, sales_copy_order_shipping_address,
sales_convert_quote_address, sales_convert_quote_address,
sales_convert_order_address, sales_convert_order_address,
customer_address customer_address

But when I do onepage checkout, the value in this field is not copied to the address in orders. 但是,当我进行一页结帐时,此字段中的值不会按订单复制到地址中。 I am selecting an existing address with value in this field during checkout for billing and shipping address. 我在结帐时选择了一个现有地址,该地址在此字段中具有值,以作为帐单和收货地址。

Right now, I have not edited any template file in checkout to include this field. 目前,我尚未在签出中编辑任何模板文件来包含此字段。 But as I am selecting an existing address, this shouldn't be causing the problem, right ? 但是当我选择一个现有地址时,这不应该引起问题,对吗?

I am using magento 1.5.1.0. 我正在使用magento 1.5.1.0。 While I know php well, I am kind of a newbie in magento. 虽然我很了解php,但是我还是magento的新手。

I have checked the question Magento: save custom address attribute in checkout and have done everything as given in the answer. 我已经检查了Magento问题:在结帐中保存自定义地址属性,并做了答案中给出的所有操作。

Have I missed out something. 我错过了什么吗? If so, please provide your suggestion. 如果是这样,请提供您的建议。 Thanks. 谢谢。

Have you checked out the Config.xml in Sales/etc, and looked at the "sales_copy_order_billing_address" sections. 您是否已在Sales / etc中检出Config.xml,并查看了“ sales_copy_order_billing_address”部分。

This defines which column gets copied over from table1 to "mapped columns" in table2. 这定义将哪一列从table1复制到table2中的“映射的列”。

So, add County to the list, wherever the data gets copied over for Shipping Address, and Billing address. 因此,无论将数据复制到“送货地址”和“帐单地址”的位置,都将“县”添加到列表中。

That XML mapping gets used when code like the following, gets executed: 当执行以下代码时,将使用XML映射:

Mage::helper('core')->copyFieldset('customer_address', 'to_quote_address', $address, $this);

The first parameter is the "from table column" node mapping, and the second parameter is the "to table column" mapping. 第一个参数是“ from table column”节点映射,第二个参数是“ to table column”映射。

Hope this works. 希望这行得通。

Try this in one of your module's config.xml file... 在模块的config.xml文件之一中尝试此操作...

<global>
...
    <fieldsets>
        <customer_address>
            <county>
                <to_quote_address>*</to_quote_address>
                <to_order_address>*</to_order_address>
            </county>
         </customer_address>
    </fieldsets>
...
</global>

Make sure you have created county field in both tables ( sales_flat_quote_address and sales_flat_order_address ). 确保在两个表( sales_flat_quote_addresssales_flat_order_address )中都创建了County字段。

I have tried this, and it is worked for me, please add this xml code to our module config.xml file 我已经尝试过了,并且对我有用,请将此xml代码添加到我们的模块config.xml文件中

<global>
        <fieldsets>
            <sales_convert_quote_address>
                <govt_id>
                    <to_order_address>*</to_order_address>
                    <to_customer_address>*</to_customer_address>
                </govt_id>
            </sales_convert_quote_address>
            <customer_address>
                <govt_id>
                    <to_quote_address>*</to_quote_address>
                </govt_id>
            </customer_address>
        </fieldsets>
    </global>

Have you cleared / disabled cache as well? 您是否也清除/禁用了缓存? Also do not modify core config files, better create module and extend fieldsets with your own 也不要修改核心配置文件,更好地创建模块并使用自己的扩展字段集

I have got it working. 我已经做好了。 I did not have to add anything else. 我不必添加任何其他内容。

The problem was that, I had copied config.xml from app/code/ core /Mage/Sales/etc to app/code/ local /Mage/Sales/etc and made my changes in the new one. 问题是,我已将config.xml从app / code / core / Mage / Sales / etc复制到app / code / local / Mage / Sales / etc,并在新文件中进行了更改。

When I made the changes in the original config.xml file itself and tested, the custom field value was copied to the order address on checkout. 当我对原始config.xml文件本身进行更改并进行测试时,自定义字段值在结帐时已复制到订单地址。

Thanks. 谢谢。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到表“ sales_flat_quote_address”-复制现有的Magento网站以在本地运行时 - Can't find the table “sales_flat_quote_address”- While Copying an existing Magento site to run locally 在magento的销售订单网格集合中添加自定义客户地址属性 - Add custom customer address attribute in sales order grid collection in magento Magento - 向sales_flat_quote_item和sales_flat_order_item添加新列 - Magento - Adding a new column to sales_flat_quote_item and sales_flat_order_item 未完成Magento订单创建sales_flat_quote_item - Magento Order creation sales_flat_quote_item not being made 在一页结帐时,Magento的sales_flat_order表中的customer_email列填充在哪里? - Where does the customer_email column get populated from in the sales_flat_order table in Magento on onepage checkout? Magento以编程方式创建sales / quote_address对象 - Magento programmatically creating a sales/quote_address object 在sales_flat_quote和sales_flat_order_item表中添加额外信息 - Adding extra information in sales_flat_quote and sales_flat_order_item tables Magento:在结帐时保存自定义地址属性 - Magento: save custom address attribute in checkout Magento 2自定义地址属性未在结帐页面的地址簿中加载 - Magento 2 custom address attribute not loading in address book in checkout page 在magento中完成订单后,更新sales_flat_order表的自定义列 - Update a custom column of sales_flat_order table after order complete in magento
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM