Skip to content

Commit bbaf1b8

Browse files
committed
optionset options support for POST
1 parent aedaa63 commit bbaf1b8

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
vendor
22
composer.lock
3-
*.sh
3+
*.sh
4+
script/*
5+

scripts/create_optionsets.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
require 'vendor/autoload.php';
4+
use Bigcommerce\Api\Client as Bigcommerce;
5+
6+
error_reporting(E_ALL);
7+
ini_set('display_errors', '1');
8+
9+
10+
Bigcommerce::configure(array(
11+
'store_url' => 'https://store-bwvr466.mybigcommerce.com',
12+
'username' => 'saranyan',
13+
'api_key' => 'd7948f71684475c6b6d8b29c36ae37cd'
14+
));
15+
16+
17+
18+
Bigcommerce::setCipher('RC4-SHA');
19+
Bigcommerce::verifyPeer(false);
20+
21+
// $option = array('name' => 'h simpson', 'type' => 'T');
22+
23+
// $options = Bigcommerce::createOptions($option);
24+
// print_r($options);
25+
26+
// $optionset = array('name' => 'Crazy S family');
27+
// $oset = Bigcommerce::createOptionsets($optionset);
28+
// print_r($oset)
29+
30+
$option = array('option_id' => 34, 'display_name' => "Crazy Simpson Family");
31+
$optionset_id = 29;
32+
$options = Bigcommerce::createOptionsets_Options($option,$optionset_id);
33+
print_r($options);
34+
?>

src/Bigcommerce/Api/Client.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,13 @@ public static function getOptions($filter=false)
354354
return self::getCollection('/options' . $filter->toQuery(), 'Option');
355355
}
356356

357+
/** create options **/
358+
public static function createOptions($object)
359+
{
360+
return self::createResource('/options', $object);
361+
}
362+
363+
357364
/**
358365
* Return the number of options in the collection
359366
*
@@ -375,6 +382,8 @@ public static function getOption($id)
375382
return self::getResource('/options/' . $id, 'Option');
376383
}
377384

385+
386+
378387
/**
379388
* Delete the given option.
380389
*
@@ -680,6 +689,19 @@ public static function getOptionSets($filter=false)
680689
return self::getCollection('/optionsets' . $filter->toQuery(), 'OptionSet');
681690
}
682691

692+
/** create optionsets **/
693+
public static function createOptionsets($object)
694+
{
695+
return self::createResource('/optionsets', $object);
696+
}
697+
698+
/** connect optionsets options **/
699+
public static function createOptionsets_Options($object, $id)
700+
{
701+
return self::createResource('/optionsets/'.$id.'/options', $object);
702+
}
703+
704+
683705
/**
684706
* Returns the total number of option sets in the collection.
685707
*

0 commit comments

Comments
 (0)