简体   繁体   English

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

[英]How to get price from the [product_option] returned by salesOrderInfo method of SOAP API

When I run following code in magento root 当我在magento根目录中运行以下代码时

$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>"; 

I get [product_options] like following way in output 我在输出中得到如下所示的[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";}";}

How can I get the product price from this? 如何从中获得产品价格? I there any direct function to access the price, instead of using unserialize ? 我有任何直接功能可以访问价格,而不是使用反unserialize吗?

您必须将本机PHP反unserialize函数作为unserialize($result['product_options'])调用,该函数应返回一个数组

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM