Skip to content

Commit 64dd208

Browse files
authored
Update README.md
1 parent 13741fc commit 64dd208

File tree

1 file changed

+137
-138
lines changed

1 file changed

+137
-138
lines changed

README.md

Lines changed: 137 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,143 @@ 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 do all the functions of Products and More...
93+
94+
~~~php
95+
Bigcommerce::configure(array(
96+
'client_id' => 'xxxxxxxxxxxxxxxxxxxxxx',
97+
'auth_token' => 'xxxxxxxxxxxxxxxxxxxxxxx',
98+
'store_hash' => 'xxxxxxxxx',
99+
'version' => 'v3' //optional By Default set as 'v2'
100+
));
101+
102+
$products = Bigcommerce::getProducts(); //getProducts($filter = array(), $version = null);
103+
104+
foreach($products as $item){
105+
echo $item->name."\n";
106+
$videos = $item->videos();
107+
}
108+
109+
// Single Product
110+
// 'Product' Object has create(), update(), delete() functions and more explained in below examples
111+
112+
$product = Bigcommerce::getProduct(1);
113+
$product->name = "Test 1";
114+
$product->update();
115+
116+
$product->delete();
117+
118+
119+
$variants = $product->variants();
120+
//or
121+
Bigcommerce::getProduct(1)->variants(123);
122+
123+
124+
//To get Meta fields for a Single Variant
125+
$variant_metafield = Bigcommerce::getProducts(1)->variants(123)->meta_fields();
126+
127+
128+
$variant_metafield->delete();
129+
//or
130+
Bigcommerce::getProduct(1)->variants(123)->meta_fields(1)->delete();
131+
~~~
132+
**The 'Product' Object has following member functions**
133+
134+
**Member Function works only on 'v3'**
135+
All the 'v3' Resource Class has `create(), update() and delete()` functions
136+
~~~php
137+
$product = Bigcommerce::getProduct(1);
138+
139+
140+
// Delete bulk pricing id 1 for product id 1
141+
$product->bulk_pricing_rules(1)->delete();
142+
143+
144+
// Retrieve all Bulk Pricing rules for product id 1
145+
$bulk = $product->bulk_pricing_rules();
146+
147+
148+
$complex_rules = $product->complex_rules();
149+
// or Bigcommerce::getProductComplexRules($product_id);
150+
151+
152+
$variants = $product->variants();
153+
// or Bigcommerce::getProductVariants($product_id);
154+
155+
156+
$variant = $product->variant(1);
157+
158+
//'ProductVariant' Object has meta_fields(), create_image(), create(), update(), delete() functions
159+
160+
$variant->create_image("https://image.jpg");
161+
// ProductVariantObject->create_image($image_url);
162+
163+
164+
// 'ProductVariantMetafield' object has create(), update(), delete() functions
165+
166+
$variant_metafield = $variant->meta_fields();
167+
$variant_metafield->delete();
168+
169+
170+
// ProductObject->options() works on both 'v2' and 'v3' but ProductObject->options(1)->values() works only on 'v3'
171+
// So, By default ProductObject->options($version = "v3") set to version 'v3'
172+
173+
$options = $product->options("v2");
174+
$option_values = $product->options("v3")->values();
175+
$option_value = $product->options("v3")->values(1);
176+
$option_value->delete();
177+
~~~
178+
179+
**Member Functions works on both 'v2' and 'v3'**
180+
Below are the function that works on both `v2` and `v3` versions
181+
you can override the default version by setting it in functions like: `Bigcommerce::getProduct(1)->brand("v3");`
182+
183+
~~~php
184+
$product = Bigcommerce::getProduct(1);
185+
186+
$brand = $product->brand();
187+
188+
$image = $product->images(1)->delete();
189+
// or Bigcommerce::getProductImage(1);
190+
191+
192+
$videos = $product->videos();
193+
// or Bigcommerce::getProductVideos();
194+
195+
$video = $product->videos(1);
196+
// or Bigcommerce::getProductVideo(1);
197+
198+
$video->name = "Updated Video";
199+
// or Bigcommerce::updateProductVideo($product_id, $video_id, $array);
200+
201+
$video->update(); // or $video->delete();
202+
// or Bigcommerce::deleteProductVideo($product_id, $video_id);
203+
204+
205+
$custom_fields = $product->custom_fields();
206+
// or Bigcommerce::getProductCustomFields($product_id);
207+
208+
209+
$reviews = $product->reviews();
210+
// or Bigcommerce::getProductReviews($product_id);
211+
~~~
212+
213+
**Member Functions works only on 'v2'**
214+
Some functions may return empty data since 'v2' has been abandoned by Bigcommerce
215+
~~~php
216+
$product = Bigcommerce::getProduct(1);
217+
218+
$skus = $product->skus();
219+
$rules = $product->rules();
220+
$configurable_rules = $product->configurable_rules();
221+
$discount_rules = $product->discount_rules();
222+
$option_set = $product->option_set();
223+
$tax_class = $product->tax_class();
224+
~~~
225+
**Product Modifiers and Product Meta Fields are still in Development**
226+
90227
Carts(V3)
91228
------------
92229
you can do almost all the functions in cart.
@@ -228,144 +365,6 @@ Bigcommerce::updateCartLineItem("xxxxxxxxx","xxxxxxxxx",$item);
228365
Bigcommerce::deleteCartLineItem("xxxxxxxxx","xxxxxxxxx");
229366
~~~
230367

231-
Products(V2 and V3)
232-
------------
233-
You can do all the functions of Products and More...
234-
235-
~~~php
236-
Bigcommerce::configure(array(
237-
'client_id' => 'xxxxxxxxxxxxxxxxxxxxxx',
238-
'auth_token' => 'xxxxxxxxxxxxxxxxxxxxxxx',
239-
'store_hash' => 'xxxxxxxxx',
240-
'version' => 'v3' //optional By Default set as 'v2'
241-
));
242-
243-
$products = Bigcommerce::getProducts(); //getProducts($filter = array(), $version = null);
244-
245-
foreach($products as $item){
246-
echo $item->name."\n";
247-
$videos = $item->videos();
248-
}
249-
250-
// Single Product
251-
// 'Product' Object has create(), update(), delete() functions and more explained in below examples
252-
253-
$product = Bigcommerce::getProduct(1);
254-
$product->name = "Test 1";
255-
$product->update();
256-
257-
$product->delete();
258-
259-
260-
$variants = $product->variants();
261-
//or
262-
Bigcommerce::getProduct(1)->variants(123);
263-
264-
265-
//To get Meta fields for a Single Variant
266-
$variant_metafield = Bigcommerce::getProducts(1)->variants(123)->meta_fields();
267-
268-
269-
$variant_metafield->delete();
270-
//or
271-
Bigcommerce::getProduct(1)->variants(123)->meta_fields(1)->delete();
272-
~~~
273-
**The 'Product' Object has following member functions**
274-
275-
**Member Function works only on 'v3'**
276-
All the 'v3' Resource Class has `create(), update() and delete()` functions
277-
~~~php
278-
$product = Bigcommerce::getProduct(1);
279-
280-
281-
// Delete bulk pricing id 1 for product id 1
282-
$product->bulk_pricing_rules(1)->delete();
283-
284-
285-
// Retrieve all Bulk Pricing rules for product id 1
286-
$bulk = $product->bulk_pricing_rules();
287-
288-
289-
$complex_rules = $product->complex_rules();
290-
// or Bigcommerce::getProductComplexRules($product_id);
291-
292-
293-
$variants = $product->variants();
294-
// or Bigcommerce::getProductVariants($product_id);
295-
296-
297-
$variant = $product->variant(1);
298-
299-
//'ProductVariant' Object has meta_fields(), create_image(), create(), update(), delete() functions
300-
301-
$variant->create_image("https://image.jpg");
302-
// ProductVariantObject->create_image($image_url);
303-
304-
305-
// 'ProductVariantMetafield' object has create(), update(), delete() functions
306-
307-
$variant_metafield = $variant->meta_fields();
308-
$variant_metafield->delete();
309-
310-
311-
// ProductObject->options() works on both 'v2' and 'v3' but ProductObject->options(1)->values() works only on 'v3'
312-
// So, By default ProductObject->options($version = "v3") set to version 'v3'
313-
314-
$options = $product->options("v2");
315-
$option_values = $product->options("v3")->values();
316-
$option_value = $product->options("v3")->values(1);
317-
$option_value->delete();
318-
~~~
319-
320-
**Member Functions works on both 'v2' and 'v3'**
321-
Below are the function that works on both `v2` and `v3` versions
322-
you can override the default version by setting it in functions like: `Bigcommerce::getProduct(1)->brand("v3");`
323-
324-
~~~php
325-
$product = Bigcommerce::getProduct(1);
326-
327-
$brand = $product->brand();
328-
329-
$image = $product->images(1)->delete();
330-
// or Bigcommerce::getProductImage(1);
331-
332-
333-
$videos = $product->videos();
334-
// or Bigcommerce::getProductVideos();
335-
336-
$video = $product->videos(1);
337-
// or Bigcommerce::getProductVideo(1);
338-
339-
$video->name = "Updated Video";
340-
// or Bigcommerce::updateProductVideo($product_id, $video_id, $array);
341-
342-
$video->update(); // or $video->delete();
343-
// or Bigcommerce::deleteProductVideo($product_id, $video_id);
344-
345-
346-
$custom_fields = $product->custom_fields();
347-
// or Bigcommerce::getProductCustomFields($product_id);
348-
349-
350-
$reviews = $product->reviews();
351-
// or Bigcommerce::getProductReviews($product_id);
352-
~~~
353-
354-
**Member Functions works only on 'v2'**
355-
Some functions may return empty data since 'v2' has been abandoned by Bigcommerce
356-
~~~php
357-
$product = Bigcommerce::getProduct(1);
358-
359-
$skus = $product->skus();
360-
$rules = $product->rules();
361-
$configurable_rules = $product->configurable_rules();
362-
$discount_rules = $product->discount_rules();
363-
$option_set = $product->option_set();
364-
$tax_class = $product->tax_class();
365-
~~~
366-
**Product Modifiers and Product Meta Fields are still in Development**
367-
368-
369368
Brands (V2 and V3)
370369
----------------------
371370
you can use both 'v2' and 'v3' in Brands and I'm trying to do the same for all new versions.

0 commit comments

Comments
 (0)