/opencart-model-invoker

Access all opencart model's methods and invoke them remotely, use it like a api

Primary LanguagePHP

Opencart Model Invoker

Access all opencart model's methods and invoke them remotely, use it like a api.

Installation

Build
clone repository
composer install
Setup Opencart
Copy Invoker Controller to Opencart
  • Copy all files in opencart-put-catalog-controller to "{OpencartRootPath}/catalog/controller/"
Usage
use OpencartApi\Http\ClientBuilder;
use OpencartApi\ModelInvoker;

require __DIR__ . '/vendor/autoload.php';


$config = include_once __DIR__ . '/config.php';

$invoker = new ModelInvoker((new ClientBuilder())
    ->setBaseUrl($config['v3037']['baseUrl'])
    ->setUsername($config['v3037']['adminUsername'])
    ->setPassword($config['v3037']['adminPassword'])
    ->build());

$models = new \OpencartApi\ModelContainer\v3037\OpencartModelContainer($invoker);

$res = $models->getAdminModelCatalogProduct()->getProducts();

print_r($res->getResult());