Ok, looking at the source, it seems you should be able to use the magic __get
method. Try
$array[0][0]->name == 'Artist'
Domanda
The array I am looking at is this:
Array
(
[0] => Array
(
[0] => Bigcommerce\Api\Resources\ProductCustomField Object
(
[ignoreOnCreate:protected] => Array
(
[0] => id
[1] => product_id
)
[ignoreOnUpdate:protected] => Array
(
[0] => id
[1] => product_id
)
[fields:protected] => stdClass Object
(
[id] => 17
[product_id] => 3232
[name] => Artist
[text] => Test
)
[id:protected] => 17
[ignoreIfZero:protected] => Array
(
)
)
)
)
I want to check to see if 'Artist' exists in a php conditional statement. But I don't know how to turn 'Artist' into a string.
UPDATED: I did not find understand how to extract that value into a string, but I got what I was looking for using the method related to the bigcommerce api:
$customs = Bigcommerce::getProductCustomFields($product->id);
foreach($customs as $custom) {
if($custom->name == 'Artist'): // do something
endif;
}
Soluzione
Ok, looking at the source, it seems you should be able to use the magic __get
method. Try
$array[0][0]->name == 'Artist'
Altri suggerimenti
The value of the custom field would be stored in the "text" resource for that custom field.
See the following link where you can see the 4 properties of a custom field. https://developer.bigcommerce.com/api/stores/v2/products/custom_fields