当我在 magento root 中运行以下代码时
$client = new SoapClient('http://localhost/mymagento/index.php/api/v2_soap/index?wsdl=1', array('cache_wsdl' => WSDL_CACHE_NONE));
$session = $client->login('testuser', 'testuser');
$result = $client->salesOrderInfo($session,'100000097');
echo"<pre>";
print_r($result);
echo"</pre>";
我在输出中得到了[product_options],如下所示
[product_options] => a:2:{s:15:"info_buyRequest";a:10:{s:4:"uenc";s:100:"aHR0cDovL2RlbW8uc2lnbWFpbmZvLmluOjgzL3JmZy9pbmRleC5waHAvbGFuZXNzZS1vY2Nhc2lvbmFsLXRhYmxlLXNldC5odG1s";s:7:"product";s:3:"115";s:15:"related_product";s:0:"";s:3:"qty";s:1:"1";s:13:"bundle_option";a:3:{i:47;s:3:"129";i:48;s:3:"131";i:49;s:3:"133";}s:17:"bundle_option_qty";a:3:{i:47;s:1:"1";i:48;s:1:"1";i:49;s:1:"1";}s:22:"select_super_attribute";a:1:{i:48;a:1:{i:182;s:3:"164";}}s:5:"block";a:1:{i:0;s:7:"options";}s:5:"awacp";s:1:"1";s:8:"no_cache";s:1:"1";}s:27:"bundle_selection_attributes";s:122:"a:4:{s:5:"price";d:159;s:3:"qty";d:1;s:12:"option_label";s:31:"Save on these additional pieces";s:9:"option_id";s:2:"49";}";}
如何从中获取产品价格? 我有任何直接的函数来访问价格,而不是使用
unserialize
?
您必须将原生 PHP
unserialize
函数调用为 unserialize($result['product_options'])
,它应该返回一个数组