Skip to content
This repository has been archived by the owner on Jan 26, 2018. It is now read-only.

Commit

Permalink
Merge pull request #3 from Magmodules/development
Browse files Browse the repository at this point in the history
1.5.2
  • Loading branch information
Magmodules authored May 10, 2017
2 parents 2a4c3ff + b8013ed commit 5909f07
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
11 changes: 9 additions & 2 deletions app/code/community/Magmodules/Feedbackcompany/Model/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
Expand Down Expand Up @@ -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');
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<config>
<modules>
<Magmodules_Feedbackcompany>
<version>1.5.1</version>
<version>1.5.2</version>
</Magmodules_Feedbackcompany>
</modules>
<global>
Expand Down

0 comments on commit 5909f07

Please sign in to comment.