如何从SOAP API的salesOrderInfo方法返回的[product_option]获取价格

问题描述 投票:0回答:1

当我在 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 magento magento-soap-api
1个回答
1
投票

您必须将原生 PHP

unserialize
函数调用为
unserialize($result['product_options'])
,它应该返回一个数组

© www.soinside.com 2019 - 2024. All rights reserved.