From e01ae023da682389cebb3af191e34bfb6d3ce2d4 Mon Sep 17 00:00:00 2001 From: Magmodules Date: Fri, 5 May 2017 09:03:10 +0200 Subject: [PATCH 1/3] 1.5.2 --- .../Magmodules/Feedbackcompany/Model/Log.php | 11 +++++++++-- .../Magmodules/Feedbackcompany/Model/Observer.php | 2 +- .../Feedbackcompany/Model/Productreviews.php | 2 +- .../Magmodules/Feedbackcompany/Model/Reviews.php | 8 ++++++-- .../Magmodules/Feedbackcompany/etc/config.xml | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app/code/community/Magmodules/Feedbackcompany/Model/Log.php b/app/code/community/Magmodules/Feedbackcompany/Model/Log.php index ebda604..6a69f1b 100755 --- a/app/code/community/Magmodules/Feedbackcompany/Model/Log.php +++ b/app/code/community/Magmodules/Feedbackcompany/Model/Log.php @@ -40,14 +40,21 @@ public function _construct() * @param string $aUrl * @param string $oId */ - public function addToLog($type, $sId, $review = '', $res = '', $t = '', $cron = '', $aUrl = '', $oId = '') + public function addToLog($type, $sId, $review = '', $res = '', $t = '', $cron = '', $aUrl = '', $oId = '') { if (Mage::getStoreConfig('feedbackcompany/log/enabled')) { + + $company = isset($review['company']) ? $review['company'] : ''; + if (empty($company)) { + $stats = Mage::getModel('feedbackcompany/stats')->loadByStoreId($sId); + $company = $stats->getCompany(); + } + $data = array( 'type' => $type, 'shop_id' => Mage::getModel('feedbackcompany/api')->getClientId($sId), 'store_id' => $sId, - 'company' => isset($review['company']) ? $review['company'] : '', + 'company' => $company, 'review_updates' => isset($review['update']) ? $review['update'] : '', 'review_new' => isset($review['new']) ? $review['new'] : '', 'response' => $res, diff --git a/app/code/community/Magmodules/Feedbackcompany/Model/Observer.php b/app/code/community/Magmodules/Feedbackcompany/Model/Observer.php index 3675274..8fe3605 100755 --- a/app/code/community/Magmodules/Feedbackcompany/Model/Observer.php +++ b/app/code/community/Magmodules/Feedbackcompany/Model/Observer.php @@ -44,7 +44,7 @@ public function processReviews() $storeIds = Mage::getModel('feedbackcompany/api')->getStoreIds('cron'); foreach ($storeIds as $storeId) { $startTime = microtime(true); - $results = Mage::getModel('feedbackcompany/reviews')->runUpdate($storeId); + $results = Mage::getModel('feedbackcompany/reviews')->runUpdate($storeId, 'last_week'); $logModel->addToLog('reviews', $storeId, $results, '', $startTime, 'reviews'); } } diff --git a/app/code/community/Magmodules/Feedbackcompany/Model/Productreviews.php b/app/code/community/Magmodules/Feedbackcompany/Model/Productreviews.php index c6771fa..28959ef 100755 --- a/app/code/community/Magmodules/Feedbackcompany/Model/Productreviews.php +++ b/app/code/community/Magmodules/Feedbackcompany/Model/Productreviews.php @@ -35,7 +35,7 @@ class Magmodules_Feedbackcompany_Model_Productreviews extends Magmodules_Feedbac * * @return array */ - public function runUpdate($storeId, $type) + public function runUpdate($storeId, $type = 'last_week') { $feed = $this->getFeed($storeId, $type); diff --git a/app/code/community/Magmodules/Feedbackcompany/Model/Reviews.php b/app/code/community/Magmodules/Feedbackcompany/Model/Reviews.php index 8b12ebe..bfc2953 100755 --- a/app/code/community/Magmodules/Feedbackcompany/Model/Reviews.php +++ b/app/code/community/Magmodules/Feedbackcompany/Model/Reviews.php @@ -45,7 +45,7 @@ public function _construct() * * @return array */ - public function runUpdate($storeId, $type) + public function runUpdate($storeId, $type = 'last_week') { $feed = $this->getFeed($storeId, $type); @@ -54,7 +54,11 @@ public function runUpdate($storeId, $type) } if (!isset($feed['feed']['reviews'])) { - return array(); + return array( + 'status' => 'ERROR', + 'update' => 0, + 'new' => 0 + ); } foreach ($feed['feed']['reviews'] as $review) { diff --git a/app/code/community/Magmodules/Feedbackcompany/etc/config.xml b/app/code/community/Magmodules/Feedbackcompany/etc/config.xml index 12cd2bc..7fc73f7 100755 --- a/app/code/community/Magmodules/Feedbackcompany/etc/config.xml +++ b/app/code/community/Magmodules/Feedbackcompany/etc/config.xml @@ -20,7 +20,7 @@ - 1.5.1 + 1.5.2 From 53691a48c6a6779e65682ab621b233477d58701f Mon Sep 17 00:00:00 2001 From: Magmodules Date: Wed, 10 May 2017 12:26:04 +0200 Subject: [PATCH 2/3] 1.5.3 --- .../community/Magmodules/Feedbackcompany/Model/Observer.php | 2 +- app/code/community/Magmodules/Feedbackcompany/etc/config.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/community/Magmodules/Feedbackcompany/Model/Observer.php b/app/code/community/Magmodules/Feedbackcompany/Model/Observer.php index 8fe3605..8e6120c 100755 --- a/app/code/community/Magmodules/Feedbackcompany/Model/Observer.php +++ b/app/code/community/Magmodules/Feedbackcompany/Model/Observer.php @@ -72,7 +72,7 @@ public function processProductreviews() $storeIds = Mage::getModel('feedbackcompany/api')->getStoreIds('prcron'); foreach ($storeIds as $storeId) { $startTime = microtime(true); - $results = Mage::getModel('feedbackcompany/productreviews')->runUpdate($storeId); + $results = Mage::getModel('feedbackcompany/productreviews')->runUpdate($storeId, 'last_week'); $logModel->addToLog('productreviews', $storeId, $results, '', $startTime, 'productreviews'); } } diff --git a/app/code/community/Magmodules/Feedbackcompany/etc/config.xml b/app/code/community/Magmodules/Feedbackcompany/etc/config.xml index 7fc73f7..50319f8 100755 --- a/app/code/community/Magmodules/Feedbackcompany/etc/config.xml +++ b/app/code/community/Magmodules/Feedbackcompany/etc/config.xml @@ -20,7 +20,7 @@ - 1.5.2 + 1.5.3 From b8013ed1ad4999f6909e899ac12f7ac3934d9b9d Mon Sep 17 00:00:00 2001 From: Magmodules Date: Wed, 10 May 2017 12:27:19 +0200 Subject: [PATCH 3/3] 1.5.2 --- app/code/community/Magmodules/Feedbackcompany/etc/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/community/Magmodules/Feedbackcompany/etc/config.xml b/app/code/community/Magmodules/Feedbackcompany/etc/config.xml index 50319f8..7fc73f7 100755 --- a/app/code/community/Magmodules/Feedbackcompany/etc/config.xml +++ b/app/code/community/Magmodules/Feedbackcompany/etc/config.xml @@ -20,7 +20,7 @@ - 1.5.3 + 1.5.2