我有以下代码来覆盖 V2.php
class Sigma_Sales_Model_Order_Api_V2 extends Mage_Sales_Model_Order_Api_V2
{
public function info($orderIncrementId)
{
$result = parent::info( $orderIncrementId );
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
$orderItems = $order->getItemsCollection();
$skuQtyArray = array();
foreach ($orderItems as $item)
{
$product_id = $item->product_id;
$product_sku = $item->sku;
$item_id = $item->getItemId();
$tax_percent = $item->gettaxPercent();
$product_qty = $item->getQtyOrdered();
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $product_sku);
$productType=$product->getTypeID();
if($productType=='simple')
{
$skuQtVal = $product_sku."=".$item_id;
$skuQtyArray[] = $skuQtVal;
}
}
$result['simple_product_skus'] = array_unique($skuQtyArray);
return $result;
}
}
现在我正在访问它
<?php
$client = new SoapClient('localhost/magento/index.php/api/v2_soap/index?wsdl=1');
$session = $client->login('testuser', 'testuser');
$result = $client ->salesOrderInfo($session, '100000026');
print_r($result);
?>
输出就像
stdClass Object
(
------
------
------
[status_history] => Array
(
[0] => stdClass Object
(
[parent_id] => 72
[created_at] => 2013-11-08 14:42:11
[is_customer_notified] => 1
[status] => pending
)
)
[simple_product_skus] => Array
(
[0] => ASL-B346-67-64-98=155=166=1.0000=0.0000
[1] => ASL-B346-67-64-98=156=116=1.0000=0.0000
)
)
我想要 simple_product_skus 作为 stdClass 对象,就像我得到 status_history 一样。
我怎样才能得到这个请帮忙。