我无法在php中将SOAP响应转换为Array.
这是代码
$response = $client->__doRequest($xmlRequest,$location,$action,1);
Run Code Online (Sandbox Code Playgroud)
这是SOAP响应.
<soap:envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:body>
<searchflightavailability33response xmlns="http://FpwebBox.Fareportal.com/Gateway.asmx">
<searchflightavailability33result>
<Fareportal><FpSearch_AirLowFaresRS><CntKey>1777f5a7-7824-46ce-a0f8-33d5e6e96816</CntKey><Currency CurrencyCode="USD"/><OriginDestinationOptions><OutBoundOptions><OutBoundOption segmentid="9W7008V21Feb14"><FlightSegment etc....
</searchflightavailability33result>
</searchflightavailability33response>
</soap:body>
</soap:envelope>;
Run Code Online (Sandbox Code Playgroud)
我使用以下方法转换为数组,但我得到空输出.
1.echo '<pre>';print_r($client__getLastResponse());
2.echo '<pre>';print_r($response->envelope->body->searchflightavailability33response);
3.echo '<pre>';print_r($client->SearchFlightAvailability33($response));
4.simplexml_load_string($response,NULL,NULL,"http://schemas.xmlsoap.org/soap/envelope/");
5.echo '<pre>';print_r($client->SearchFlightAvailability33($response));
Run Code Online (Sandbox Code Playgroud)
请指教.
我尝试使用以下代码删除/清除购物车商品,它已删除购物车中的所有商品.但未添加新商品/商品.
二手代码
1.Mage::getSingleton('checkout/session')->clear();
2.Mage::getSingleton('checkout/cart')->truncate();
3.$quote = Mage::getSingleton('checkout/session')->getQuote();
$quote->delete();
4.Mage::getSingleton('checkout/cart')->truncate()->save();
5.Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
6.foreach( Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection() as $item ){
Mage::getSingleton('checkout/cart')->removeItem( $item->getId() )->save();
}
7.$cartHelper = Mage::helper('checkout/cart');
$items = $cartHelper->getCart()->getItems();
foreach ($items as $item)
{
$itemId = $item->getItemId();
$cartHelper->getCart()->removeItem($itemId)->save();
}
8.$quote = Mage::getSingleton('checkout/session')->getQuote();
$item = $quote->getItemByProduct($product);
$quote->removeItem($item->getId());
9.$quote->removeAllItems();
Run Code Online (Sandbox Code Playgroud)
请任何人建议我以上我的要求.谢谢你提前.
谢谢arumugam