phpbigcommerce

BigCommerce API Retrieves a specific shipment in an order and update


I tried to using bigcommerce API to retrieves a specific shipment in an order.

Here is my code:

$Orders = BigCommerce_Api::getOrder(100);
$order_shipments = Bigcommerce_Api::getCollection('/orders/'.$Orders->id. '/shipments/'. 1, 'Shipment');

but it shows a warning:

array_map(): Argument #2 should be an array in C:\xampp\htdocs\comm\Bigcommerce\Api.php on line 220

Can anyone help me with this?


Solution

  • Already solve this got some coding error in the Big Commerce API

    in Resources.php update code

    class Bigcommerce_Api_Shipment extends Bigcommerce_Api_Resource {
    
    protected $ignoreOnCreate = array(
        'id',
        'order_id',
        'date_created',
        'customer_id',
        'shipping_method',
    );
    
    protected $ignoreOnUpdate = array(
        'id',
        'order_id',
        'date_created',
        'customer_id',
        'shipping_method',
        'items',
        'billing_address',
        'shipping_address',
    );
    
    public function create()
    {
        return Bigcommerce_Api::createResource('/orders/' . $this->order_id . '/shipments', $this->getCreateFields());
    }
    
    public function update()
    {
            return Bigcommerce_Api::updateResource('/orders/' . $this->order_id . '/shipments/' . $this->id, $this->getUpdateFields());
    
    }
    
    }