Merge pull request #47 from iyzoer/master

Fix for opencart version > 3.0
This commit is contained in:
Akolzin Dmitry 2017-09-06 13:14:34 +03:00 committed by GitHub
commit 0e32063eb6
3 changed files with 16 additions and 25 deletions

View File

@ -5,8 +5,8 @@ class ControllerApiRetailcrm extends Controller
{ {
$this->load->model('localisation/country'); $this->load->model('localisation/country');
$this->load->model('setting/setting'); $this->load->model('setting/setting');
$moduleTitle = $this->getModuleTitle();
$countries = $this->model_setting_setting->getSetting('retailcrm')['retailcrm_country']; $countries = $this->model_setting_setting->getSetting($moduleTitle)[$moduleTitle . '_country'];
$deliveryTypes = array(); $deliveryTypes = array();
foreach ($countries as $country) { foreach ($countries as $country) {

View File

@ -259,16 +259,6 @@ class ModelExtensionRetailcrmOrder extends Model {
'amount' => $amount 'amount' => $amount
); );
if (version_compare(VERSION, '3.0', '<')) {
if ($order['order_status_id'] == $settingPaid[$order['payment_code'] . '_order_status_id']) {
$payment['status'] = 'paid';
}
} else {
if ($order['order_status_id'] == $settingPaid['payment_' . $order['payment_code'] . '_order_status_id']) {
$payment['status'] = 'paid';
}
}
$payment['order'] = array( $payment['order'] = array(
'externalId' => $order_id 'externalId' => $order_id
); );
@ -296,16 +286,6 @@ class ModelExtensionRetailcrmOrder extends Model {
'amount' => $amount 'amount' => $amount
); );
if (version_compare(VERSION, '3.0', '<')) {
if ($order['order_status_id'] == $settingPaid[$order['payment_code'] . '_order_status_id']) {
$payment['status'] = 'paid';
}
} else {
if ($order['order_status_id'] == $settingPaid['payment_' . $order['payment_code'] . '_order_status_id']) {
$payment['status'] = 'paid';
}
}
$this->retailcrm->ordersPaymentEdit($payment); $this->retailcrm->ordersPaymentEdit($payment);
} }

View File

@ -14,9 +14,9 @@ class OpencartApiClient {
public function __construct(Registry &$registry) { public function __construct(Registry &$registry) {
$this->registry = $registry; $this->registry = $registry;
$moduleTitle = $this->getModuleTitle();
$settings = $this->model_setting_setting->getSetting('retailcrm'); $settings = $this->model_setting_setting->getSetting($moduleTitle);
$this->cookieFileName = $settings['retailcrm_apikey']; $this->cookieFileName = $settings[$moduleTitle . '_apikey'];
$this->auth(); $this->auth();
} }
@ -331,4 +331,15 @@ class OpencartApiClient {
return $api_token; return $api_token;
} }
private function getModuleTitle()
{
if (version_compare(VERSION, '3.0', '<')){
$title = 'retailcrm';
} else {
$title = 'module_retailcrm';
}
return $title;
}
} }