Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data is Protected. #1

Open
kish2011 opened this issue Apr 19, 2022 · 3 comments
Open

Data is Protected. #1

kish2011 opened this issue Apr 19, 2022 · 3 comments

Comments

@kish2011
Copy link

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'
]);

@Kushnerevich
Copy link

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

@kish2011
Copy link
Author

thanks @Kushnerevich

I am using this
foreach ($products->records() as $record) {
var_dump($record->data()['name']);
}

I'll try them :)

@Kushnerevich
Copy link

Kushnerevich commented Apr 20, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants