mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-26 07:06:06 +03:00
сокрытие консольных скриптов в директории модуля, обновление README
This commit is contained in:
parent
ebd8214e05
commit
f8a5cd0f5f
65
README.md
65
README.md
@ -1,66 +1,69 @@
|
|||||||
Opencart module
|
Opencart module
|
||||||
==============
|
===============
|
||||||
|
|
||||||
Opencart module for interaction with [RetailCRM](http://retailcrm.ru) through [REST API](http://www.retailcrm.ru/docs/).
|
Модуль интеграции CMS Openacrt c [RetailCRM](http://retailcrm.ru)
|
||||||
|
|
||||||
###Features
|
### Модуль позволяет:
|
||||||
|
|
||||||
* Send orders to RetailCRM
|
* Экспортировать в CRM данные о заказах и клиентах и получать обратно изменения по этим данным
|
||||||
* Get changes from RetailCRM
|
* Синхронизировать справочники (способы доставки и оплаты, статусы заказов и т.п.)
|
||||||
* Configure relations between dictionaries of IntaroCRM and Opencart (statuses, payments, delivery types and etc)
|
* Выгружать каталог товаров в формате [ICML](http://retailcrm.ru/docs/Разработчики/ФорматICML) (IntaroCRM Markup Language)
|
||||||
* Generate catalog export file in [ICML](http://retailcrm.ru/docs/Разработчики/ФорматICML) format
|
|
||||||
|
|
||||||
###Install
|
### Установка
|
||||||
|
|
||||||
#### Download module
|
#### Скачайте модуль
|
||||||
|
|
||||||
```
|
```
|
||||||
https://github.com/retailcrm/opencart-module/archive/master.zip
|
https://github.com/retailcrm/opencart-module/archive/master.zip
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### Install module
|
#### Установите модуль скопировав необходимые файлы в корень сайта
|
||||||
```
|
```
|
||||||
unzip master.zip
|
unzip master.zip
|
||||||
cp -r opencart-module/* /path/to/opecart/instance
|
cp -r opencart-module/* /path/to/opecart/instance
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Activate via Admin interface.
|
#### Активируйте модуль
|
||||||
|
|
||||||
Go to Modules -> Intstall module. Before running exchange you must configure module.
|
В основном меню Extension -> Modules -> Intstall module.
|
||||||
|
|
||||||
#### Export
|
#### Настройка экспорта данных
|
||||||
|
|
||||||
Setup cron job for periodically catalog export
|
Для периодической выгрузки каталога добавьте в cron следующую запись:
|
||||||
|
|
||||||
```
|
```
|
||||||
* */12 * * * /usr/bin/php /path/to/opencart/cli/cli_export.php >> /path/to/opencart/system/logs/cronjob_export.log 2>&1
|
* */4 * * * /usr/bin/php /path/to/opencart/admin/model/retailcrm/export.php >> /path/to/opencart/system/logs/cronjob_export.log 2>&1
|
||||||
```
|
```
|
||||||
|
|
||||||
Into your CRM settings set path to exported file
|
В настройках CRM установите путь к файлу выгрузки
|
||||||
|
|
||||||
```
|
```
|
||||||
/download/retailcrm.xml
|
/download/retailcrm.xml
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Export new order from shop to CRM
|
#### Выгрузка новых заказов в CRM (для версии opencart 1.5.x.x, для версии 2.0 и старше не требуется)
|
||||||
|
|
||||||
Add this lines:
|
В файле:
|
||||||
|
|
||||||
|
```
|
||||||
|
/catalog/model/checkout/order.php
|
||||||
|
```
|
||||||
|
|
||||||
|
Добавьте следующие строки в метод addOrder непосредственно перед языковой конструкцией return:
|
||||||
|
|
||||||
```
|
```
|
||||||
$this->load->model('retailcrm/order');
|
$this->load->model('retailcrm/order');
|
||||||
$this->model_retailcrm_order->send($data, $order_id);
|
$this->model_retailcrm_order->send($data, $order_id);
|
||||||
```
|
```
|
||||||
|
|
||||||
into:
|
В файле:
|
||||||
|
|
||||||
```
|
```
|
||||||
/catalog/model/checkout/order.php
|
/admin/model/sale/order.php
|
||||||
```
|
```
|
||||||
|
|
||||||
script, into addOrder method before return statement
|
Добавьте следующие строки в методы addOrder и editOrder непосредственно перед языковой конструкцией return:
|
||||||
|
|
||||||
Add this lines:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
if (!isset($data['fromApi'])) {
|
if (!isset($data['fromApi'])) {
|
||||||
@ -73,19 +76,11 @@ if (!isset($data['fromApi'])) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
into:
|
#### Получение измений из CRM
|
||||||
|
|
||||||
|
Для получения изменений и новых данных добавьте в cron следующую запись:
|
||||||
|
|
||||||
```
|
```
|
||||||
/admin/model/sale/order.php
|
*/5 * * * * /usr/bin/php /path/to/opencart/admin/model/retailcrm/history.php >> /path/to/opencart/system/logs/cronjob_history.log 2>&1
|
||||||
```
|
|
||||||
|
|
||||||
script, into addOrder & editOrder methods at the end of these methods
|
|
||||||
|
|
||||||
#### Export new order from CRM to shop
|
|
||||||
|
|
||||||
Setup cron job for exchange between CRM & your shop
|
|
||||||
|
|
||||||
```
|
|
||||||
*/5 * * * * /usr/bin/php /path/to/opencart/cli/cli_history.php >> /path/to/opencart/system/logs/cronjob_history.log 2>&1
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// CLI must be called by cli php
|
|
||||||
if (php_sapi_name() != 'cli') {
|
|
||||||
$log->write("ERROR: cli $cli_action call attempted by non-cli.");
|
|
||||||
http_response_code(400);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure $cli_action is set
|
// Ensure $cli_action is set
|
||||||
if (!isset($cli_action)) {
|
if (!isset($cli_action)) {
|
||||||
echo 'ERROR: $cli_action must be set in calling script.';
|
echo 'ERROR: $cli_action must be set in calling script.';
|
||||||
@ -19,7 +12,7 @@ if (!isset($cli_action)) {
|
|||||||
define('VERSION', '1.5.6');
|
define('VERSION', '1.5.6');
|
||||||
|
|
||||||
// Configuration (note we're using the admin config)
|
// Configuration (note we're using the admin config)
|
||||||
require_once(__DIR__ . '/../admin/config.php');
|
require_once(realpath(dirname(__FILE__)) . '/../../config.php');
|
||||||
|
|
||||||
// Configuration check
|
// Configuration check
|
||||||
if (!defined('DIR_APPLICATION')) {
|
if (!defined('DIR_APPLICATION')) {
|
||||||
@ -138,4 +131,3 @@ $controller->dispatch($action, new Action('error/not_found'));
|
|||||||
|
|
||||||
// Output
|
// Output
|
||||||
$response->output();
|
$response->output();
|
||||||
?>
|
|
@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
$cli_action = 'module/retailcrm/icml';
|
$cli_action = 'module/retailcrm/icml';
|
||||||
require_once('cli_dispatch.php');
|
require_once('dispatch.php');
|
@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
$cli_action = 'module/retailcrm/history';
|
$cli_action = 'module/retailcrm/history';
|
||||||
require_once('cli_dispatch.php');
|
require_once('dispatch.php');
|
@ -41,8 +41,8 @@ class ModelRetailcrmIcml extends Model {
|
|||||||
$this->eOffers = $this->dd
|
$this->eOffers = $this->dd
|
||||||
->getElementsByTagName('offers')->item(0);
|
->getElementsByTagName('offers')->item(0);
|
||||||
|
|
||||||
$this->addCategories($categories);
|
$this->addCategories();
|
||||||
$this->addOffers($offers);
|
$this->addOffers();
|
||||||
|
|
||||||
$this->dd->saveXML();
|
$this->dd->saveXML();
|
||||||
|
|
||||||
@ -194,6 +194,10 @@ class ModelRetailcrmIcml extends Model {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $image
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
private function generateImage($image)
|
private function generateImage($image)
|
||||||
{
|
{
|
||||||
$this->load->model('tool/image');
|
$this->load->model('tool/image');
|
||||||
@ -202,6 +206,6 @@ class ModelRetailcrmIcml extends Model {
|
|||||||
$image,
|
$image,
|
||||||
$this->config->get('config_image_product_width'),
|
$this->config->get('config_image_product_width'),
|
||||||
$this->config->get('config_image_product_height')
|
$this->config->get('config_image_product_height')
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ class ModelRetailcrmOrder extends Model {
|
|||||||
&&
|
&&
|
||||||
!empty($settings['retailcrm_apikey'])
|
!empty($settings['retailcrm_apikey'])
|
||||||
) {
|
) {
|
||||||
require_once DIR_SYSTEM . 'library/retailcrm/Retailcrm.php';
|
require_once DIR_SYSTEM . 'library/retailcrm.php';
|
||||||
$order['order_id'] = $order_id;
|
$order['order_id'] = $order_id;
|
||||||
$crm = new ApiHelper($settings);
|
$crm = new ApiHelper($settings);
|
||||||
$crm->processOrder($order);
|
$crm->processOrder($order);
|
||||||
|
Loading…
Reference in New Issue
Block a user