Magento在签出中保存新创建的订单属性值
我创建了一个新的order属性。代码如下所示;Magento在签出中保存新创建的订单属性值,magento,Magento,我创建了一个新的order属性。代码如下所示; $installer = $this; $installer->startSetup(); $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->addAttribute('order', 'location', array( 'position' => 50, 'type' =>
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('order', 'location', array(
'position' => 50,
'type' => 'text',
'label' => 'Location',
'global' => 1,
'visible' => 0,
'required' => 1,
'user_defined' => 1,
'searchable' => 0,
'filterable' => 1,
'comparable' => 1,
'visible_on_front' => 0,
'visible_in_advanced_search' => 0,
'unique' => 0,
'is_configurable' => 0,
'position' => 1,
));
$installer->endSetup();
然后我需要将该属性值保存在签出中。我为“销售订单保存之前”操作创建了一个观察者函数
public function saveLocationOrderattributes(Varien_Event_Observer $observer){
$event = $observer->getEvent();
$order = $event->getOrder();
$locationid = '10';
$order->setLocation($locationid);
Mage::getSingleton('custommodule/custommodule')->saveLocationOrderattributes($order);
return $this;
}
我没有得到任何错误。然后,我检查了订单详细信息中的值。什么也没有得到
谁能告诉我如何保存订单的属性值
谢谢你当我说我听到安·埃勒说记忆力超群。分配的内存为168M
you can try the code: $order->save();