<?php

/**
 * Script to turn on related products for ALL products
 * @author Robert Mullins <*****@*****.**>
 * @license The MIT License (MIT)
 */
require 'bigcommerce.php';
use Bigcommerce\Api\Client as Bigcommerce;
/* API Connection */
Bigcommerce::configure(array('store_url' => 'https://store-********.mybigcommerce.com', 'username' => '*******', 'api_key' => '***********************'));
Bigcommerce::verifyPeer(false);
Bigcommerce::setCipher('RC4-SHA');
$num_of_products = Bigcommerce::getProductsCount();
if ($num_of_products <= 250) {
    $max_pages = 1;
} else {
    $pages_double = $num_of_products / 250;
    $pages_int = (int) ($num_of_products / 250);
    if ($pages_double > $pages_int) {
        $max_pages = $pages_int + 1;
    } else {
        $max_pages = $pages_int;
        //If 250 goes into number of products evenly (rare)
    }
}
$fields = array('related_products' => '-1');
$processed = array();
//Collection returns duplicates sometimes, this will hold the ID of all products we processed.
$current_page = 1;
while ($current_page <= $max_pages) {
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('kalley/laravel-bigcommerce');
     $store_url = $this->config('store_url');
     $username = $this->config('username');
     $api_key = $this->config('api_key');
     Bigcommerce::configure(['store_url' => $store_url, 'username' => $username, 'api_key' => $api_key]);
 }
Example #3
0
<?php

require 'bigcommerce.php';
use Bigcommerce\Api\Client as Bigcommerce;
Bigcommerce::configure(array('store_url' => 'https://www.*.com', 'username' => 'bigcommerce', 'api_key' => '02ce2b26456456540db4017d34'));
Bigcommerce::verifyPeer(false);
Bigcommerce::setCipher('RC4-SHA');
$num_of_products = Bigcommerce::getProductsCount();
if ($num_of_products <= 250) {
    $max_pages = 1;
} else {
    $pages_double = $num_of_products / 250;
    $pages_int = (int) ($num_of_products / 250);
    if ($pages_double > $pages_int) {
        $max_pages = $pages_int + 1;
    } else {
        $max_pages = $pages_int;
        //If 250 goes into number of products evenly (rare)
    }
}
$processed = array();
//Collection returns duplicates sometimes, this will hold the ID of all products we processed.
$file = './output.txt';
$fp = fopen($file, 'wb');
$current_page = 1;
while ($current_page <= $max_pages) {
    $filter = array('page' => $current_page, 'limit' => 250);
    $products = Bigcommerce::getProducts($filter);
    foreach ($products as $product) {
        $id = $product->id;
        if (!in_array($id, $processed)) {
 public function testDeleteResourceDeletesToTheRightPlace()
 {
     $this->connection->expects($this->once())->method('delete')->with('http://storeurl' . $this->basePath . '/whatever')->will($this->returnValue("Successfully deleted"));
     Client::configure(array('store_url' => 'http://storeurl', 'username' => 'whatever', 'api_key' => 'whatever'));
     Client::setConnection($this->connection);
     // re-set the connection since Client::configure unsets it
     $result = Client::deleteResource('/whatever');
     $this->assertSame("Successfully deleted", $result);
 }
<?php

require 'bigcommerce.php';
use Bigcommerce\Api\Client as Bigcommerce;
Bigcommerce::configure(array('store_url' => 'https://www.*.com', 'username' => 'bigcommerce', 'api_key' => '*************'));
Bigcommerce::verifyPeer(false);
Bigcommerce::setCipher('RC4-SHA');
$num_of_products = Bigcommerce::getProductsCount();
if ($num_of_products <= 250) {
    $max_pages = 1;
} else {
    $pages_double = $num_of_products / 250;
    $pages_int = (int) ($num_of_products / 250);
    if ($pages_double > $pages_int) {
        $max_pages = $pages_int + 1;
    } else {
        $max_pages = $pages_int;
        //If 250 goes into number of products evenly (rare)
    }
}
$processed = array();
//Collection returns duplicates sometimes, this will hold the ID of all products we processed.
$fields = array('is_free_shipping' => false);
$current_page = 1;
while ($current_page <= $max_pages) {
    $filter = array('page' => $current_page, 'limit' => 250);
    $products = Bigcommerce::getProducts($filter);
    foreach ($products as $product) {
        $id = $product->id;
        if (!in_array($id, $processed)) {
            Bigcommerce::updateProduct($id, $fields);
Example #6
0
	.data {
		margin: 300px auto 0;
		width: 960px;
	}
</style>
</head>
<body>

<div class="data">
<?php 
// ini_set('display_errors',1);
// ini_set('display_startup_errors',1);
// error_reporting(-1);
require_once 'vendor/autoload.php';
use Bigcommerce\Api\Client as Bigcommerce;
Bigcommerce::configure(array('store_url' => 'https://store-zm0qhx.mybigcommerce.com', 'username' => 'sparklestories', 'api_key' => '07f0ce7c145a0f462e220bbc4ead8d4fb66b1711'));
$filter = $filter = array("category" => 17, "limit" => 200);
$product = Bigcommerce::getProducts($filter);
echo var_dump($product);
echo $product->name;
echo $product->price;
if ($_GET) {
    $queryStr = $_SERVER['QUERY_STRING'];
    parse_str($queryStr, $queryArr);
    $queryArr['want']($queryArr['num']);
} else {
    print "what do you want?";
}
function products()
{
    $products = Bigcommerce::getProducts();