Giter Club home page Giter Club logo

bigcommerce-api-php's People

Contributors

aleachjr avatar atensoftware avatar bc-bfenton avatar bc-fabiob avatar bc-jz avatar bc-ruth avatar bookernath avatar bvmiko avatar funivan avatar gemorroj avatar johnhebron avatar kevinmatter avatar kubawerlos avatar lewiscowles1986 avatar lord2800 avatar maetl avatar mattolson avatar mikebaker85 avatar msznaper avatar nhedman avatar pascalzajac avatar philipmuir avatar rtalvarez avatar saranyan avatar sebastianszturo avatar splittingred avatar toma-r avatar watermark avatar zackkatz avatar zvuki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bigcommerce-api-php's Issues

GET selected OPTIONS for a OPTION_SET linked to a PRODUCT

I am using the API to get the Option Sets associated with a particular product.

At the back-end here's how things go.

  1. Add an Option Set
    createoptionsets
  2. Add Option
  3. Select Option Values
    selectoptionvalues

Now I am trying to figure out how to get the option values that are selected in step 3, but I cannot find any resource where anything about this is documented. I am not even sure if the API offers this functionality.

The current flow that I am using is

product -> option_set -> option -> option_values

This gives all the options available and not the ones that are selected.

Necklace -> someOptionSetName -> length -> {16, 17, 18, 19,  20, 21, 22, 23,  24}

What I want is

product -> option_set -> option -> selected_option_values ->option_values

ie.

Necklace -> someOptionSetName -> length -> {16,  20, 24}

So am I missing something? or the API doesn't support this?

Not compatible with PHP 5.2

The code throws this this exception:

Fatal error: Wrong parameters for Exception([string $exception [, long $code ]]) in /bigcommerce-bigcommerce-api-php-4c3b360/BigCommerce/Api/Connection.php on line 458

A quick Google said that this was because the third parameter for an exception was only in PHP 5.3.

Sorting & more filtering

Is there a way that results from products / brand requests are sorted in some way that is passed within the request (e.g. A-Z, Z-A), it would be also useful to have filtering of which fields are given (name, price, sku) instead of pulling all data for every product.

Thanks

brands filtering

Hi,

I am fetching brands from bigcommerce store through php api , but now i want to sort my brand in asseceding order by brand name .....
I am using php api to fetch brands and my code is as below :

$brands = BigCommerce_Api::getBrand($filter=false);

how can i get my brands in alphabetic order ?

examples in php not working...

hi! i dont have a schedule yet with a bigcommerce api developer and whats weird is that i'm not able to get an example to work. for instance, this works fine to get the product list:

<?php

require 'vendor/autoload.php';
 use Bigcommerce\Api\Client as Bigcommerce;

Bigcommerce::configure(array(
    'store_url' => 'https://store-xxxxx.mybigcommerce.com',
    'username'  => 'admin',
    'api_key'   => 'xxxxx'
));
Bigcommerce::setCipher('RC4-SHA');
Bigcommerce::verifyPeer(false);

$products = Bigcommerce::getproducts();

foreach($products as $product) {
    echo $product->name;
    echo $product->price;
}



?>

However, the same code and I can't read anything else [orders, time, anything]. Any thoughts or ideas? it just appears blank. I'm using IIS 7.0 along with PHP 5.3.x [FastCGI] in windows server 2008 r2:

<?php

require 'vendor/autoload.php';
 use Bigcommerce\Api\Client as Bigcommerce;

Bigcommerce::configure(array(
    'store_url' => 'https://store-xxxxx.mybigcommerce.com',
    'username'  => 'admin',
    'api_key'   => 'xxxxx'
));
Bigcommerce::setCipher('RC4-SHA');
Bigcommerce::verifyPeer(false);

    $orders = Bigcommerce::getOrders();

        foreach($orders as $order) {
            echo $order->name;
            echo $order->price;
        }

?>

Products not all adding...

Hi Products are not adding to categories all the time and out of say 73 products I am only getting 55... This is a little worrying as the error is that the product cannot be added to the category due to a resource conflict. These Products are being created, automatically added to the New category (which exists) as well as any other categories we have it mapped to using the category ID's provided by the API...

Worth noting using CSV import even less products get added, which is again... troubling...

Issue updating/adding images

Hi,

I am trying to add an image URL to a product. I am using the following php code, but get nothing in return.
If I use the same code to update a product but remove the 'images' bit, it works fine.

$fields = array( "product_id" => "$prodid", "images" => array("image_file" => "$image"));
$apiresult=BigCommerce_Api::updateProduct($prodid, $fields);

Updating orders error line 960 on bigcommerce.php

FYI, we had an issue updating orders->staff_notes, but kept getting...

Fatal error: Class 'Bigcommerce\Api\Resources\stdClass' not found in /home/thedevon/public_html/bigcommerce.php on line 960

Which is ...

$order = new stdClass();

We changed it to ...

$order = new \stdClass;

And now works fine.

how to configure bigcommerce-api-php

Hi,

I have downloaded the api from (https://github.com/bigcommerce/bigcommerce-api-php) .But I am not getting idea how to configure it and use.

I have also download the single php file(https://raw.github.com/bigcommerce/bigcommerce-api-php/master/bigcommerce.php) and put it inside the Bigcommerce1 folder and then include in my file containing code:

require 'Bigcommerce1/bigcommerce.php';
BigCommerce_Api::configure(array(
'store_url' => 'siteurl',
'username' => 'admin',
'api_key' => 'df38dd10e9665a3cfa667817d78ec91ee9384bc3'
));

But nothing work.Can you give me some light about how can I configure the api and use it.
Thanks.

SSL Error

Hi,

I'm trying to connect to the API for my store, but get the following error:

"SSL certificate problem, verify that the CA cert is OK"

I'm pretty sure my SSL certificate is properly installed, as it's one BigCommerce supplied.

Thanks

All responses are empty

This is caused by BigCommerce_Api_Connection::__construct() setting

curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, array($this, 'parseBody'));
rather then
curl_setopt($this->curl, CURLOPT_WRITEFUNCTION, array($this, 'parseBody'));

CURLOPT_RETURNTRANSFER wants only true or false and will return the response body back in curl_exec.

API Connection issue

Hi,

I have downloaded the bigcommerce API and created a test script using the get time sample.
I get the following error whenever trying to connect:

PHP Fatal error: Class 'Bigcommerce_Api_Connection' not found in /sm/Bigcommerce/Api.php on line 120

Fatal error: Class 'Bigcommerce_Api_Connection' not found in /sm/Bigcommerce/Api.php on line 120

My test code is just:

'https://storeurl.mybigcommerce.com/api/v2/', 'username' => 'apiusername', 'api_key' => 'token' )); $ping = Bigcommerce_Api::getTime(); if ($ping) echo $ping->format('H:i:s'); ?>

Can you assist as to why this error occurs?

Cannot create video via API

Okay I can create a video Via the API, but only by posting HTML content in the product description, and this requires modifications of the template etc (Please see my other issue regarding that), So it is not using the API in the strictest sense...

If we could have a way of posting Videos, or even just custom fields (also down in API docs as Read-Only) this could escape a lot of these issues.

BigCommerce Get Orders by Min/Max Date Created

I am attempting to filter orders using the min and max date fields. It seems that my filters are being completely ignored. Below is the debug of my filter array:

$filter array (3)
'limit' => integer 200
'min_date_created' => string (49) "Thu%2C%2027%20Feb%202014%2005%3A30%3A00%20%2B0000"
'max_date_created' => string (49) "Fri%2C%2028%20Feb%202014%2005%3A30%3A00%20%2B0000"

I am pulling the orders using

$totalOrders = Bigcommerce::getOrders($filter);

It appears that no matter how I try and format the dates, the function returns the same set of results, which are the first orders created in the system.

I pass the same filter to getOrdersCount (which I had to add the filter to), and I get the same count every time, which is the total number of orders in the store.

Getting problem in configuring bigcommerce-api-php

I have followed the all instruction in read me file.

  1. download file from here (https://raw.github.com/bigcommerce/bigcommerce-api-php/master/bigcommerce.php )single file.

  2. Put inside folder Bigcommerce like Bigcommerce/bigcommerce.php

  3. require 'Bigcommerce/bigcommerce.php

  4. write this code in my big.php file

require_once 'BigCommerce/bigcommerce.php';
Bigcommerce::configure(array(
'store_url' => 'https://store.mybigcommerce.com',
'username' => 'admin',
'api_key' => 'd81aada4c19c34d913e18f07fd7f36ca'
));

now getting error Class 'Bigcommerce' not found etc.

Please let me know if I am missing something.

In readme file there is one more line : To use the API client in your PHP code, ensure that you can access Bigcommerce\Apiin your autoload path (using Composer’s vendor/autoload.php hook is recommended).

is it required how to configure this?

I am getting nothing blank page is coming.

Api\Connection put() method "Too many open files" error.

The file handle needs to be closed after each call to the put() method, otherwise the calling server will eventually run out of resources if the same cURL initialization variable is being used over and over for multiple requests inside the same session.

Simply add the following to the end of the method:

curl_exec($this->curl);

fclose($handle); // DSB Added this line
curl_setopt($this->curl, CURLOPT_INFILE, STDOUT); // DSB Added this line

return $this->handleResponse();

POST request following a PUT request results in a 500 error.

When you submit a POST request following a PUT request a 500 error is returned.

Example;

$fields = array('name'=>'Optimus Prime');
Bigcommerce::updateCategory(5167, $fields);

$createFields = array('name'=>'Auto Bots');
Bigcommerce::createCategory($createFields);

Both of these requests work independently, but not together.
The items can be updated/created as expected using cURL, this issue only exists when using the library.

Product POST output

If I post products to bigcommerce there is a line that outputs my call on all POSTS
bigcommerce.php Line(s) 524-525
if (strstr($url, '/products')) {
//echo $body;
}

removing this line works wonders for not breaking API JSON feeds

Issue with $product->update();

I just downloaded a fresh copy of the PHP API.

I was unable to use:

$product->update();

It resulted in a 400 error.

The field 'downloads' cannot be written to. Please remove it from your request before trying again.

I tried unset($product->downloads) but had no luck as well.

I was able to do this without an issue:

BigCommerce_Api::updateProduct( $product->id, $newDataArray );

Add header to request

I can't figure out how to add a header to a request. For example: If-Modified-Since. It would be nice to retrieve orders by setting a min_date_created filter and then If-Modified-Since in the header to further limit the results without having to iterate over the results checking the value of 'date_modified' for each order.

Bug on the Sku class

For the following call:

$options = Client::getCollection($this->fields->options->resource, 'SkuOption');

the options field is an array and doesn't contain any resource property. It looks like the following:

array(1) { [0] => class stdClass#6367 (2) { public $product_option_id => int(1) public $option_value_id => int(1) } }

Bigcommerce product update API

I am using bigcommerce API to update product inventory values . There are about 3000 products to be updated.. With API a few hundred gets updated but after that it gives "could not connect to host". I am using same code on github which bigcommerce has provided. please help

Is there some kind of throttlelimit for bigcommerce product updation. ?

Please let me know

update() fails when an Order is Passed - Fix inside

When you call update() on an Order (usually to update it's status), it fails and nothing is changed at BigCommerce.

The issue is in line 960 of the single PHP file:
$order = new stdClass();

This is looking in the Bigcommerce namespace, where stdClass does not exist. The simple fix is:

$order = new \stdClass();

Then things work as expected.

No data returned from API

<?php
error_reporting(E_ALL);
ini_set('display_errors', True);
 require 'bigcommerce.php';
    use Bigcommerce\Api\Client as Bigcommerce;

    $settings = array('store_url' => 'https://STORE_URL_REDACTED.mybigcommerce.com', 'username' => 'USERNAME_REDACTED', 'api_key' => 'API_KEY_REDACTED');

    if( 
        (array_key_exists('store_url', (array)$settings)) &&
        (array_key_exists('username', $settings)) && 
        (array_key_exists('api_key', $settings)) 
    ) {
        // Config Basic
        Bigcommerce::configure(
            array(
                'store_url' => $settings['store_url'],
                'username'  => $settings['username'],
                'api_key'   => $settings['api_key']
            )
        );
        Bigcommerce::setCipher('RC4-SHA');
                Bigcommerce::verifyPeer(false);
    }    

$products = Bigcommerce::getProducts();

$orders = Bigcommerce::getOrders();

foreach($products as $product) {
    echo $product->name;
    echo $product->price;
}
?>

I've got output writing on the curl commands in bigcommerce.php, and I can see that I am actually connecting to the store:

I get the following error:

Warning: Invalid argument supplied for foreach() in /home/zetaphor/public_html/bigcommerce-api-php-master/coupons.php

My returned arrays contain no data.

GetRules Function

I don't see a public static function for getting Rules (getRules). Does something exist for this, can it be added?

Coupon bug - POST returns "ID" error

Doing a post method to create a new coupon is returning this error:

[{"status":400,"message":"The field 'id' cannot be written to. Please remove it from your request before trying again."}]

Its important to note that no ID field was provided in the JSON object. Basic examples were used from the Bigcommerce quickstarts section as well as our own new objects. All fail as it appears to be asserting a false positive for an ID within the object.

Creating Parent Categories

I have the Code below to create a category which works fine,
But i also need to create a Parent category ..

What's the best way to do that?

$CategoryName ="child_cat";
$mycategory = array('name' =>$CategoryName, 'search_keywords' =>$CategoryName , 'is_visible' => true);

Bigcommerce::createCategory($mycategory);

And if i want to create another Parent Category for that, is it possible and how?

Inserting Product images

I have been trying to upload Product images through the API without Success.
The Code below states that, the images field can not be writen to and i get the 400 error..

$fields = array( "product_id" => "$prodid", "images" => array("image_file" => "$image"));
$apiresult=BigCommerce_Api::updateProduct($prodid, $fields);

So i tried the code below.

$image = new Bigcommerce_Api_ProductImage();
$image->product_id = $prodid;
$image->image_file = $image;
// etc..
$image->create();

Which then says the Class 'ProductImage' not found.

Is this a namespace issue?

Failed to set cipher list

Hey guys,

I am trying to work with your API and I have had an app in production working fine for a couple months now. About 2 days ago however we started to be unable to use the api getting the following

[Bigcommerce\Api\NetworkError] failed setting cipher list

We changed nothing on our end (that I am aware of) and it still works on my dev environment just not on production.

The odd thing is that getting products seems to work fine the stack trace seems to indicate that the failure happens when attempting to retrieve the images for the product.

() at /vendor/bigcommerce/api/src/Bigcommerce/Api/Connection.php:212 Bigcommerce\Api\Connection->handleResponse() at /vendor/bigcommerce/api/src/Bigcommerce/Api/Connection.php:303 Bigcommerce\Api\Connection->get() at /vendor/bigcommerce/api/src/Bigcommerce/Api/Client.php:140 Bigcommerce\Api\Client::getCollection() at /vendor/bigcommerce/api/src/Bigcommerce/Api/Resources/Product.php:55 Bigcommerce\Api\Resources\Product->images()

Was there a backend change you guys made that I need to be accounting for? (Again this works fine on my dev environment). I'm at a loss.

btw the ciphers I have tried are RC4-SHA and the default of rsa_rc4_128_sha

php pear channel problem

Hello,

I try: 'pear channel-discover bigcommerce.github.com/bigcommerce-api-php' ,

but answer was

'Discovering channel bigcommerce.github.com/bigcommerce-api-php over http:// failed with message: channel-add: Cannot open "http://bigcommerce.github.com/bigcommerce-api-php/channel.xml" (File http://bigcommerce.github.com:80/bigcommerce-api-php/channel.xml not valid (received: HTTP/1.1 404 Not Found
))
Trying to discover channel bigcommerce.github.com/bigcommerce-api-php over https:// instead
Discovery of channel "bigcommerce.github.com/bigcommerce-api-php" failed (channel-add: Cannot open "https://bigcommerce.github.com/bigcommerce-api-php/channel.xml" (Connection to `bigcommerce.github.com:443' failed: Connection refused))'

Please help me.
Thank you.

How do I start the push from bigcommerce webhooks ?

I have been finding ways to test the bigcommerce webhooks is there anyone who has tried it successfully? I have download master zip. Are there any examples out there on how bigcommerce alert me on the new changes made on products on my store with the products id?

suggestion: order products

public static function getOrderProducts($id)
{
return self::getCollection('/orders/' . $id . '/products', 'Order');
}

Empty Order Array

I'm new to this API, and I've been trying the Quick Start code examples, but when pulling orders using:

$orders = Bigcommerce::getOrders();
foreach ($orders as $order){
echo $order->name;
}

It returns an empty array, even though I definitely have orders. Also, how would I go about updating an order status?

tax_class_id of 0

A tax_class_id of 0 is valid and maps to the default tax class, but you can't set a product's tax_class_id to 0 using the product update. Additionally, when the tax_class resource is pulled when the tax class is set to 0, it returns all of the tax classes instead of the tax class assigned to that product.

Customer Accepts Email Marketing

When a customer places an order on BigCommerce they're able to state whether they wish to receive email marketing.

Is it possibly, or could it be possible, to retrieve this value from the api?

I'm not sure whether this would need to be part of the customer api or the order api, but would definitely be handy either way.

Thanks.

Suggestion: Add Shipments capability

At the moment, there is no capability in the library to add shipments to orders (e.g. /orders/101/shipments). I've built the rest of my integration with this library, but needed to create shipments with cURL - not ideal, especially because I think confirming products shipped is probably a fairly common use case.

HTML posting

If I post HTML to a product description (Useful for allowing me to add YouTube video's regardless of API support) then they come through great on my BigCommerce Store. So this is a valid workaround for adding video's IMHO.

If however I try to edit the product from within BigCommerce Admin Back-End, then it rather un-helpfully fixes the markup for me (I am posting broken markup so that I can add accordion Items such as YouTube, and to break up content to make the product pages more readable and user-friendly)

Please provision for an API option to stop BigC "Helping" with content, even a button to stop it fixing DOM errors would be great.

Products return empty

I am trying to implement this into codeigniter like so:

               $this->load->library('client/connection');
               $this->load->library('client/client');
               $this->load->library('client/filter');
               $this->load->library('client/product');
               $this->load->library('client/Resource');
               $this->load->library('client/Order');
               $this->client->configure(array(
                  'store_url' => 'https://store-fuh8f4r.mybigcommerce.com/api/v2/',
                  'username' => 'escott',
                  'api_key' => '75dff2b3121f65cf201e9eebd421e3d899f80f92'
                  ));

                $this->client->configure(array(
                  'store_url' => 'https://store-fuh8f4r.mybigcommerce.com/api/v2/',
                  'username' => 'escott',
                  'api_key' => '75dff2b3121f65cf201e9eebd421e3d899f80f92'
               ));
              $products = $this->client->getProducts();

                foreach($products as $product) {
                    echo"<pre>";
                    print_r($product);
                    echo"</pre>";
                }

               $ping = $this->client->getTime();
               if ($ping) 
              {
                    echo $ping->format('H:i:s');
               }

The time is returned, so I think the connection is successful, however, none of the products will return. I'll only get this:

 Product Object
(
[ignoreOnCreate:protected] => Array
    (
        [0] => date_created
        [1] => date_modified
    )

[ignoreOnUpdate:protected] => Array
    (
        [0] => id
        [1] => rating_total
        [2] => rating_count
        [3] => date_created
        [4] => date_modified
        [5] => date_last_imported
        [6] => number_sold
        [7] => brand
        [8] => images
        [9] => discount_rules
        [10] => configurable_fields
        [11] => custom_fields
        [12] => videos
        [13] => skus
        [14] => rules
        [15] => option_set
        [16] => options
        [17] => tax_class
    )

[ignoreIfZero:protected] => Array
    (
        [0] => tax_class_id
    )

)

Error code vs. Error status

The return result object on an error is delivering
status
message
details

Your documentation mentions that is is delivering
code
which it isn't.

suggestion: customer address

get customer address

public static function getAddresses($id)
{
return self::getResource('/customers/'.$id.'/addresses');
}

Order->update is broken

I recently had to hack into my local copy of this API as the line "$order->is_deleted = $this->is_deleted;" causes the API to generate an error to the effect that "is_deleted" is not a valid update field.

Coupon bug - applies_to deleted

After some testing we discovered that updating a product with a "max_uses" and "max_uses_per_customer" set to 1 (amount may not matter), disassociated the 'applies_to' resource.

Basically it disassociated all the coupons from the products they were associated to.

$order->products()

"/orders/{orderId}/products.json" seems to have an undocumented api for limit. As it is now, $order->products() will only return 50 line items, even if there are more than that on the order.

I propose:
Adding a param to $order->products() so you can specify a new limit

editing the BigCommerce API documentation to reflect that there is a limit variable and by default it caps at 50.

Images uploaded via api loose their filename

For some reason when upoaded to the CDN via the BigCommerce API the images loose their file names, this is interfering with a plugin by scriptilabs, who I am told are a bigcommerce developer...

Configuring Issue

Hello, I have installed composer.phar on "httpdocs" folder. I have uploaded all the bigcommerce files under "bigcommerce" folder and this folder is exits under "httpdocs" folder. I have also setup the store url with api token on "index.php" file but when running the file then nothing is displaying on the page.

Please help me how to solve this issue.

Regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.