[英]Magento - Add custom attribute to order and add this attribute to collection filter
我遵循此鏈接中提到的方法<global> ... <fieldsets> <sales_convert_quote> <your_special_attribute> <to_order>*</to_order> </your_special_attribute> <sales_convert_quote> </fieldsets> ... </global>
向訂單添加自定義屬性,如下所示: <global> ... <fieldsets> <sales_convert_quote> <your_special_attribute> <to_order>*</to_order> </your_special_attribute> <sales_convert_quote> </fieldsets> ... </global>
將新的自定義屬性添加到訂單,並且效果很好。 但是我現在面臨的問題是當我在集合過濾中使用此屬性時,它不適用於以下代碼。
$orders = Mage::getResourceModel('sales/order_collection')->addFieldToSelect('*')->addAttributeToFilter("your_special_attribute", array("finset"=>'2'))->setOrder('created_at', 'desc');
將自定義屬性添加到訂單涉及幾個步驟。 首先,您必須在billing.phtml
文件中添加一個文本字段。 然后將該字段保存在Quote和Order表中,並編寫一些事件觀察器以捕獲報價保存,並將事件加載到config.xml
文件中。 第三步是在“我的帳戶”->“查看訂單”中顯示該字段。 接下來,我們需要在Admin-> Order-> View Order頁面中顯示我們的自定義字段。 每個步驟都涉及對某些文件的一些編碼修改。
如果可以指定您要面對的步驟,以便我突出顯示文件和在那里需要進行的更改。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.