PHP Classes
elePHPant
Icontem

PHP OpenCart CLI: Control an OpenCart installation from the console

Recommend this page to a friend!
  Info   View files Example   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-05-18 (5 months ago) RSS 2.0 feedNot enough user ratingsTotal: 74 This week: 1All time: 9,457 This week: 358Up
Version License PHP version Categories
opencart-cli 1.0.0GNU General Publi...5PHP 5, E-Commerce, Console
Description Author

This package can control an OpenCart installation from the console.

It can take parameter values from the console command line console and executes several types of commands in OpenCart. Currently it can:

- Create, enable, disable, check existing platform users
- Set the price and quantities of products in the cart
- Check the status of an order
- Disable a customer
- Clean the cache
- Execute a given class

Innovation Award
PHP Programming Innovation award nominee
May 2019
Number 5
OpenCart is a shopping cart system that is used by many sites to handle the processing of products or services sold in those sites.

This package provides means to manipulate data of an OpenCart installation from the command line shell.

Manuel Lemos
  Performance   Level  
Name: Istvan Dobrentei <contact>
Classes: 12 packages by
Country: Hungary Hungary
Age: 42
All time rank: 155314 in Hungary Hungary
Week rank: 65 Up2 in Hungary Hungary Up
Innovation award
Innovation award
Nominee: 9x

Winner: 1x

 

Details

Opencart Command Line Interface

Version: 0.1

> Sometimes it is neccesseary to run repetable processes, > for example: stock or price update, data exchange with various third party ERP systems, currency rate update, > creating large site xml, exporting, importing etc... > You can create feeds and call them using http requests but sometimes it's running time is too much. > The CLI helps you for it, because it is a consistent tool and you could apply for many webshop versions. > Download only a phar file, put it anywhere in the filesystem and run it with parameters: > It has also an option to run your own logic from command line, see: run:class param.

  • path => parameter (absolute path to opencart root directory), required
  • cmd => command name, required
  • context => (admin or catalog), optional

Compatible with the following Opencart versions:

  • 1.5.x
  • 2.x
  • 3.x

Usage:

php opencart-cli.phar --path=directory --cmd=command

Return:

JSON answer {result: '', value: ''}

Examples:





## Available commands:

> admin:user:create

Create an admin user \
Params: \
required: --username, --password, --user_group_id \
optional: --lastname, --firstname, --email

> admin:user:exist

Checking admin user \
Params: \
required: --username

> admin:user:enable

Enable an admin user \
Params: \
required: --username

> admin:user:disable

Disable an admin user \
Params: \
required: --username

> product:set:price

Set product base net price \
Params: \
required: --id | --sku && --value

> product:set:quantity

Set product quantity \
Params: \
required: --id | --sku && --value

> config:cache:clean

Clean all files from cache directory \
Params:

> run:class

Create a cli directory in your root folder and put your own class into it or set the path to the cli folder.
The class name and the file name should equal.

Params: \
required: --name=classname \
optional: --path=/path/to/the/directory
  Files folder image Files  
File Role Description
Files folder imagecli (1 file)
Files folder imagesrc (1 file, 1 directory)
Accessible without login Plain text file create-phar.php Example Example script
Accessible without login Plain text file readme.md Doc. Documentation

  Files folder image Files  /  cli  
File Role Description
  Plain text file ExampleClass.php Class Class source

  Files folder image Files  /  src  
File Role Description
Files folder imagelib (9 files)
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  src  /  lib  
File Role Description
  Plain text file AdminUserCli.php Class Class source
  Plain text file BaseCli.php Class Class source
  Plain text file BaseCommandCli.php Class Class source
  Plain text file CacheCli.php Class Class source
  Plain text file OpencartCli.php Class Class source
  Plain text file ProductCli.php Class Class source
  Plain text file v15Cli.php Class Class source
  Plain text file v20Cli.php Class Class source
  Plain text file v30Cli.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:74
This week:1
All time:9,457
This week:358Up