Skip to content

Commit 016b594

Browse files
committed
Update Catalog\Products and Wishlists Files added
1 parent 5ef7235 commit 016b594

6 files changed

Lines changed: 267 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
4+
namespace Bigcommerce\Api\Resources;
5+
6+
use Bigcommerce\Api\Client;
7+
use Bigcommerce\Api\Resource;
8+
9+
class ProductBulkPricingRule extends Resource
10+
{
11+
protected $ignoreOnCreate = array(
12+
'id',
13+
'product_id'
14+
);
15+
16+
protected $ignoreOnUpdate = array(
17+
'id',
18+
'product_id'
19+
);
20+
21+
public $urls = array(
22+
"v3" => "/catalog/products"
23+
);
24+
25+
public function create($filter = array(), $version = "v3")
26+
{
27+
return Client::createProductBulkPricingRule($this->product_id, $this->getCreateFields(), $filter, $version);
28+
}
29+
30+
public function update($version = "v3")
31+
{
32+
return Client::updateProductBulkPricingRule($this->product_id, $this->id, $this->getUpdateFields(), $version);
33+
}
34+
35+
public function delete($version = "v3")
36+
{
37+
return Client::deleteProductBulkPricingRule($this->product_id, $this->id, $version);
38+
}
39+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
4+
namespace Bigcommerce\Api\Resources;
5+
6+
use Bigcommerce\Api\Client;
7+
use Bigcommerce\Api\Resource;
8+
9+
class ProductComplexRule extends Resource
10+
{
11+
protected $ignoreOnCreate = array(
12+
'id'
13+
);
14+
15+
protected $ignoreOnUpdate = array(
16+
'id'
17+
);
18+
19+
public $urls = array(
20+
"v3" => "/catalog/products"
21+
);
22+
23+
public function create($version = "v3")
24+
{
25+
return Client::createProductComplexRule($this->product_id, $this->getCreateFields(), $version);
26+
}
27+
28+
public function update($version = "v3")
29+
{
30+
return Client::updateProductComplexRule($this->product_id, $this->id, $this->getUpdateFields(), $version);
31+
}
32+
33+
public function delete($version = "v3")
34+
{
35+
return Client::deleteProductComplexRule($this->product_id, $this->id, $version);
36+
}
37+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
4+
namespace Bigcommerce\Api\Resources;
5+
6+
use Bigcommerce\Api\Client;
7+
use Bigcommerce\Api\Resource;
8+
9+
class ProductOptionValue extends Resource
10+
{
11+
12+
protected $ignoreOnCreate = array(
13+
'id',
14+
'product_id',
15+
'option_id'
16+
);
17+
18+
protected $ignoreOnUpdate = array(
19+
'id',
20+
'product_id',
21+
'option_id'
22+
);
23+
24+
public $urls = array(
25+
"v3" => "/catalog/products"
26+
);
27+
28+
public function create($version = "v3")
29+
{
30+
return Client::createProductOptionValue($this->product_id, $this->option_id, $this->getCreateFields(), $version);
31+
}
32+
33+
public function update($version = "v3")
34+
{
35+
return Client::updateProductOptionValue($this->product_id, $this->option_id, $this->id, $this->getUpdateFields(), $version);
36+
}
37+
38+
public function delete($version = "v3")
39+
{
40+
return Client::deleteProductOptionValue($this->product_id, $this->option_id, $this->id, $version);
41+
}
42+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
4+
namespace Bigcommerce\Api\Resources;
5+
6+
use Bigcommerce\Api\Client;
7+
use Bigcommerce\Api\Resource;
8+
9+
class ProductVariant extends Resource
10+
{
11+
protected $ignoreOnCreate = array(
12+
'id',
13+
'sku_id',
14+
'calculated_price',
15+
'calculated_weight',
16+
'map_price'
17+
);
18+
19+
protected $ignoreOnUpdate = array(
20+
'id',
21+
'product_id',
22+
'option_values',
23+
'sku_id',
24+
'calculated_price',
25+
'calculated_weight',
26+
'image_url',
27+
'map_price'
28+
);
29+
30+
public $urls = array(
31+
"v3" => "/catalog/products"
32+
);
33+
34+
public function meta_fields($id = null, $filter = array(), $version = "v3")
35+
{
36+
if (is_null($id)) {
37+
return Client::getProductVariantMetafields($this->product_id, $this->id, $filter, $version);
38+
} else {
39+
return Client::getProductVariantMetafield($this->product_id, $this->id, $id, $filter, $version);
40+
}
41+
}
42+
43+
public function create($filter = array(), $version = "v3")
44+
{
45+
return Client::createProductVariant($this->product_id, $this->getCreateFields(), $version);
46+
}
47+
48+
public function create_image($image_url, $version = "v3")
49+
{
50+
return Client::createProductVariantImage($this->product_id, $this->id, $image_url, $version);
51+
}
52+
53+
public function update($version = "v3")
54+
{
55+
return Client::updateProductVariant($this->product_id, $this->id, $this->getUpdateFields(), $version);
56+
}
57+
58+
public function delete($version = "v3")
59+
{
60+
return Client::deleteProductVariant($this->product_id, $this->id, $version);
61+
}
62+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
4+
namespace Bigcommerce\Api\Resources;
5+
6+
use Bigcommerce\Api\Client;
7+
use Bigcommerce\Api\Resource;
8+
9+
class ProductVariantMetafield extends Resource
10+
{
11+
protected $ignoreOnCreate = array(
12+
'id',
13+
'product_id'
14+
);
15+
16+
protected $ignoreOnUpdate = array(
17+
'id',
18+
'product_id'
19+
);
20+
21+
public $urls = array(
22+
"v3" => "/catalog/products"
23+
);
24+
25+
public function create($version = "v3")
26+
{
27+
return Client::createProductVariantMetafield($this->product_id, $this->resource_id, $this->getCreateFields(), $version);
28+
}
29+
30+
public function update($version = "v3")
31+
{
32+
return Client::updateProductVariantMetafield($this->product_id, $this->resource_id, $this->id, $this->getUpdateFields(), $version);
33+
}
34+
35+
public function delete($version = "v3")
36+
{
37+
return Client::deleteProductVariantMetafield($this->product_id, $this->resource_id, $this->id, $version);
38+
}
39+
40+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
4+
namespace Bigcommerce\Api\Resources;
5+
6+
use Bigcommerce\Api\Resource;
7+
use Bigcommerce\Api\Client;
8+
9+
class Wishlist extends Resource
10+
{
11+
protected $ignoreOnCreate = array(
12+
'id',
13+
);
14+
15+
protected $ignoreOnUpdate = array(
16+
'id',
17+
);
18+
19+
public $urls = array(
20+
"v3" => "/wishlists"
21+
);
22+
23+
public function create($version = "v3")
24+
{
25+
return Client::createWishlist($this->getCreateFields(), $version);
26+
}
27+
28+
public function update($version = "v3")
29+
{
30+
return Client::updateWishlist($this->id, $this->getUpdateFields(), $version);
31+
}
32+
33+
public function delete($version = "v3")
34+
{
35+
return Client::deleteWishlist($this->id, $version);
36+
}
37+
38+
public function addItems($object, $version = "v3")
39+
{
40+
return Client::createWishlistItems($this->id, $object, $version);
41+
}
42+
43+
public function toJson()
44+
{
45+
return parent::toJson();
46+
}
47+
}

0 commit comments

Comments
 (0)