From c4553a0f584089adca5fb1f33d59bdd42896e4cc Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Mon, 22 Jun 2015 18:18:23 +0300 Subject: [PATCH] history init --- .../Retailcrm/Retailcrm/Model/Exchange.php | 14 +++++++++++++- .../Retailcrm/Retailcrm/Model/Observer.php | 7 ++++++- .../community/Retailcrm/Retailcrm/etc/config.xml | 4 ++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/code/community/Retailcrm/Retailcrm/Model/Exchange.php b/app/code/community/Retailcrm/Retailcrm/Model/Exchange.php index 6aba1a7..3061bf8 100644 --- a/app/code/community/Retailcrm/Retailcrm/Model/Exchange.php +++ b/app/code/community/Retailcrm/Retailcrm/Model/Exchange.php @@ -25,7 +25,7 @@ class Retailcrm_Retailcrm_Model_Exchange * * @return bool */ - public function orderCreate($order) + public function ordersCreate($order) { $this->_config = Mage::getStoreConfig('retailcrm', $order->getStoreId()); @@ -122,6 +122,18 @@ class Retailcrm_Retailcrm_Model_Exchange } } + public function ordersHistory() + { + $this->_config = Mage::getStoreConfig('retailcrm'); + + $statuses = array_flip(array_filter($this->_config['status'])); + $paymentsStatuses = array_flip(array_filter($this->_config['paymentstatus'])); + $payments = array_filter($this->_config['payment']); + $shippings = array_filter($this->_config['shipping']); + + Mage::log(var_export($this->_config, TRUE), null, 'history.log'); + } + /** * @param $customer * @return mixed diff --git a/app/code/community/Retailcrm/Retailcrm/Model/Observer.php b/app/code/community/Retailcrm/Retailcrm/Model/Observer.php index 55d5473..1592aa9 100644 --- a/app/code/community/Retailcrm/Retailcrm/Model/Observer.php +++ b/app/code/community/Retailcrm/Retailcrm/Model/Observer.php @@ -15,7 +15,7 @@ class Retailcrm_Retailcrm_Model_Observer public function orderCreate(Varien_Event_Observer $observer) { $order = $observer->getEvent()->getOrder(); - Mage::getModel('retailcrm/exchange')->orderCreate($order); + Mage::getModel('retailcrm/exchange')->ordersCreate($order); return true; } @@ -28,4 +28,9 @@ class Retailcrm_Retailcrm_Model_Observer } } } + + public function importHistory() + { + Mage::getModel('retailcrm/exchange')->ordersHistory(); + } } diff --git a/app/code/community/Retailcrm/Retailcrm/etc/config.xml b/app/code/community/Retailcrm/Retailcrm/etc/config.xml index 162c003..ca0af8b 100644 --- a/app/code/community/Retailcrm/Retailcrm/etc/config.xml +++ b/app/code/community/Retailcrm/Retailcrm/etc/config.xml @@ -62,6 +62,10 @@ SOFTWARE. * */4 * * * retailcrm/observer::exportCatalog + + */5 * * * * + retailcrm/observer::importHistory +