【发布时间】:2015-09-13 11:08:37
【问题描述】:
在尝试访问产品 SKU 的“选项”array_object 时,Bigcommerce API 遇到了一些问题。
我可以访问 SKU 对象中的所有其他内容,但不能访问 Options - 在 $sku->options 上执行 print_r 不会显示任何返回的数据,而 var_dump 会显示 '(bool)false'。这是我的代码:
$filter = array('sku' => '940801DB');
$skus = Bigcommerce::getSkus($filter);
foreach ( $skus as $sku ){
echo '<pre>';
print_r( $sku->options );
echo '</pre>';
}
任何想法如何访问这个数组/对象?
更多信息:
如果我 print_r($sku) 我得到:
Array
(
[0] => Bigcommerce\Api\Resources\Sku Object
(
[ignoreOnCreate:protected] => Array
(
[0] => product_id
)
[ignoreOnUpdate:protected] => Array
(
[0] => id
[1] => product_id
)
[fields:protected] => stdClass Object
(
[id] => 1
[product_id] => 225
[sku] => 940801DB
[cost_price] => 0.0000
[upc] =>
[inventory_level] => 0
[inventory_warning_level] => 0
[bin_picking_number] =>
[options] => Array
(
[0] => stdClass Object
(
[product_option_id] => 1
[option_value_id] => 834
)
[1] => stdClass Object
(
[product_option_id] => 2
[option_value_id] => 829
)
[2] => stdClass Object
(
[product_option_id] => 3
[option_value_id] => 827
)
)
)
[id:protected] => 1
[ignoreIfZero:protected] => Array
(
)
[fieldMap:protected] => Array
(
)
)
)
【问题讨论】:
-
你解决了这个问题?
-
不,还没有解决...
标签: php arrays object foreach bigcommerce