Open kish2011 opened 2 years ago
@kish2011 You can use the url() and links() methods of the Collection object to access URLs and links. For details see: \Swell\Resource::url(), \Swell\Resource::links()
thanks @Kushnerevich
I am using this foreach ($products->records() as $record) { var_dump($record->data()['name']); }
I'll try them :)
@kish2011 $products is collection of products. It is iterable object. You can just do foreach, without ->records()
. *(1)**
\Swell\Resource::url(), \Swell\Resource::links() are system information, it is not about products detail. If you would like work with product information you have to use your method or method *(1)**
I am using this PHP lib to access the products. But all data are protected.
Swell\Collection Object ( [count] => 2 [pages] => [page] => 1 [url:protected] => /products [links:protected] => Array ( [variants] => Array ( [url] => /products:variants?parent_id={id} )
How do I access it? I am using this. Object is protected.
$swell = new \Swell\Client('store-id', 'secret-key');
$products = $swell->get('/products', [ 'search' => 'press' ]);