mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-24 14:16:07 +03:00
setting & icml export
This commit is contained in:
commit
a07aa6ae8e
46
README.md
Normal file
46
README.md
Normal file
@ -0,0 +1,46 @@
|
||||
Opecart module
|
||||
=============
|
||||
|
||||
Opencart module for interaction with [IntaroCRM](http://www.intarocrm.com) through [REST API](http://docs.intarocrm.ru/rest-api/).
|
||||
|
||||
Module allows:
|
||||
|
||||
* Send to IntaroCRM new orders
|
||||
* Configure relations between dictionaries of IntaroCRM and Opencart (statuses, payments, delivery types and etc)
|
||||
* Generate [ICML](http://docs.intarocrm.ru/index.php?n=Пользователи.ФорматICML) (IntaroCRM Markup Language) for catalog loading by IntaroCRM
|
||||
|
||||
Installation
|
||||
-------------
|
||||
|
||||
### 1. Manual installation
|
||||
|
||||
|
||||
#### Clone module.
|
||||
```
|
||||
git clone git@github.com:/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.
|
||||
|
||||
#### Export
|
||||
|
||||
Catalog export script will be here
|
||||
```
|
||||
/index.php?route=export/intarocrm
|
||||
```
|
||||
|
||||
|
279
admin/controller/module/intarocrm.php
Normal file
279
admin/controller/module/intarocrm.php
Normal file
@ -0,0 +1,279 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../../../system/library/intarocrm/vendor/autoload.php';
|
||||
|
||||
class ControllerModuleIntarocrm extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function install() {
|
||||
$this->load->model('setting/setting');
|
||||
$this->model_setting_setting->editSetting('intarocrm', array('intarocrm_status'=>1));
|
||||
}
|
||||
|
||||
public function uninstall() {
|
||||
$this->load->model('setting/setting');
|
||||
$this->model_setting_setting->editSetting('intarocrm', array('intarocrm_status'=>0));
|
||||
}
|
||||
|
||||
public function index() {
|
||||
|
||||
$this->log = new Monolog\Logger('opencart-module');
|
||||
$this->log->pushHandler(new Monolog\Handler\StreamHandler(__DIR__ . '/../../../system/logs/module.log', Monolog\Logger::INFO));
|
||||
|
||||
$this->load->model('setting/setting');
|
||||
$this->load->model('setting/extension');
|
||||
$this->load->language('module/intarocrm');
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
$this->document->addStyle('/admin/view/stylesheet/intarocrm.css');
|
||||
|
||||
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
|
||||
$this->model_setting_setting->editSetting('intarocrm', $this->request->post);
|
||||
$this->session->data['success'] = $this->language->get('text_success');
|
||||
$this->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
|
||||
}
|
||||
|
||||
$text_strings = array(
|
||||
'heading_title',
|
||||
'text_enabled',
|
||||
'text_disabled',
|
||||
'button_save',
|
||||
'button_cancel',
|
||||
'text_notice',
|
||||
'intarocrm_url',
|
||||
'intarocrm_apikey',
|
||||
'intarocrm_base_settings',
|
||||
'intarocrm_dict_settings',
|
||||
'intarocrm_dict_delivery',
|
||||
'intarocrm_dict_status',
|
||||
'intarocrm_dict_payment',
|
||||
);
|
||||
|
||||
foreach ($text_strings as $text) {
|
||||
$this->data[$text] = $this->language->get($text);
|
||||
}
|
||||
|
||||
$this->data['intarocrm_errors'] = array();
|
||||
$this->data['saved_settings'] = $this->model_setting_setting->getSetting('intarocrm');
|
||||
|
||||
if ($this->data['saved_settings']['intarocrm_url'] != '' && $this->data['saved_settings']['intarocrm_apikey'] != '') {
|
||||
|
||||
$this->intarocrm = new \IntaroCrm\RestApi(
|
||||
$this->data['saved_settings']['intarocrm_url'],
|
||||
$this->data['saved_settings']['intarocrm_apikey']
|
||||
);
|
||||
|
||||
/*
|
||||
* Delivery
|
||||
*/
|
||||
|
||||
try {
|
||||
$this->deliveryTypes = $this->intarocrm->deliveryTypesList();
|
||||
}
|
||||
catch (ApiException $e)
|
||||
{
|
||||
$this->data['intarocrm_error'][] = $e->getMessage();
|
||||
$this->log->addError('['.$this->config->get('store_name').'] RestApi::deliveryTypesList::Api:' . $e->getMessage());
|
||||
}
|
||||
catch (CurlException $e)
|
||||
{
|
||||
$this->data['intarocrm_error'][] = $e->getMessage();
|
||||
$this->log->addError('['.$this->config->get('store_name').'] RestApi::deliveryTypesList::Curl:' . $e->getMessage());
|
||||
}
|
||||
|
||||
$this->data['delivery'] = array(
|
||||
'opencart' => $this->getOpercartDeliveryMethods(),
|
||||
'intarocrm' => $this->deliveryTypes
|
||||
);
|
||||
|
||||
/*
|
||||
* Statuses
|
||||
*/
|
||||
try {
|
||||
$this->statuses = $this->intarocrm->orderStatusesList();
|
||||
}
|
||||
catch (ApiException $e)
|
||||
{
|
||||
$this->data['intarocrm_error'][] = $e->getMessage();
|
||||
$this->log->addError('['.$this->config->get('store_name').'] RestApi::orderStatusesList::Api:' . $e->getMessage());
|
||||
}
|
||||
catch (CurlException $e)
|
||||
{
|
||||
$this->data['intarocrm_error'][] = $e->getMessage();
|
||||
$this->log->addError('['.$this->config->get('store_name').'] RestApi::orderStatusesList::Curl:' . $e->getMessage());
|
||||
}
|
||||
|
||||
$this->data['statuses'] = array(
|
||||
'opencart' => $this->getOpercartOrderStatuses(),
|
||||
'intarocrm' => $this->statuses
|
||||
);
|
||||
|
||||
/*
|
||||
* Payment
|
||||
*/
|
||||
|
||||
try {
|
||||
$this->payments = $this->intarocrm->paymentTypesList();
|
||||
}
|
||||
catch (ApiException $e)
|
||||
{
|
||||
$this->data['intarocrm_error'][] = $e->getMessage();
|
||||
$this->log->addError('['.$this->config->get('store_name').'] RestApi::paymentTypesList::Api:' . $e->getMessage());
|
||||
}
|
||||
catch (CurlException $e)
|
||||
{
|
||||
$this->data['intarocrm_error'][] = $e->getMessage();
|
||||
$this->log->addError('['.$this->config->get('store_name').'] RestApi::paymentTypesList::Curl:' . $e->getMessage());
|
||||
}
|
||||
|
||||
$this->data['payments'] = array(
|
||||
'opencart' => $this->getOpercartPaymentTypes(),
|
||||
'intarocrm' => $this->payments
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$config_data = array(
|
||||
'intarocrm_status'
|
||||
);
|
||||
|
||||
foreach ($config_data as $conf) {
|
||||
if (isset($this->request->post[$conf])) {
|
||||
$this->data[$conf] = $this->request->post[$conf];
|
||||
} else {
|
||||
$this->data[$conf] = $this->config->get($conf);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->error['warning'])) {
|
||||
$this->data['error_warning'] = $this->error['warning'];
|
||||
} else {
|
||||
$this->data['error_warning'] = '';
|
||||
}
|
||||
|
||||
$this->data['breadcrumbs'] = array();
|
||||
|
||||
$this->data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_home'),
|
||||
'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
|
||||
'separator' => false
|
||||
);
|
||||
|
||||
$this->data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_module'),
|
||||
'href' => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'),
|
||||
'separator' => ' :: '
|
||||
);
|
||||
|
||||
$this->data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('heading_title'),
|
||||
'href' => $this->url->link('module/intarocrm', 'token=' . $this->session->data['token'], 'SSL'),
|
||||
'separator' => ' :: '
|
||||
);
|
||||
|
||||
$this->data['action'] = $this->url->link('module/intarocrm', 'token=' . $this->session->data['token'], 'SSL');
|
||||
|
||||
$this->data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');
|
||||
|
||||
|
||||
$this->data['modules'] = array();
|
||||
|
||||
if (isset($this->request->post['intarocrm_module'])) {
|
||||
$this->data['modules'] = $this->request->post['intarocrm_module'];
|
||||
} elseif ($this->config->get('intarocrm_module')) {
|
||||
$this->data['modules'] = $this->config->get('intarocrm_module');
|
||||
}
|
||||
|
||||
$this->load->model('design/layout');
|
||||
|
||||
$this->data['layouts'] = $this->model_design_layout->getLayouts();
|
||||
|
||||
$this->template = 'module/intarocrm.tpl';
|
||||
$this->children = array(
|
||||
'common/header',
|
||||
'common/footer',
|
||||
);
|
||||
|
||||
$this->response->setOutput($this->render());
|
||||
}
|
||||
|
||||
private function validate() {
|
||||
if (!$this->user->hasPermission('modify', 'module/intarocrm')) {
|
||||
$this->error['warning'] = $this->language->get('error_permission');
|
||||
}
|
||||
|
||||
if (!$this->error) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
protected function getOpercartDeliveryMethods()
|
||||
{
|
||||
$extensions = $this->model_setting_extension->getInstalled('shipping');
|
||||
|
||||
foreach ($extensions as $key => $value) {
|
||||
if (!file_exists(DIR_APPLICATION . 'controller/shipping/' . $value . '.php')) {
|
||||
$this->model_setting_extension->uninstall('shipping', $value);
|
||||
|
||||
unset($extensions[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$deliveryMethods = array();
|
||||
|
||||
$files = glob(DIR_APPLICATION . 'controller/shipping/*.php');
|
||||
|
||||
if ($files) {
|
||||
foreach ($files as $file) {
|
||||
$extension = basename($file, '.php');
|
||||
|
||||
$this->load->language('shipping/' . $extension);
|
||||
|
||||
if ($this->config->get($extension . '_status')) {
|
||||
$deliveryMethods[] = strip_tags($this->language->get('heading_title'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $deliveryMethods;
|
||||
}
|
||||
|
||||
protected function getOpercartOrderStatuses()
|
||||
{
|
||||
$this->load->model('localisation/order_status');
|
||||
return $this->model_localisation_order_status->getOrderStatuses(array());
|
||||
}
|
||||
|
||||
protected function getOpercartPaymentTypes()
|
||||
{
|
||||
$extensions = $this->model_setting_extension->getInstalled('payment');
|
||||
|
||||
foreach ($extensions as $key => $value) {
|
||||
if (!file_exists(DIR_APPLICATION . 'controller/payment/' . $value . '.php')) {
|
||||
$this->model_setting_extension->uninstall('payment', $value);
|
||||
|
||||
unset($extensions[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$paymentTypes = array();
|
||||
|
||||
$files = glob(DIR_APPLICATION . 'controller/payment/*.php');
|
||||
|
||||
if ($files) {
|
||||
foreach ($files as $file) {
|
||||
$extension = basename($file, '.php');
|
||||
|
||||
$this->load->language('payment/' . $extension);
|
||||
|
||||
if ($this->config->get($extension . '_status')) {
|
||||
$paymentTypes[] = strip_tags($this->language->get('heading_title'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $paymentTypes;
|
||||
}
|
||||
}
|
||||
?>
|
22
admin/language/english/module/intarocrm.php
Normal file
22
admin/language/english/module/intarocrm.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
// Heading Goes here:
|
||||
$_['heading_title'] = 'IntaroCRM';
|
||||
|
||||
// Text
|
||||
$_['text_module'] = 'Modules';
|
||||
$_['text_success'] = 'Setting saved';
|
||||
$_['text_notice'] = 'Warning! Timezone in CRM & your shop must be equal, you must setup it here:';
|
||||
$_['intarocrm_base_settings'] = 'Connection settings';
|
||||
$_['intarocrm_dict_settings'] = 'Dictionary settings';
|
||||
|
||||
$_['intarocrm_url'] = 'IntaroCRM URL';
|
||||
$_['intarocrm_apikey'] = 'Api key';
|
||||
|
||||
$_['intarocrm_dict_delivery'] = 'Shipment methods';
|
||||
$_['intarocrm_dict_status'] = 'Order statuses';
|
||||
$_['intarocrm_dict_payment'] = 'Payment methods';
|
||||
|
||||
// Errors
|
||||
$_['error_permission'] = 'Warning! You do not have permission to modify module';
|
||||
?>
|
22
admin/language/russian/module/intarocrm.php
Normal file
22
admin/language/russian/module/intarocrm.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
// Heading Goes here:
|
||||
$_['heading_title'] = 'IntaroCRM';
|
||||
|
||||
// Text
|
||||
$_['text_module'] = 'Модули';
|
||||
$_['text_success'] = 'Настройки успешно сохранены';
|
||||
$_['text_notice'] = 'Внимание! Часовой пояс в CRM должен совпадать с часовым поясом в магазине, настроки часового пояса CRM можно задать по адресу:';
|
||||
$_['intarocrm_base_settings'] = 'Настройки соединения';
|
||||
$_['intarocrm_dict_settings'] = 'Настройки соответствия справочников';
|
||||
|
||||
$_['intarocrm_url'] = 'Адрес IntaroCRM';
|
||||
$_['intarocrm_apikey'] = 'Api ключ';
|
||||
|
||||
$_['intarocrm_dict_delivery'] = 'Способы доставки';
|
||||
$_['intarocrm_dict_status'] = 'Статусы';
|
||||
$_['intarocrm_dict_payment'] = 'Способы оплаты';
|
||||
|
||||
// Errors
|
||||
$_['error_permission'] = 'У вас недостаточно прав на изменение настроек модуля';
|
||||
?>
|
2
admin/view/stylesheet/intarocrm.css
Normal file
2
admin/view/stylesheet/intarocrm.css
Normal file
@ -0,0 +1,2 @@
|
||||
.intarocrm_unit {margin-bottom: 10px;}
|
||||
.intarocrm_unit input {width: 30%;}
|
98
admin/view/template/module/intarocrm.tpl
Normal file
98
admin/view/template/module/intarocrm.tpl
Normal file
@ -0,0 +1,98 @@
|
||||
<?php echo $header; ?>
|
||||
|
||||
<div id="content">
|
||||
<div class="breadcrumb">
|
||||
<?php foreach ($breadcrumbs as $breadcrumb): ?>
|
||||
<?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php if ($error_warning) : ?>
|
||||
<div class="warning"><?php echo $error_warning; ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="success">
|
||||
<?php echo $text_notice; ?>
|
||||
<a href="<?php echo $saved_settings['intarocrm_url']; ?>/admin/settings#t-main"><?php echo $saved_settings['intarocrm_url']; ?>/admin/settings#t-main</a>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<div class="heading">
|
||||
<h1><img src="view/image/module.png" alt="" /> <?php echo $heading_title; ?></h1>
|
||||
<div class="buttons"><a onclick="$('#form').submit();" class="button"><span><?php echo $button_save; ?></span></a><a onclick="location = '<?php echo $cancel; ?>';" class="button"><span><?php echo $button_cancel; ?></span></a></div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
|
||||
<input type="hidden" name="intarocrm_status" value="1">
|
||||
|
||||
<h3><?php echo $intarocrm_base_settings; ?></h3>
|
||||
<div class="intarocrm_unit">
|
||||
<label for="intarocrm_url"><?php echo $intarocrm_url; ?></label><br>
|
||||
<input id="intarocrm_url" type="text" name="intarocrm_url" value="<?php echo $saved_settings['intarocrm_url']; ?>">
|
||||
</div>
|
||||
<div class="intarocrm_unit">
|
||||
<label for="intarocrm_apikey"><?php echo $intarocrm_apikey; ?></label><br>
|
||||
<input id="intarocrm_apikey" type="text" name="intarocrm_apikey" value="<?php echo $saved_settings['intarocrm_apikey']; ?>">
|
||||
</div>
|
||||
|
||||
<?php if ($saved_settings['intarocrm_apikey'] != '' && $saved_settings['intarocrm_url'] != ''): ?>
|
||||
|
||||
<?php if (!empty($intarocrm_errors)) : ?>
|
||||
<?php foreach($intarocrm_errors as $intarocrm_error): ?>
|
||||
<div class="warning"><?php echo $intarocrm_error ?></div>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<h3><?php echo $intarocrm_dict_settings; ?></h3>
|
||||
|
||||
<h4><?php echo $intarocrm_dict_delivery; ?></h4>
|
||||
<?php foreach ($delivery['opencart'] as $key => $value): ?>
|
||||
<div class="intarocrm_unit">
|
||||
<select id="intarocrm_delivery_<?php echo $key; ?>" name="intarocrm_delivery[<?php echo $key; ?>]" >
|
||||
<?php foreach ($delivery['intarocrm'] as $k => $v): ?>
|
||||
<option value="<?php echo $v['code'];?>" <?php if($v['code'] == $saved_settings['intarocrm_delivery'][$key]):?>selected="selected"<?php endif;?>>
|
||||
<?php echo $v['name'];?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<label for="intarocrm_delivery_<?php echo $key; ?>"><?php echo $value; ?></label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<h4><?php echo $intarocrm_dict_status; ?></h4>
|
||||
<?php foreach ($statuses['opencart'] as $status): ?>
|
||||
<?php $uid = $status['order_status_id']?>
|
||||
<div class="intarocrm_unit">
|
||||
<select id="intarocrm_status_<?php echo $uid; ?>" name="intarocrm_status[<?php echo $uid; ?>]" >
|
||||
<?php foreach ($statuses['intarocrm'] as $k => $v): ?>
|
||||
<option value="<?php echo $v['code'];?>" <?php if($v['code'] == $saved_settings['intarocrm_status'][$uid]):?>selected="selected"<?php endif;?>>
|
||||
<?php echo $v['name'];?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<label for="intarocrm_status_<?php echo $status['order_status_id']; ?>"><?php echo $status['name']; ?></label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<h4><?php echo $intarocrm_dict_payment; ?></h4>
|
||||
<?php foreach ($payments['opencart'] as $key => $value): ?>
|
||||
<div class="intarocrm_unit">
|
||||
<select id="intarocrm_payment_<?php echo $key; ?>" name="intarocrm_payment[<?php echo $key; ?>]" >
|
||||
<?php foreach ($payments['intarocrm'] as $k => $v): ?>
|
||||
<option value="<?php echo $v['code'];?>" <?php if($v['code'] == $saved_settings['intarocrm_payment'][$key]):?>selected="selected"<?php endif;?>>
|
||||
<?php echo $v['name'];?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<label for="intarocrm_payment_<?php echo $key; ?>"><?php echo $value; ?></label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php //var_dump($saved_settings);?>
|
||||
</div>
|
||||
|
||||
|
||||
<?php echo $footer; ?>
|
99
catalog/export/intarocrm.php
Normal file
99
catalog/export/intarocrm.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
class ControllerExportIntarocrm extends Controller {
|
||||
protected $dd;
|
||||
protected $eCategories;
|
||||
protected $eOffers;
|
||||
|
||||
public function index() {
|
||||
header('Content-Type: text/xml');
|
||||
echo $this->xml();
|
||||
}
|
||||
|
||||
private function xml()
|
||||
{
|
||||
$this->dd = DOMDocument::loadXML('<?xml version="1.0" encoding="UTF-8"?>
|
||||
<yml_catalog date="'.date('Y-m-d H:i:s').'">
|
||||
<shop>
|
||||
<name>'.$this->config->get('config_name').'</name>
|
||||
<categories/>
|
||||
<offers/>
|
||||
</shop>
|
||||
</yml_catalog>
|
||||
');
|
||||
|
||||
$this->eCategories = $this->dd->getElementsByTagName('categories')->item(0);
|
||||
$this->eOffers = $this->dd->getElementsByTagName('offers')->item(0);
|
||||
|
||||
$this->addCategories();
|
||||
$this->addOffers();
|
||||
return $this->dd->saveXML();
|
||||
}
|
||||
|
||||
private function addCategories()
|
||||
{
|
||||
$this->language->load('product/category');
|
||||
$this->load->model('catalog/category');
|
||||
|
||||
foreach ($this->model_catalog_category->getCategories() as $category) {
|
||||
$e = $this->eCategories->appendChild($this->dd->createElement('category', $category['name']));
|
||||
$e->setAttribute('id',$category['category_id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function addOffers()
|
||||
{
|
||||
$this->load->model('catalog/product');
|
||||
$this->load->model('tool/image');
|
||||
|
||||
foreach ($this->model_catalog_product->getProducts(array()) as $offer) {
|
||||
$e = $this->eOffers->appendChild($this->dd->createElement('offer'));
|
||||
$e->setAttribute('id', $offer['product_id']);
|
||||
$e->setAttribute('productId', $offer['product_id']);
|
||||
$e->setAttribute('quantity', $offer['quantity']);
|
||||
$e->setAttribute('available', $offer['status'] ? 'true' : 'false');
|
||||
|
||||
/*
|
||||
* DIRTY HACK, NEED TO REFACTOR
|
||||
*/
|
||||
|
||||
$sql = "SELECT * FROM `" . DB_PREFIX . "product_to_category` WHERE `product_id` = " .$offer['product_id']. ";";
|
||||
$result = $this->db->query($sql);
|
||||
foreach ($result->rows as $row) {
|
||||
$e->appendChild($this->dd->createElement('categoryId', $row['category_id']));
|
||||
}
|
||||
|
||||
$e->appendChild($this->dd->createElement('name'))->appendChild($this->dd->createTextNode($offer['name']));
|
||||
$e->appendChild($this->dd->createElement('productName'))->appendChild($this->dd->createTextNode($offer['name']));
|
||||
$e->appendChild($this->dd->createElement('vendor'))->appendChild($this->dd->createTextNode($offer['manufacturer']));
|
||||
$e->appendChild($this->dd->createElement('price', $offer['price']));
|
||||
|
||||
if ($offer['image']) {
|
||||
$image = $this->model_tool_image->resize($offer['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
|
||||
} else {
|
||||
$image = false;
|
||||
}
|
||||
|
||||
$e->appendChild($this->dd->createElement('picture', $image));
|
||||
$e->appendChild($this->dd->createElement('url'))->appendChild($this->dd->createTextNode(HTTP_SERVER . 'order-now/'));
|
||||
|
||||
$sku = $this->dd->createElement('param');
|
||||
$sku->setAttribute('name', 'article');
|
||||
$sku->appendChild($this->dd->createTextNode($offer['sku']));
|
||||
$e->appendChild($sku);
|
||||
|
||||
$weight = $this->dd->createElement('param');
|
||||
$weight->setAttribute('name', 'weight');
|
||||
$weight->appendChild($this->dd->createTextNode($offer['weight'] . ' ' . $offer['weight_class']));
|
||||
$e->appendChild($weight);
|
||||
|
||||
$size = $this->dd->createElement('param');
|
||||
$size->setAttribute('name', 'size');
|
||||
$size->appendChild($this->dd->createTextNode($offer['length'] .'x'. $offer['width'] .'x'. $offer['height']));
|
||||
$e->appendChild($size);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
34
system/library/intarocrm/composer.json
Normal file
34
system/library/intarocrm/composer.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "intarocrm/opencart-module",
|
||||
"description": "Prestashop integration for IntaroCRM",
|
||||
"type": "library",
|
||||
"keywords": ["api", "Intaro CRM", "rest"],
|
||||
"homepage": "http://www.intarocrm.ru/",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alex Lushpai",
|
||||
"email": "lushpai@intaro.ru",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"email": "support@intarocrm.ru"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3",
|
||||
"intarocrm/rest-api-client": "1.2.*",
|
||||
"symfony/console": "dev-master",
|
||||
"monolog/monolog": "dev-master"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"": "/"
|
||||
}
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/intarocrm/rest-api-client"
|
||||
}
|
||||
]
|
||||
}
|
BIN
system/library/intarocrm/composer.phar
Executable file
BIN
system/library/intarocrm/composer.phar
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user