如何在magento管理面板中获取info_buyRequest?

时间:2013-05-18 12:31:29

标签: magento magento-1.7

您好我需要在magento管理面板中查看其他一个产品属性。我需要获得info_buyRequest-> projectid。我的数据库表是 sales_flat_order_item 我的字段名称是 product_options

我的记录如下:

a:7:{s:15:"info_buyRequest";a:9:{s:2:"id";s:3:"715";s:7:"product";s:3:"288";s:15:"related_product";s:0:"";s:15:"super_attribute";a:2:{i:143;s:2:"69";i:144;s:2:"71";}s:7:"options";a:4:{i:79;s:3:"165";i:80;s:3:"166";i:78;s:3:"163";i:81;s:3:"359";}s:15:"attachment_hash";a:1:{i:215;s:32:"cbe019a075d376c0632dae49774370bb";}s:9:"projectid";s:2:"39";s:3:"qty";i:1;s:11:"reset_count";b:1;}s:7:"options";a:4:{i:0;a:7:{s:5:"label";s:7:"Coating";s:5:"value";s:21:"UV - Ultra High Gloss";s:11:"print_value";s:21:"UV - Ultra High Gloss";s:9:"option_id";s:2:"79";s:11:"option_type";s:9:"drop_down";s:12:"option_value";s:3:"165";s:11:"custom_view";b:0;}i:1;a:7:{s:5:"label";s:6:"Colors";s:5:"value";s:18:"Full Color 2 Sides";s:11:"print_value";s:18:"Full Color 2 Sides";s:9:"option_id";s:2:"80";s:11:"option_type";s:9:"drop_down";s:12:"option_value";s:3:"166";s:11:"custom_view";b:0;}i:2;a:7:{s:5:"label";s:5:"Paper";s:5:"value";s:20:"14pt Thick Cardstock";s:11:"print_value";s:20:"14pt Thick Cardstock";s:9:"option_id";s:2:"78";s:11:"option_type";s:9:"drop_down";s:12:"option_value";s:3:"163";s:11:"custom_view";b:0;}i:3;a:7:{s:5:"label";s:13:"Need a Design";s:5:"value";s:20:"Yes, I need a Design";s:11:"print_value";s:20:"Yes, I need a Design";s:9:"option_id";s:2:"81";s:11:"option_type";s:9:"drop_down";s:12:"option_value";s:3:"359";s:11:"custom_view";b:0;}}s:15:"attributes_info";a:2:{i:0;a:2:{s:5:"label";s:8:"Quantity";s:5:"value";s:4:"1000";}i:1;a:2:{s:5:"label";s:10:"Turnaround";s:5:"value";s:15:"4 Business Days";}}s:11:"simple_name";s:34:"2.75x4 Flyers-1000-4 Business Days";s:10:"simple_sku";s:33:"275x4-flyers-1000-4 Business Days";s:20:"product_calculations";i:1;s:13:"shipment_type";i:0;}

我需要在magento管理面板中获得projectid

  

admin / sales_order / view / order_id / 43 / page

我怎么能得到它请告知......

2 个答案:

答案 0 :(得分:0)

getAdditionalData()

中查看Mage_Sales_Model_Order_Item

尝试

$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
$items = $order->getAllVisibleItems();

foreach ($items as $itemId => $item){
    $item->getAdditionalData('projectid')
}

答案 1 :(得分:0)

如果您使用的是 Magento 版本 2,只需通过订单存储库中的 order_id 加载订单,完成后您将获得数据中的 info_buyrequest,您可以通过 getBuyRequest() 获得,并通过 json_decode 将其反序列化或调用 Magento 工具来执行此操作,如果 Magento 1 使用 PHP 反序列化来执行此操作,并且 M2 不支持该数据,则您显示的 buy_request 数据。