Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento在签出中保存新创建的订单属性值_Magento - Fatal编程技术网

Magento在签出中保存新创建的订单属性值

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' =>

我创建了一个新的order属性。代码如下所示;
$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();