Skip to content

Commit 8132ee3

Browse files
committed
README update : custom actions example, search() and count() listed
1 parent 9cbe93a commit 8132ee3

File tree

3 files changed

+43
-11
lines changed

3 files changed

+43
-11
lines changed

README.md

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PHPShopify uses curl extension for handling http calls to the API. So you need t
2525

2626
You can use PHPShopify in a pretty simple object oriented way.
2727

28-
#### Configure ShopifyClient
28+
#### Configure ShopifyClient SDK
2929
If you are using your own private API, provide the ApiKey and Password. For Third party apps, use the permanent access token which you have got from the app.
3030

3131
```php
@@ -52,7 +52,7 @@ $shopify = new PHPShopify\ShopifyClient($config);
5252
```
5353

5454
##### Now you can do `get()`, `post()`, `put()`, `delete()` calling the resources in the object oriented way. All resources are named as same as it is named in shopify API reference. (See the resource map below.)
55-
> All the requests returns an array (which can be single resource or an array of multiple resources) if succeeded. When no result is expected (for example a DELETE request), an empty array will be returned.
55+
> All the requests returns an array (which can be a single resource array or an array of multiple resources) if succeeded. When no result is expected (for example a DELETE request), an empty array will be returned.
5656
5757
Get all product list (GET request)
5858

@@ -118,6 +118,7 @@ $shopify->WebHook($webHookID)->delete());
118118

119119
###The child resources can be used in a nested way.
120120
> You must provide the ID of the parent resource when trying to get any child resource
121+
121122
For example, get the images of a product (GET request)
122123

123124
```php
@@ -174,7 +175,7 @@ Delete any specific article from a specific blog (DELETE request)
174175
$blogArticle = $shopify->Blog($blogID)->Article($articleID)->delete();
175176
```
176177

177-
### Available Resource Mapping
178+
### Resource Mapping
178179
Some resources are available directly, some resources are only available through parent resources and a few resources can be accessed both ways. It is recommended that you see the details in the related Shopify API Reference page about each resource. Each resource name here is linked to related Shopify API Reference page.
179180
> Use the resources only by listed resource map. Trying to get a resource directly which is only available through parent resource may end up with errors.
180181
@@ -236,13 +237,34 @@ Some resources are available directly, some resources are only available through
236237
- Theme -> [Asset](https://help.shopify.com/api/reference/asset/)
237238
- [User](https://help.shopify.com/api/reference/user) _(read only, Shopify Plus Only_
238239
- [Webhook](https://help.shopify.com/api/reference/webhook)
239-
- []()
240240

241-
### Custom actions
242-
There are several action methods which can be called without calling the `get()`, `post()`, `put()`, `delete()` methods directly, which eventually results in a custom call to one of the `get()`, `post()`, `put()`, `delete()` methods.
243-
The custom methods are specific to some resources which may not be available for other resources. It is recommended that you see the details in the related Shopify API Reference page about each action. We will just list the available actions here with some brief info.
241+
### Custom Actions
242+
There are several action methods which can be called without calling the `get()`, `post()`, `put()`, `delete()` methods directly, but eventually results in a custom call to one of those methods.
243+
244+
For example, get count of total projects
245+
```php
246+
$productCount = $shopify->Product->count();
247+
```
248+
249+
Make an address default for the customer.
250+
```php
251+
$shopify->Customer($customerID)->Address($addressID)->makeDefault();
252+
```
244253

245-
- Comment ->
254+
Search for customers with keyword "Bob" living in country "United States".
255+
```php
256+
$shopify->Customer->search("Bob country:United States");
257+
```
258+
259+
#### Custom Actions List
260+
The custom methods are specific to some resources which may not be available for other resources. It is recommended that you see the details in the related Shopify API Reference page about each action. We will just list the available actions here with some brief info. each action name is linked to an example in Shopify API Reference which has more details information.
261+
262+
- _(Any resource type)_ ->
263+
- [count()](https://help.shopify.com/api/reference/product#count)
264+
Get a count of all the resources.
265+
Unlike all other actions, this function returns an integer value.
266+
267+
- Comment ->
246268
- [spam()](https://help.shopify.com/api/reference/comment#spam)
247269
Mark a Comment as spam
248270
- [notSpam()](https://help.shopify.com/api/reference/comment#not_spam)
@@ -254,10 +276,14 @@ The custom methods are specific to some resources which may not be available for
254276
- [restore()](https://help.shopify.com/api/reference/comment#restore)
255277
Restore a Comment
256278

279+
- Customer ->
280+
- [search()](https://help.shopify.com/api/reference/customer#search)
281+
Search for customers matching supplied query
282+
257283
- Customer -> Address ->
258284
- [makeDefault()](https://help.shopify.com/api/reference/customeraddress#default)
259285
Sets the address as default for the customer
260-
- [set()](https://help.shopify.com/api/reference/customeraddress#set)
286+
- [set($params)](https://help.shopify.com/api/reference/customeraddress#set)
261287
Perform bulk operations against a number of addresses
262288

263289
- Discount ->
@@ -277,6 +303,8 @@ The custom methods are specific to some resources which may not be available for
277303
- GiftCard ->
278304
- [disable()](https://help.shopify.com/api/reference/gift_card#disable)
279305
Disable a gift card.
306+
- [search()](https://help.shopify.com/api/reference/gift_card#search)
307+
Search for gift cards matching supplied query
280308

281309
- Order -> Refund ->
282310
- [calculate()](https://help.shopify.com/api/reference/refund#calculate)
@@ -296,5 +324,5 @@ The custom methods are specific to some resources which may not be available for
296324
- [current()](https://help.shopify.com/api/reference/user#current)
297325
Get the current logged-in user
298326

299-
#Reference
327+
## Reference
300328
- [Shopify API Reference](https://help.shopify.com/api/reference/)

lib/Customer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
*
2020
* @method ShopifyAPI Address(integer $id = null)
2121
* @method ShopifyAPI Metafield(integer $id = null)
22-
*
22+
* --------------------------------------------------------------------------
23+
* Customer -> Custom actions
24+
* --------------------------------------------------------------------------
25+
* @method array search() Search for customers matching supplied query
2326
*/
2427
class Customer extends ShopifyAPI
2528
{

lib/GiftCard.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* GiftCard -> Custom actions
1616
* --------------------------------------------------------------------------
1717
* @method array disable() Disable a gift card. Disabling a gift card is permanent and cannot be undone.
18+
* @method array search() Search for gift cards matching supplied query
1819
*
1920
*/
2021
class GiftCard extends ShopifyAPI

0 commit comments

Comments
 (0)