OpenCart integration plugin
Go to file
Alex Lushpai aae432abbb
Merge pull request #162 from Neur0toxine/v1.x
Don't update 'createdAt' while updating order in retailCRM
2019-07-04 10:09:51 +03:00
admin Don't update 'createdAt' while updating order in retailCRM 2019-07-03 16:35:54 +03:00
catalog Don't update 'createdAt' while updating order in retailCRM 2019-07-03 16:35:54 +03:00
system update v1.x structure, bug fixes 2016-08-31 17:37:53 +03:00
vqmod/xml update v1.x structure, bug fixes 2016-08-31 17:37:53 +03:00
.gitignore Don't update 'createdAt' while updating order in retailCRM 2019-07-03 16:35:54 +03:00
Changelog.md v0.3.0 2016-01-29 18:04:48 +03:00
LICENSE Update LICENSE 2015-02-02 16:21:38 +03:00
README.md Update README.md 2018-06-18 14:06:57 +03:00
README.ru.md Update README.ru.md 2018-09-12 11:07:59 +03:00

Opencart module (THIS VERSION IS DEPRECATED!)

Module allows integrate CMS Opencart 1.5.x.x with retailCRM

Notice: This is deprecated branch, we strongly recommend to use OpenCart v3.x

Features:

  • Export orders to retailCRM & fetch changes back
  • Export product catalog into ICML format

Install

Copy files to the site root

unzip master.zip
cp -r opencart-module/* /path/to/site/root

Setup

  • Go to Admin -> Extensions -> Modules -> retailCRM
  • Fill you api url & api key
  • Specify directories matching

Export orders to retailCRM

VQmod

Copy retailcrm_create_order.xml into /path/to/site/root/vqmod/xml.

For VQmod cache renewal you may need to delete files /path/to/site/root/vqmod/vqcache/vq2-admin_model_sale_order.php & /path/to/site/root/vqmod/vqcache/vq2-catalog_model_checkout_order.php

Manual setup

In the file:

/catalog/model/checkout/order.php

add theese lines into addOrder method right before return statement:

$this->load->model('retailcrm/order');
$this->model_retailcrm_order->sendToCrm($data, $order_id);

In the file:

/admin/model/sale/order.php

add theese lines into addOrder & editOrder methods right before return statement:

if (!isset($data['fromApi'])) {
    $this->load->model('setting/setting');
    $status = $this->model_setting_setting->getSetting('retailcrm');

    if (!empty($data['order_status_id'])) {
        $data['order_status'] = $status['retailcrm_status'][$data['order_status_id']];
    }

    $this->load->model('retailcrm/order');
    if (isset ($order_query)) {
        $this->model_retailcrm_order->changeInCrm($data, $order_id);
    } else {
        $this->model_retailcrm_order->sendToCrm($data, $order_id);
    }
}

Getting changes in orders

Add to cron:

*/5 * * * * /usr/bin/php /path/to/opencart/system/cron/history.php >> /path/to/opencart/system/logs/cronjob_history.log 2>&1

Setting product catalog export

Add to cron:

* */4 * * * /usr/bin/php /path/to/opencart/system/cron/icml.php >> /path/to/opencart/system/logs/cronjob_icml.log 2>&1

Your export file will be available by following url

http://youropencartsite.com/retailcrm.xml