From e69c4c11d9c1c44b9dcd55665663c5cd7f256e2b Mon Sep 17 00:00:00 2001 From: iyzoer Date: Fri, 1 Sep 2017 17:19:38 +0300 Subject: [PATCH] added custom folder for catalog model --- .../controller/extension/module/retailcrm.php | 36 ++++++++++++++----- .../model/extension/retailcrm/custom/.gitkeep | 0 2 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 catalog/model/extension/retailcrm/custom/.gitkeep diff --git a/catalog/controller/extension/module/retailcrm.php b/catalog/controller/extension/module/retailcrm.php index b056e93..1e56d51 100644 --- a/catalog/controller/extension/module/retailcrm.php +++ b/catalog/controller/extension/module/retailcrm.php @@ -44,8 +44,13 @@ class ControllerExtensionModuleRetailcrm extends Controller $data['order_status'] = $status[$moduleTitle . '_status'][$data['order_status_id']]; } - $this->load->model('extension/retailcrm/order'); - $this->model_extension_retailcrm_order->sendToCrm($data, $data['order_id']); + if (file_exists(DIR_APPLICATION . 'model/extension/retailcrm/custom/order.php')) { + $this->load->model('extension/retailcrm/custom/order'); + $this->model_extension_retailcrm_custom_order->sendToCrm($data, $data['order_id']); + } else { + $this->load->model('extension/retailcrm/order'); + $this->model_extension_retailcrm_order->sendToCrm($data, $data['order_id']); + } } } @@ -85,8 +90,13 @@ class ControllerExtensionModuleRetailcrm extends Controller $data['order_status'] = $status[$moduleTitle . '_status'][$data['order_status_id']]; } - $this->load->model('extension/retailcrm/order'); - $this->model_extension_retailcrm_order->changeInCrm($data, $data['order_id']); + if (file_exists(DIR_APPLICATION . 'model/extension/retailcrm/custom/order.php')) { + $this->load->model('extension/retailcrm/custom/order'); + $this->model_extension_retailcrm_custom_order->changeInCrm($data, $data['order_id']); + } else { + $this->load->model('extension/retailcrm/order'); + $this->model_extension_retailcrm_order->changeInCrm($data, $data['order_id']); + } } } @@ -119,8 +129,13 @@ class ControllerExtensionModuleRetailcrm extends Controller ); } - $this->load->model('extension/retailcrm/customer'); - $this->model_extension_retailcrm_customer->sendToCrm($customer); + if (file_exists(DIR_APPLICATION . 'model/extension/retailcrm/custom/customer.php')) { + $this->load->model('extension/retailcrm/custom/customer'); + $this->model_extension_retailcrm_custom_customer->sendToCrm($customer); + } else { + $this->load->model('extension/retailcrm/customer'); + $this->model_extension_retailcrm_customer->sendToCrm($customer); + } } /** @@ -139,8 +154,13 @@ class ControllerExtensionModuleRetailcrm extends Controller $this->load->model('account/address'); $customer['address'] = $this->model_account_address->getAddress($customer['address_id']); - $this->load->model('extension/retailcrm/customer'); - $this->model_extension_retailcrm_customer->changeInCrm($customer); + if (file_exists(DIR_APPLICATION . 'model/extension/retailcrm/custom/customer.php')) { + $this->load->model('extension/retailcrm/custom/customer'); + $this->model_extension_retailcrm_custom_customer->changeInCrm($customer); + } else { + $this->load->model('extension/retailcrm/customer'); + $this->model_extension_retailcrm_customer->changeInCrm($customer); + } } private function getModuleTitle() diff --git a/catalog/model/extension/retailcrm/custom/.gitkeep b/catalog/model/extension/retailcrm/custom/.gitkeep new file mode 100644 index 0000000..e69de29