Skip to content

Commit 6d2290d

Browse files
authored
Update README.md
1 parent 016b594 commit 6d2290d

1 file changed

Lines changed: 138 additions & 90 deletions

File tree

README.md

Lines changed: 138 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -87,95 +87,6 @@ All 'v3' methods has `$version` parameter which can be used if you didn't set ve
8787

8888
All the 'Get' Methods has `$filter = array()` if applicable to set query parameters
8989

90-
Products(V2 and V3)
91-
------------
92-
you can get products and its variants, options variant metafields.
93-
~~~php
94-
Bigcommerce::configure(array(
95-
'client_id' => 'xxxxxxxxxxxxxxxxxxxxxx',
96-
'auth_token' => 'xxxxxxxxxxxxxxxxxxxxxxx',
97-
'store_hash' => 'xxxxxxxxx',
98-
'version' => 'v3' //optional By Default set as 'v2'
99-
));
100-
101-
$products = Bigcommerce::getProducts(); //getProducts($filter = array(), $version = null);
102-
103-
foreach($products as $item){
104-
echo $item->name."\n";
105-
$videos = $item->videos();
106-
}
107-
108-
//Single Product
109-
110-
$product = Bigcommerce::getProduct(1);
111-
112-
//To get that product variants
113-
114-
$variants = $product->variants(); //or Bigcommerce::getProduct(1)->variants(123);
115-
116-
//To get Meta fields for a Single Variant
117-
118-
$variant_metafield = Bigcommerce::getProducts(1)->variants(123)->meta_fields();
119-
120-
//To delete a Meta field
121-
122-
$variant_metafield->delete(); //or Bigcommerce::getProduct(1)->variants(123)->meta_fields(1)->delete();
123-
~~~
124-
The Product Instance has following member functions
125-
126-
~~~php
127-
$product = Bigcommerce::getProduct(1);
128-
129-
// Member Function works only on 'v3'
130-
//All the 'v3' Resource Class has create(), update() and delete() functions
131-
132-
$product->bulk_pricing_rules(1)->delete(); // Delete bulk pricing id 1 for product id 1
133-
$bulk = $product->bulk_pricing_rules(); // Retrieve all Bulk Pricing rules for product id 1
134-
$complex_rules = $product->complex_rules(); // or Bigcommerce::getProductComplexRules($product_id);
135-
136-
$variants = $product->variants(); // or Bigcommerce::getProductVariants($product_id);
137-
$variant = $product->variant(1);
138-
139-
//'ProductVariant' Object has meta_fields(), create_image(), create(), update(), delete() functions
140-
141-
$variant->create_image("https://image.jpg"); // ProductVariantObject->create_image($image_url);
142-
143-
$variant_metafield = $variant->meta_fields(); // 'ProductVariantMetafield' object has create(), update(), delete() functions
144-
$variant_metafield->delete();
145-
146-
// ProductObject->options() works on both 'v2' and 'v3' but ProductObject->options(1)->values() works only on 'v3'
147-
// So, By default ProductObject->options($version = "v3") set to version 'v3'
148-
149-
$options = $product->options("v2");
150-
$option_values = $product->options("v3")->values();
151-
$option_value = $product->options("v3")->values(1);
152-
$option_value->delete();
153-
154-
// Member Functions works on both 'v2' and 'v3'
155-
156-
$brand = $product->brand();
157-
$image = $product->images(1)->delete(); // or Bigcommerce::getProductImage(1);
158-
$videos = $product->videos(); // or Bigcommerce::getProductVideos();
159-
160-
$video = $product->videos(1); // or Bigcommerce::getProductVideo(1);
161-
$video->name = "Updated Video"; // or Bigcommerce::updateProductVideo($product_id, $video_id, $array);
162-
$video->update(); // or $video->delete(); // or Bigcommerce::deleteProductVideo($product_id, $video_id);
163-
164-
$custom_fields = $product->custom_fields(); // or Bigcommerce::getProductCustomFields($product_id);
165-
$reviews = $product->reviews(); // or Bigcommerce::getProductReviews($product_id);
166-
167-
// Member Functions works only on 'v2'
168-
// May return empty data since 'v2' has been abandoned by Bigcommerce
169-
170-
$skus = $product->skus();
171-
$rules = $product->rules();
172-
$configurable_rules = $product->configurable_rules();
173-
$discount_rules = $product->discount_rules();
174-
$option_set = $product->option_set();
175-
$tax_class = $product->tax_class();
176-
~~~
177-
**Product Modifiers and Meta Fields are still in Development**
178-
17990
Carts(V3)
18091
------------
18192
you can do almost all the functions in cart.
@@ -316,8 +227,145 @@ Bigcommerce::updateCartLineItem("xxxxxxxxx","xxxxxxxxx",$item);
316227
~~~php
317228
Bigcommerce::deleteCartLineItem("xxxxxxxxx","xxxxxxxxx");
318229
~~~
230+
231+
Products(V2 and V3)
232+
------------
233+
you can get products and its variants, options variant metafields.
234+
~~~php
235+
Bigcommerce::configure(array(
236+
'client_id' => 'xxxxxxxxxxxxxxxxxxxxxx',
237+
'auth_token' => 'xxxxxxxxxxxxxxxxxxxxxxx',
238+
'store_hash' => 'xxxxxxxxx',
239+
'version' => 'v3' //optional By Default set as 'v2'
240+
));
241+
242+
$products = Bigcommerce::getProducts(); //getProducts($filter = array(), $version = null);
243+
244+
foreach($products as $item){
245+
echo $item->name."\n";
246+
$videos = $item->videos();
247+
}
248+
249+
// Single Product
250+
// 'Product' Object has create(), update(), delete() functions and more explained in below examples
251+
252+
$product = Bigcommerce::getProduct(1);
253+
$product->name = "Test 1";
254+
$product->update();
255+
256+
$product->delete();
257+
258+
259+
$variants = $product->variants();
260+
//or
261+
Bigcommerce::getProduct(1)->variants(123);
262+
263+
264+
//To get Meta fields for a Single Variant
265+
$variant_metafield = Bigcommerce::getProducts(1)->variants(123)->meta_fields();
266+
267+
268+
$variant_metafield->delete();
269+
//or
270+
Bigcommerce::getProduct(1)->variants(123)->meta_fields(1)->delete();
271+
~~~
272+
The Product Instance has following member functions
273+
274+
~~~php
275+
$product = Bigcommerce::getProduct(1);
276+
277+
/* Member Function works only on 'v3' */
278+
// All the 'v3' Resource Class has create(), update() and delete() functions
279+
280+
281+
// Delete bulk pricing id 1 for product id 1
282+
$product->bulk_pricing_rules(1)->delete();
283+
284+
285+
// 'ProductBulkPricingRule' Object has create(), update(), delete() functions
286+
287+
// Retrieve all Bulk Pricing rules for product id 1
288+
$bulk = $product->bulk_pricing_rules();
289+
290+
291+
// 'ProductComplexRule' Object has create(), update(), delete() functions
292+
293+
$complex_rules = $product->complex_rules();
294+
// or Bigcommerce::getProductComplexRules($product_id);
295+
296+
297+
$variants = $product->variants();
298+
// or Bigcommerce::getProductVariants($product_id);
299+
300+
301+
$variant = $product->variant(1);
302+
303+
//'ProductVariant' Object has meta_fields(), create_image(), create(), update(), delete() functions
304+
305+
$variant->create_image("https://image.jpg");
306+
// ProductVariantObject->create_image($image_url);
307+
308+
309+
// 'ProductVariantMetafield' object has create(), update(), delete() functions
310+
311+
$variant_metafield = $variant->meta_fields();
312+
$variant_metafield->delete();
313+
314+
315+
// ProductObject->options() works on both 'v2' and 'v3' but ProductObject->options(1)->values() works only on 'v3'
316+
// So, By default ProductObject->options($version = "v3") set to version 'v3'
317+
318+
$options = $product->options("v2");
319+
$option_values = $product->options("v3")->values();
320+
$option_value = $product->options("v3")->values(1);
321+
$option_value->delete();
322+
323+
324+
/* Member Functions works on both 'v2' and 'v3' */
325+
326+
$brand = $product->brand();
327+
328+
$image = $product->images(1)->delete();
329+
// or Bigcommerce::getProductImage(1);
330+
331+
332+
$videos = $product->videos();
333+
// or Bigcommerce::getProductVideos();
334+
335+
$video = $product->videos(1);
336+
// or Bigcommerce::getProductVideo(1);
337+
338+
$video->name = "Updated Video";
339+
// or Bigcommerce::updateProductVideo($product_id, $video_id, $array);
340+
341+
$video->update(); // or $video->delete();
342+
// or Bigcommerce::deleteProductVideo($product_id, $video_id);
343+
344+
345+
$custom_fields = $product->custom_fields();
346+
// or Bigcommerce::getProductCustomFields($product_id);
347+
348+
349+
$reviews = $product->reviews();
350+
// or Bigcommerce::getProductReviews($product_id);
351+
352+
353+
/* Member Functions works only on 'v2' */
354+
// May return empty data since 'v2' has been abandoned by Bigcommerce
355+
356+
357+
$skus = $product->skus();
358+
$rules = $product->rules();
359+
$configurable_rules = $product->configurable_rules();
360+
$discount_rules = $product->discount_rules();
361+
$option_set = $product->option_set();
362+
$tax_class = $product->tax_class();
363+
~~~
364+
**Product Modifiers and Product Meta Fields are still in Development**
365+
319366

320-
##Brands (V2 and V3)
367+
Brands (V2 and V3)
368+
----------------------
321369
you can use both 'v2' and 'v3' in Brands and I'm trying to do the same for all new versions.
322370

323371
**Get All Brands**: `getBrands($filter = array(), $version = null);`

0 commit comments

Comments
 (0)