By the time the product arrives he notices that the product is a little scratched and instead of sending it back he accepts to receive a discount.įor this to happen properly I would make a credit memo with an adjustment refund of let's say 30$. That would charge him a total amount of 110$. This bit isn't as important, so long as you add the data at a point before the order is saved.I've been searching for a module or a way to deal with the fallowing situation:Ī customer orders a product that is 100$ and pays shipping of 10$. $this->addColumnsOrder('box_num', (Mage::app()->isSingleStoreMode() ? 'grand_total' : 'store_id')) įinally, to finish off, in the event sales_convert_quote_to_order I populated the new field. Similarly, in My/Module/Block/Adminhtml/Customer/Edit/Tab/Orders.php and My/Module/Block/Adminhtml/Customer/Edit/Tab/View/Orders.php I added this function: protected function _prepareColumns() $this->addColumnsOrder('box_num', 'shipping_name') In My/Module/Block/Adminhtml/Sales/Order/Grid.php I made the following: addColumn('box_num', array( My_Module_Block_Adminhtml_Sales_Order_Grid My_Module_Block_Adminhtml_Customer_Edit_Tab_Orders My_Module_Block_Adminhtml_Customer_Edit_Tab_View_Orders To do this I overrode each relevant block. Next, I needed the extra column to show in all order tables in admin. $installer->getConnection()->addColumn($installer->getTable('sales_flat_order_grid'), 'box_num', 'varchar(255)') Here is my setup script: getConnection()->addColumn($installer->getTable('sales_flat_order'), 'box_num', 'varchar(255)') It's not an EAV-style entity so attributes don't need to be created. So any column you need in the grid table must also be in the main table. To begin with the sales_flat_order_grid is updated in Mage_Sales_Model_Mysql4_Order_Abstract::updateGridRecords(), by following the trail I worked out it inspects both the "main" table ( sales_flat_order) and the main table + "_grid" ( sales_flat_order_grid), takes the intersect of their columns and constructs a query from that. After a lot of trial and error - a lot of error - I think I have it now.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |