Magento - Add custom attribute to order

前端 未结 1 829
予麋鹿
予麋鹿 2020-12-28 17:06

I\'m trying to add a custom field to my orders. At this moment, I found the post bellow that helped me to create such attribute in my database: http://fabrizioballiano.net/2

相关标签:
1条回答
  • 2020-12-28 17:22

    Add this to the gobal scope in config.xml. Then simply set the attribute in the quote - it gets automagically transferred to the order in the quote to order conversion process.

    <global>
    ...
        <fieldsets>
            <sales_convert_quote>
                <your_special_attribute>
                    <to_order>*</to_order>
                </your_special_attribute>
            </sales_convert_quote>
        </fieldsets>
    ...
    </global>
    

    You can retrieve/set the attribute at any time via the magic getter/setter e.g.

    $quote->getYourSpecialAttribute()
    $order->getYourSpecialAttribute()
    
    $quote->setYourSpecialAttribute()
    
    0 讨论(0)
提交回复
热议问题