php - Bigcommerce Product SKU's -> Options -


having little trouble bigcommerce api when trying access product sku's 'options' array_object.

i can access else within sku object, not options - doing print_r on $sku->options doesn't show returned data , var_dump shows '(bool)false'. here code:

$filter = array('sku' => '940801db'); $skus = bigcommerce::getskus($filter);  foreach ( $skus $sku ){     echo '<pre>';     print_r( $sku->options );     echo '</pre>'; } 

any ideas how access array/object?

further info:

if print_r($sku) get:

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             (             )      ) ) 

this seems bug of bigcommerce api. installed using composer, if take @ source code of bigcommerce api, inside vendor/bigcommerce/api/src/bigcommerce/api/resources/sku.php:

public function options() {     $options = client::getcollection($this->fields->options->resource, 'skuoption');      foreach ($options $option) {         $option->product_id = $this->product_id;     }      return $options; } 

see gets $this->fields->options->resource, options array doesn't have resource in it. in products it's this:

"options": {     "url": "https://store-et7xe3pz.mybigcommerce.com/api/v2/products/32/options.json",     "resource": "/products/32/options"   }, 

but in sku it's this:

"options": [       {         "product_option_id": 15,         "option_value_id": 18       },       {         "product_option_id": 16,         "option_value_id": 26       }     ] 

seems bug me.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -