PHP code example of vkolya / opencart-sdk

1. Go to this page and download the library: Download vkolya/opencart-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vkolya / opencart-sdk example snippets


composer 

use Vkolya\ocSDK\OpenCart;

$oc = new OpenCart('http://opencartsite,com','oc_api.dat');
//login method on success returns array with token and apiVersion
$oc->login('OC_API_TOKEN');

$_SESSION['op_session_data'] = $oc->login('OC_API_TOKEN');

$oc = new OpenCart('http://opencartsite,com','oc_api.dat',$_SESSION['op_session_data']);
//add product to cart
$oc->cart->add(1, 1);