2013-12-20 103 views
2

我需要一点帮助。我正在与大型商业API合作,并且我陷入了一个困境。这是我想要实现的。我已经检索了订单详情,然后从中获得了产品。现在我想以某种方式获得附加到特定产品的选项。从Big Commerce获取产品选项

这是我的代码看起来像......

$minutes_to_go_back = 165;        
$time = time() - ($minutes_to_go_back * 60);//calculating time 
$date = date(DateTime::RFC2822,$time);//getting date in required format 
$filter = array('min_date_created' => $date);//query filter 
$orders = Bigcommerce::getOrders($filter);//received all the orders in last '$minutes_to_go_back' minutes 
$order_products = $orders[$i]->products();//getting products of orders..one by one traversing through orders 
print_r($order_products); 

这是它打印。

enter image description here

你会看到有写着礼品消息的选项。我想获得它的价值。有人可以请指导我如何做到这一点?

在此先感谢您的帮助。 艾哈迈德

+0

我也遇到过这个问题,有一个[GitHub上的问题](https://github.com/bigcommerce/bigcommerce-api-php/issues/45),可能会得到解决。 – Zetaphor

+0

我设法自己解决了这个问题... – Omicans

+0

你怎么能解决这个问题?我已经联系他们的API团队请求更新和/或修复。 – Zetaphor

回答

0

几天用的Bigcommerce团队的工作后,我终于能得到这个问题的解决是自己用的,所以我认为解决方案将有助于我们进一步的同胞谷歌旅客:

include_once './vendor/autoload.php'; 
use Bigcommerce\Api\Client as Bigcommerce; 

Bigcommerce::configure(array(
    'store_url' => 'YOUR_URL', 
    'username' => 'YOUR_USERNAME', 
    'api_key' => 'YOUR_API_KEY' 
)); 
Bigcommerce::setCipher('RC4-SHA'); 
Bigcommerce::verifyPeer(false); 


$ping = Bigcommerce::getTime(); 
if ($ping) echo $ping->format('H:i:s'); 

$orderID = "78165"; 

$options = Bigcommerce::getCollection('/orders/' . $orderID . '/products/', 'OrderProduct'); 
print_r($options);