<commit_before>Installation
============

### Clone module.
```
git clone <EMAIL>:/intarocrm/opencart-module.git
```

### Install Rest API Client.

```
cd opencart-module/system/library/intarocrm
./composer.phar install
```

### Install module
```
cp -r opencart-module/* /path/to/opecart/instance
```

### Activate via Admin interface.

Go to Modules -> Intstall module. Before running exchange you must configure module.

### Export

Setup cron job for periodically catalog export

```
0 */12 0 0 0 /usr/bin/php /path/to/opencart/cli/cli_export.php >> /path/to/opencart/system/logs/cronjob_export.log 2>&1
```

### Exchange setup


#### Export new order from shop to CRM

Open /catalog/model/checkout/order.php script. Into addOrder method add this line before return statement:

```
$this->crmOrderAction($data, $order_id, 'create');
```

In the end of this file add method:

```
protected function crmOrderAction($order, $order_id, $action=null)
{
    $this->load->model('setting/setting');
    $settings = $this->model_setting_setting->getSetting('intarocrm');
    $settings['domain'] = parse_url(HTTP_SERVER, PHP_URL_HOST);

    if(isset($settings['intarocrm_url']) && $settings['intarocrm_url'] != '' && isset($settings['intarocrm_apikey']) && $settings['intarocrm_apikey'] != '') {
        include_once __DIR__ . '/../../../system/library/intarocrm/apihelper.php';

        $order['order_id'] = $order_id;
        $crm = new ApiHelper($settings);

        if ($action != null) {
            $method = 'order' . ucfirst($action);
            $crm->$method($order);
        }
    }

}
```

#### Export new order from CRM to shop

Setup cron job for exchange between CRM & your shop

```
*/5 0 0 0 0 /usr/bin/php /path/to/opencart/cli/cli_export.php >> /path/to/opencart/system/logs/cronjob_history.log 2>&1
```<commit_msg>Update Install.md<commit_after>Installation
============

### Clone module.
```
git clone <EMAIL>@github.<EMAIL>:/intarocrm/opencart-module.git
```

### Install Rest API Client.

```
cd opencart-module/system/library/intarocrm
./composer.phar install
```

### Install module
```
cp -r opencart-module/* /path/to/opecart/instance
```

### Activate via Admin interface.

Go to Modules -> Intstall module. Before running exchange you must configure module.

### Export

Setup cron job for periodically catalog export

```
0 */12 0 0 0 /usr/bin/php /path/to/opencart/cli/cli_export.php >> /path/to/opencart/system/logs/cronjob_export.log 2>&1
```

### Exchange setup


#### Export new order from shop to CRM

Open /catalog/model/checkout/order.php script. Into addOrder method add this line before return statement:

```
$this->crmOrderAction($data, $order_id, 'create');
```

In the end of this file add method:

```
protected function crmOrderAction($order, $order_id, $action=null)
{
    $this->load->model('setting/setting');
    $settings = $this->model_setting_setting->getSetting('intarocrm');
    $settings['domain'] = parse_url(HTTP_SERVER, PHP_URL_HOST);

    if(isset($settings['intarocrm_url']) && $settings['intarocrm_url'] != '' && isset($settings['intarocrm_apikey']) && $settings['intarocrm_apikey'] != '') {
        include_once __DIR__ . '/../../../system/library/intarocrm/apihelper.php';

        $order['order_id'] = $order_id;
        $crm = new ApiHelper($settings);

        if ($action != null) {
            $method = 'order' . ucfirst($action);
            $crm->$method($order);
        }
    }

}
```

#### Export new order from CRM to shop

Setup cron job for exchange between CRM & your shop

```
*/5 0 0 0 0 /usr/bin/php /path/to/opencart/cli/cli_history.php >> /path/to/opencart/system/logs/cronjob_history.log 2>&1
```
{'fraction_non_alphanumeric': 0.17437431991294886, 'fraction_numerical': 0.008161044613710556, 'mean_word_length': 3.800261096605744, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6366159', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1213, 'n_words': 281}