Closed Ctucker9233 closed 1 year ago
You don't need to request each brand from the API, you should be able to do the following:
$brands = $api->catalog()->brands()->getAll()->getBrands();
foreach ($brands as $brand) {
echo $brand->name, PHP_EOL;
}
Note that if you don't want to deal with pages and are happy to wait you can call $brands = $client->catalog()->brands()->getAllPages()->getBrands();
to get every brand in one call.
oh, and the reason this code didn't work is because you missed the getBrand()
off the end of the query, so the $vendor
variable was actually the API Response variable
I can get a single vendor, but for some reason I can't get the 'name' property. Can someone help me with the syntax?
$brands = $api->catalog()->brands()->getAllPages(['id:less' => 150])->getBrands();
I'm trying to get the name to match up to my database.