Version Notes
Tracking of Lipscore installations
Download this release
Release Info
Developer | Henning Frettem |
Extension | lipscore |
Version | 1.2.21 |
Comparing to | |
See all releases |
Code changes from version 1.2.20 to 1.2.21
- app/code/community/Lipscore/RatingsReviews/Helper/Module.php +19 -0
- app/code/community/Lipscore/RatingsReviews/Model/Api/Request.php +60 -0
- app/code/community/Lipscore/RatingsReviews/Model/Config.php +50 -5
- app/code/community/Lipscore/RatingsReviews/Model/Observer.php +11 -0
- app/code/community/Lipscore/RatingsReviews/Model/Purchase/Reminder.php +7 -27
- app/code/community/Lipscore/RatingsReviews/Model/Shop.php +52 -0
- app/code/community/Lipscore/RatingsReviews/Model/System/Config/Backend/Apikey.php +72 -0
- app/code/community/Lipscore/RatingsReviews/Model/Tracker/Action.php +29 -0
- app/code/community/Lipscore/RatingsReviews/Model/Tracker/Installation.php +79 -0
- app/code/community/Lipscore/RatingsReviews/data/lipscore_ratingsreviews_setup/data-install-1.2.21.0.php +10 -0
- app/code/community/Lipscore/RatingsReviews/etc/config.xml +17 -1
- app/code/community/Lipscore/RatingsReviews/etc/system.xml +1 -0
- package.xml +5 -5
app/code/community/Lipscore/RatingsReviews/Helper/Module.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Helper_Module extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
+
{
|
5 |
+
public function getVersion()
|
6 |
+
{
|
7 |
+
return (string) Mage::getConfig()->getNode('modules/Lipscore_RatingsReviews/version');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function isNewVersion()
|
11 |
+
{
|
12 |
+
$website = Mage::app()->getWebsite();
|
13 |
+
$lipscoreConfig = Mage::getModel('lipscore_ratingsreviews/config', array('website' => $website));
|
14 |
+
$oldVersion = (string) $lipscoreConfig->lastTrackedVersion();
|
15 |
+
$newVersion = $this->getVersion();
|
16 |
+
|
17 |
+
return strcmp($oldVersion, $newVersion) < 0;
|
18 |
+
}
|
19 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Api/Request.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_Api_Request
|
4 |
+
{
|
5 |
+
protected $lipscoreConfig;
|
6 |
+
protected $path;
|
7 |
+
protected $requestType;
|
8 |
+
protected $response;
|
9 |
+
|
10 |
+
public function __construct($params)
|
11 |
+
{
|
12 |
+
$this->checkParameter($params, 'lipscoreConfig');
|
13 |
+
$this->checkParameter($params, 'path');
|
14 |
+
|
15 |
+
$this->lipscoreConfig = $params['lipscoreConfig'];
|
16 |
+
$this->path = $params['path'];
|
17 |
+
|
18 |
+
if (!empty($params['requestType'])) {
|
19 |
+
$this->requestType = $params['requestType'];
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getResponseMsg()
|
24 |
+
{
|
25 |
+
return $this->response ? $this->response->__toString() : '';
|
26 |
+
}
|
27 |
+
|
28 |
+
public function send($data)
|
29 |
+
{
|
30 |
+
$apiKey = $this->lipscoreConfig->apiKey();
|
31 |
+
$apiUrl = Mage::getModel('lipscore_ratingsreviews/config_env')->apiUrl();
|
32 |
+
|
33 |
+
$client = new Zend_Http_Client(
|
34 |
+
"http://$apiUrl/{$this->path}?api_key=$apiKey", array('timeout' => 60)
|
35 |
+
);
|
36 |
+
$client->setRawData(json_encode($data), 'application/json')
|
37 |
+
->setMethod($this->getRequestType());
|
38 |
+
|
39 |
+
$this->response = $client->request();
|
40 |
+
|
41 |
+
$result = $this->response->isSuccessful();
|
42 |
+
if ($result) {
|
43 |
+
$result = json_decode($this->response->getBody(), true);
|
44 |
+
}
|
45 |
+
|
46 |
+
return $result;
|
47 |
+
}
|
48 |
+
|
49 |
+
protected function checkParameter($params, $name)
|
50 |
+
{
|
51 |
+
if (empty($params[$name])) {
|
52 |
+
throw new Exception("$name parameter is empty");
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
protected function getRequestType()
|
57 |
+
{
|
58 |
+
return $this->requestType ? $this->requestType : Zend_Http_Client::POST;
|
59 |
+
}
|
60 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Config.php
CHANGED
@@ -8,6 +8,7 @@ class Lipscore_RatingsReviews_Model_Config
|
|
8 |
'brand' => 'lipscore_general/product_brand/',
|
9 |
'apiKey' => 'lipscore_general/api_key/',
|
10 |
'locale' => 'lipscore_general/locale/',
|
|
|
11 |
);
|
12 |
|
13 |
protected $store = null;
|
@@ -21,20 +22,39 @@ class Lipscore_RatingsReviews_Model_Config
|
|
21 |
|
22 |
public function get($param, $type)
|
23 |
{
|
24 |
-
$key =
|
25 |
return $this->getMageConfig($key);
|
26 |
}
|
27 |
|
28 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
if ($this->store) {
|
31 |
-
return $this->store->getConfig($
|
32 |
}
|
33 |
if ($this->website) {
|
34 |
-
return $this->website->getConfig($
|
35 |
}
|
36 |
-
return Mage::getStoreConfig($
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
public function apiKey()
|
40 |
{
|
@@ -65,4 +85,29 @@ class Lipscore_RatingsReviews_Model_Config
|
|
65 |
{
|
66 |
return $this->get('attr', 'identifier');
|
67 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
8 |
'brand' => 'lipscore_general/product_brand/',
|
9 |
'apiKey' => 'lipscore_general/api_key/',
|
10 |
'locale' => 'lipscore_general/locale/',
|
11 |
+
'tracking' => 'lipscore_plugin/'
|
12 |
);
|
13 |
|
14 |
protected $store = null;
|
22 |
|
23 |
public function get($param, $type)
|
24 |
{
|
25 |
+
$key = $this->getKey($param, $type);
|
26 |
return $this->getMageConfig($key);
|
27 |
}
|
28 |
|
29 |
+
public function set($param, $type, $value)
|
30 |
+
{
|
31 |
+
$key = $this->getKey($param, $type);
|
32 |
+
return $this->setMageConfig($key, $value);
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getMageConfig($path)
|
36 |
{
|
37 |
if ($this->store) {
|
38 |
+
return $this->store->getConfig($path);
|
39 |
}
|
40 |
if ($this->website) {
|
41 |
+
return $this->website->getConfig($path);
|
42 |
}
|
43 |
+
return Mage::getStoreConfig($path);
|
44 |
}
|
45 |
+
|
46 |
+
public function setMageConfig($path, $value)
|
47 |
+
{
|
48 |
+
if ($this->website) {
|
49 |
+
$scope = 'websites';
|
50 |
+
$scopeId = $this->website->getId();
|
51 |
+
} else {
|
52 |
+
$scope = 'stores';
|
53 |
+
$store = $this->store ? $this->store : Mage::app()->getStore();
|
54 |
+
$scopeId = $store->getId();
|
55 |
+
}
|
56 |
+
return Mage::getConfig()->saveConfig($path, $value, $scope, $scopeId);
|
57 |
+
}
|
58 |
|
59 |
public function apiKey()
|
60 |
{
|
85 |
{
|
86 |
return $this->get('attr', 'identifier');
|
87 |
}
|
88 |
+
|
89 |
+
public function lastTrackedVersion()
|
90 |
+
{
|
91 |
+
return $this->get('last_tracked_version', 'tracking');
|
92 |
+
}
|
93 |
+
|
94 |
+
public function pluginInstallationId()
|
95 |
+
{
|
96 |
+
return $this->get('plugin_installation_id', 'tracking');
|
97 |
+
}
|
98 |
+
|
99 |
+
public function setLastTrackedVersion($value)
|
100 |
+
{
|
101 |
+
return $this->set('last_tracked_version', 'tracking', $value);
|
102 |
+
}
|
103 |
+
|
104 |
+
public function setPluginInstallationId($value)
|
105 |
+
{
|
106 |
+
return $this->set('plugin_installation_id', 'tracking', $value);
|
107 |
+
}
|
108 |
+
|
109 |
+
protected function getKey($param, $type)
|
110 |
+
{
|
111 |
+
return self::$_systemConfigs[$type] . $param;
|
112 |
+
}
|
113 |
}
|
app/code/community/Lipscore/RatingsReviews/Model/Observer.php
CHANGED
@@ -91,6 +91,17 @@ class Lipscore_RatingsReviews_Model_Observer
|
|
91 |
$transport->setHtml($html);
|
92 |
}
|
93 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
protected function _disableModuleOutput($moduleName)
|
96 |
{
|
91 |
$transport->setHtml($html);
|
92 |
}
|
93 |
}
|
94 |
+
|
95 |
+
public function checkModuleVersion(Varien_Event_Observer $observer)
|
96 |
+
{
|
97 |
+
$moduleHelper = Mage::helper('lipscore_ratingsreviews/module');
|
98 |
+
if ($moduleHelper->isNewVersion()) {
|
99 |
+
$website = Mage::app()->getWebsite();
|
100 |
+
$tracker = Mage::getModel('lipscore_ratingsreviews/tracker_installation');
|
101 |
+
$tracker->trackUpgrade($website);
|
102 |
+
}
|
103 |
+
|
104 |
+
}
|
105 |
|
106 |
protected function _disableModuleOutput($moduleName)
|
107 |
{
|
app/code/community/Lipscore/RatingsReviews/Model/Purchase/Reminder.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
|
3 |
class Lipscore_RatingsReviews_Model_Purchase_Reminder
|
4 |
{
|
5 |
-
protected $lipscoreConfig
|
6 |
-
protected $
|
7 |
|
8 |
const LOG_FILE = 'lipscore_reminder.log';
|
9 |
|
@@ -13,6 +13,10 @@ class Lipscore_RatingsReviews_Model_Purchase_Reminder
|
|
13 |
$storeCode = isset($params['storeCode']) ? $params['storeCode'] : null;
|
14 |
|
15 |
$this->lipscoreConfig = Mage::helper('lipscore_ratingsreviews/config')->getScoped($websiteCode, $storeCode);
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function send($orders)
|
@@ -24,31 +28,7 @@ class Lipscore_RatingsReviews_Model_Purchase_Reminder
|
|
24 |
$data[] = $dataHelper->orderData($order);
|
25 |
}
|
26 |
|
27 |
-
return $this->
|
28 |
-
}
|
29 |
-
|
30 |
-
public function getResponseMsg()
|
31 |
-
{
|
32 |
-
return $this->response ? $this->response->__toString() : '';
|
33 |
-
}
|
34 |
-
|
35 |
-
protected function sendRequest($data)
|
36 |
-
{
|
37 |
-
$apiKey = $this->lipscoreConfig->apiKey();
|
38 |
-
$apiUrl = Mage::getModel('lipscore_ratingsreviews/config_env')->apiUrl();
|
39 |
-
|
40 |
-
$client = new Zend_Http_Client("http://$apiUrl/purchases?api_key=$apiKey", array(
|
41 |
-
'timeout' => 300
|
42 |
-
));
|
43 |
-
$client->setRawData(json_encode($data), 'application/json')
|
44 |
-
->setMethod(Zend_Http_Client::POST);
|
45 |
-
|
46 |
-
$this->response = $client->request();
|
47 |
-
$result = $this->response->isSuccessful();
|
48 |
-
|
49 |
-
$this->log($result);
|
50 |
-
|
51 |
-
return $result;
|
52 |
}
|
53 |
|
54 |
protected function log($isSuccessful)
|
2 |
|
3 |
class Lipscore_RatingsReviews_Model_Purchase_Reminder
|
4 |
{
|
5 |
+
protected $lipscoreConfig;
|
6 |
+
protected $sender;
|
7 |
|
8 |
const LOG_FILE = 'lipscore_reminder.log';
|
9 |
|
13 |
$storeCode = isset($params['storeCode']) ? $params['storeCode'] : null;
|
14 |
|
15 |
$this->lipscoreConfig = Mage::helper('lipscore_ratingsreviews/config')->getScoped($websiteCode, $storeCode);
|
16 |
+
$this->sender = Mage::getModel('lipscore_ratingsreviews/api_request', array(
|
17 |
+
'lipscoreConfig' => $this->lipscoreConfig,
|
18 |
+
'path' => 'purchases'
|
19 |
+
));
|
20 |
}
|
21 |
|
22 |
public function send($orders)
|
28 |
$data[] = $dataHelper->orderData($order);
|
29 |
}
|
30 |
|
31 |
+
return $this->sender->send(array('purchases' => $data));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
|
34 |
protected function log($isSuccessful)
|
app/code/community/Lipscore/RatingsReviews/Model/Shop.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_Shop
|
4 |
+
{
|
5 |
+
protected $name;
|
6 |
+
protected $url;
|
7 |
+
protected $contactName;
|
8 |
+
protected $contactEmail;
|
9 |
+
protected $country;
|
10 |
+
protected $langs;
|
11 |
+
|
12 |
+
public function __construct($params)
|
13 |
+
{
|
14 |
+
$this->checkParameter($params, 'website');
|
15 |
+
|
16 |
+
$website = $params['website'];
|
17 |
+
|
18 |
+
$this->name = $website->getName();
|
19 |
+
$this->url = $website->getConfig('web/unsecure/base_url');
|
20 |
+
$this->contactName = $website->getConfig('trans_email/ident_general/name');
|
21 |
+
$this->contactEmail = $website->getConfig('trans_email/ident_general/email');
|
22 |
+
$this->country = $website->getConfig('general/store_information/merchant_country');
|
23 |
+
$this->langs = $this->findLangs($website);
|
24 |
+
}
|
25 |
+
|
26 |
+
public function __get($name) {
|
27 |
+
if (property_exists($this, $name)) {
|
28 |
+
return $this->$name;
|
29 |
+
} else {
|
30 |
+
new Exception("Undefined property $name");
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
protected function checkParameter($params, $name)
|
35 |
+
{
|
36 |
+
if (empty($params[$name])) {
|
37 |
+
throw new Exception("$name parameter is empty");
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
protected function findLangs($website)
|
42 |
+
{
|
43 |
+
$langs = array();
|
44 |
+
$stores = $website->getStores();
|
45 |
+
|
46 |
+
foreach ($stores as $store) {
|
47 |
+
$langs[] = $store->getConfig('general/locale/code');
|
48 |
+
}
|
49 |
+
|
50 |
+
return array_unique($langs);
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/System/Config/Backend/Apikey.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_System_Config_Backend_Apikey extends Mage_Core_Model_Config_Data
|
4 |
+
{
|
5 |
+
protected $trackedWebsites = array();
|
6 |
+
|
7 |
+
protected function _afterSave()
|
8 |
+
{
|
9 |
+
parent::_afterSave();
|
10 |
+
|
11 |
+
if (!$this->isValueChanged()) {
|
12 |
+
return $this;
|
13 |
+
}
|
14 |
+
|
15 |
+
try {
|
16 |
+
$this->findSitesForTracking();
|
17 |
+
} catch (Exception $e) {
|
18 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
19 |
+
}
|
20 |
+
|
21 |
+
return $this;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function afterCommitCallback()
|
25 |
+
{
|
26 |
+
parent::afterCommitCallback();
|
27 |
+
|
28 |
+
try {
|
29 |
+
$this->trackChanges();
|
30 |
+
} catch (Exception $e) {
|
31 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
32 |
+
}
|
33 |
+
|
34 |
+
return $this;
|
35 |
+
}
|
36 |
+
|
37 |
+
protected function findSitesForTracking()
|
38 |
+
{
|
39 |
+
$storeCode = $this->getStoreCode();
|
40 |
+
if (!empty($storeCode)) {
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
|
44 |
+
$websiteCode = $this->getWebsiteCode();
|
45 |
+
|
46 |
+
if ($websiteCode) {
|
47 |
+
$this->trackedWebsites[] = Mage::app()->getWebsite($websiteCode);
|
48 |
+
} else {
|
49 |
+
$path = $this->getPath();
|
50 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
51 |
+
$inherit = false;
|
52 |
+
Mage::getModel('adminhtml/config_data')
|
53 |
+
->setSection('lipscore_general')
|
54 |
+
->setWebsite($website->getCode())
|
55 |
+
->getConfigDataValue($path, $inherit);
|
56 |
+
if ($inherit) {
|
57 |
+
$this->trackedWebsites[] = $website;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
protected function trackChanges()
|
64 |
+
{
|
65 |
+
Mage::app()->getConfig()->reinit();
|
66 |
+
|
67 |
+
$tracker = Mage::getModel('lipscore_ratingsreviews/tracker_action');
|
68 |
+
foreach ($this->trackedWebsites as $website) {
|
69 |
+
$tracker->track(Lipscore_RatingsReviews_Model_Tracker_Action::API_KEY_UPDATED, $website);
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Tracker/Action.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Lipscore_RatingsReviews_Model_Tracker_Action
|
3 |
+
{
|
4 |
+
const APP_INSTALLED = 'installed';
|
5 |
+
const API_KEY_UPDATED = 'api_key_updated';
|
6 |
+
|
7 |
+
public function track($actionType, $website)
|
8 |
+
{
|
9 |
+
$lipscoreConfig = Mage::helper('lipscore_ratingsreviews/config')->getScoped($website->getCode(), null);
|
10 |
+
|
11 |
+
$installationId = $lipscoreConfig->pluginInstallationId();
|
12 |
+
if (empty($installationId)) {
|
13 |
+
return false;
|
14 |
+
}
|
15 |
+
|
16 |
+
$sender = $this->getSender($lipscoreConfig, $installationId);
|
17 |
+
$data = array('action_type' => $actionType);
|
18 |
+
|
19 |
+
return $sender->send($data);
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function getSender($lipscoreConfig, $installationId)
|
23 |
+
{
|
24 |
+
return Mage::getModel('lipscore_ratingsreviews/api_request', array(
|
25 |
+
'lipscoreConfig' => $lipscoreConfig,
|
26 |
+
'path' => "plugin_installations/$installationId/actions"
|
27 |
+
));
|
28 |
+
}
|
29 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Tracker/Installation.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Lipscore_RatingsReviews_Model_Tracker_Installation
|
3 |
+
{
|
4 |
+
public function track($website)
|
5 |
+
{
|
6 |
+
$lipscoreConfig = $this->getConfig($website);
|
7 |
+
$data = $this->getData($website);
|
8 |
+
$sender = $this->getSender($lipscoreConfig, 'POST');
|
9 |
+
|
10 |
+
$result = $sender->send($data);
|
11 |
+
$isSuccess = $result && !empty($result['id']);
|
12 |
+
if ($isSuccess) {
|
13 |
+
$lipscoreConfig->setLastTrackedVersion($this->getPluginVersion());
|
14 |
+
$lipscoreConfig->setPluginInstallationId($result['id']);
|
15 |
+
}
|
16 |
+
|
17 |
+
return $isSuccess;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function trackUpgrade($website)
|
21 |
+
{
|
22 |
+
$lipscoreConfig = $this->getConfig($website);
|
23 |
+
|
24 |
+
$installationId = $lipscoreConfig->pluginInstallationId();
|
25 |
+
if (empty($installationId)) {
|
26 |
+
return false;
|
27 |
+
}
|
28 |
+
|
29 |
+
$sender = $this->getSender($lipscoreConfig, 'PUT', $installationId);
|
30 |
+
$result = $sender->send(array('plugin_version' => $this->getPluginVersion()));
|
31 |
+
if ($result) {
|
32 |
+
$lipscoreConfig->setLastTrackedVersion($this->getPluginVersion());
|
33 |
+
}
|
34 |
+
|
35 |
+
return !empty($result);
|
36 |
+
}
|
37 |
+
|
38 |
+
protected function getData($website)
|
39 |
+
{
|
40 |
+
$shop = Mage::getModel('lipscore_ratingsreviews/shop', array('website' => $website));
|
41 |
+
$moduleHelper = Mage::helper('lipscore_ratingsreviews/module');
|
42 |
+
|
43 |
+
return array(
|
44 |
+
'name' => $shop->name,
|
45 |
+
'url' => $shop->url,
|
46 |
+
'contact_name' => $shop->contactName,
|
47 |
+
'contact_email' => $shop->contactEmail,
|
48 |
+
'country' => $shop->country,
|
49 |
+
'platform' => 'magento',
|
50 |
+
'platform_version' => Mage::getVersion(),
|
51 |
+
'plugin_version' => $moduleHelper->getversion(),
|
52 |
+
'langs' => $shop->langs
|
53 |
+
);
|
54 |
+
}
|
55 |
+
|
56 |
+
protected function getSender($lipscoreConfig, $requestType, $installationId = null)
|
57 |
+
{
|
58 |
+
$path = 'plugin_installations';
|
59 |
+
if ($installationId) {
|
60 |
+
$path .= "/$installationId";
|
61 |
+
}
|
62 |
+
return Mage::getModel('lipscore_ratingsreviews/api_request', array(
|
63 |
+
'lipscoreConfig' => $lipscoreConfig,
|
64 |
+
'path' => $path,
|
65 |
+
'requestType' => $requestType
|
66 |
+
));
|
67 |
+
}
|
68 |
+
|
69 |
+
protected function getConfig($website)
|
70 |
+
{
|
71 |
+
return Mage::getModel('lipscore_ratingsreviews/config', array('website' => $website));
|
72 |
+
}
|
73 |
+
|
74 |
+
protected function getPluginVersion()
|
75 |
+
{
|
76 |
+
$moduleHelper = Mage::helper('lipscore_ratingsreviews/module');
|
77 |
+
return $moduleHelper->getVersion();
|
78 |
+
}
|
79 |
+
}
|
app/code/community/Lipscore/RatingsReviews/data/lipscore_ratingsreviews_setup/data-install-1.2.21.0.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
try {
|
3 |
+
$tracker = Mage::getModel('lipscore_ratingsreviews/tracker_installation');
|
4 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
5 |
+
$result = $tracker->track($website);
|
6 |
+
}
|
7 |
+
} catch (Exception $e) {
|
8 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
9 |
+
}
|
10 |
+
|
app/code/community/Lipscore/RatingsReviews/etc/config.xml
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
<config>
|
12 |
<modules>
|
13 |
<Lipscore_RatingsReviews>
|
14 |
-
<version>1.
|
15 |
</Lipscore_RatingsReviews>
|
16 |
</modules>
|
17 |
|
@@ -87,7 +87,23 @@
|
|
87 |
</lipscore_ratingsreviews>
|
88 |
</observers>
|
89 |
</core_block_abstract_to_html_after>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
</events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
</global>
|
92 |
|
93 |
<admin>
|
11 |
<config>
|
12 |
<modules>
|
13 |
<Lipscore_RatingsReviews>
|
14 |
+
<version>1.2.21.0</version>
|
15 |
</Lipscore_RatingsReviews>
|
16 |
</modules>
|
17 |
|
87 |
</lipscore_ratingsreviews>
|
88 |
</observers>
|
89 |
</core_block_abstract_to_html_after>
|
90 |
+
<http_response_send_before>
|
91 |
+
<observers>
|
92 |
+
<lipscore_ratingsreviews>
|
93 |
+
<class>lipscore_ratingsreviews/observer</class>
|
94 |
+
<method>checkModuleVersion</method>
|
95 |
+
</lipscore_ratingsreviews>
|
96 |
+
</observers>
|
97 |
+
</http_response_send_before>
|
98 |
</events>
|
99 |
+
|
100 |
+
<resources>
|
101 |
+
<lipscore_ratingsreviews_setup>
|
102 |
+
<setup>
|
103 |
+
<module>Lipscore_RatingsReviews</module>
|
104 |
+
</setup>
|
105 |
+
</lipscore_ratingsreviews_setup>
|
106 |
+
</resources>
|
107 |
</global>
|
108 |
|
109 |
<admin>
|
app/code/community/Lipscore/RatingsReviews/etc/system.xml
CHANGED
@@ -31,6 +31,7 @@
|
|
31 |
<api_key translate="label comment">
|
32 |
<label>Api Key</label>
|
33 |
<frontend_model>lipscore_ratingsreviews/system_config_form_field_apikey</frontend_model>
|
|
|
34 |
<frontend_type>text</frontend_type>
|
35 |
<validate>required-entry</validate>
|
36 |
<sort_order>10</sort_order>
|
31 |
<api_key translate="label comment">
|
32 |
<label>Api Key</label>
|
33 |
<frontend_model>lipscore_ratingsreviews/system_config_form_field_apikey</frontend_model>
|
34 |
+
<backend_model>lipscore_ratingsreviews/system_config_backend_apikey</backend_model>
|
35 |
<frontend_type>text</frontend_type>
|
36 |
<validate>required-entry</validate>
|
37 |
<sort_order>10</sort_order>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>lipscore</name>
|
4 |
-
<version>1.2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://lipscore.com/signup">Terms of use</license>
|
7 |
<channel>community</channel>
|
@@ -11,11 +11,11 @@
|
|
11 |
Lipscore has a range of great features that will
|
12 |
take all the hassle out of collecting product reviews, and help convert more
|
13 |
visitors in to profitable customers.</description>
|
14 |
-
<notes>
|
15 |
<authors><author><name>Henning Frettem</name><user>Lipscore</user><email>henning@lipscore.com</email></author><author><name>Olga Ivanova</name><user>oivanova</user><email>o.ivanova@datacrafts.io</email></author></authors>
|
16 |
-
<date>2015-06-
|
17 |
-
<time>
|
18 |
-
<contents><target name="magecommunity"><dir name="Lipscore"><dir name="RatingsReviews"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="View.php" hash="c88cf05f967d7bdebe16ad4c8cb1864f"/></dir></dir><file name="Init.php" hash="54aa73f8964025643d200ef83d79a21f"/><dir name="Purchase"><file name="Abstract.php" hash="aaaabff2ee4366393c66b3a4469f8957"/><file name="Multishipping.php" hash="5b32395d9054b0a242a59e4f9f38988e"/><file name="Onepage.php" hash="ff7faab280d62e4bb906ebdd45521d65"/></dir><dir name="Review"><file name="Helper.php" hash="ca5340736a6b7ecc41f1635b255ff4fc"/><file name="TabTitle.php" hash="4b823e24b4f497554283791a70c68b09"/></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Coupons.php" hash="359eeb7d3913a2b52e7a704afd978464"/><dir name="Field"><file name="Abstract.php" hash="0e8b5385e58dfe4f1f92ddf6063b6376"/><file name="Apikey.php" hash="4012af99141381375a0a4d294bc60f88"/><file name="Reminderperiod.php" hash="5f094e164d7dd7f6c624feb3b3bfd5e6"/></dir><dir name="Fieldset"><file name="Coupons.php" hash="08b73ed814a47b46c05cf14889bb4ead"/><file name="Dashboardlink.php" hash="910a177378d3a5815b56349b2ddcc9bf"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Abstract.php" hash="65d8d9da169b1b1c4477d7d83c985c84"/><file name="Config.php" hash="10a7f292094fa16515975769bf675d13"/><file name="Coupon.php" hash="748ea1f72a63f22efdd9bffc4db27ce3"/><file name="Data.php" hash="6ae3c816d5d899f6f8050c213860ecf0"/><file name="Locale.php" hash="29665a64635bcde29a8cc841a0100add"/><file name="Product.php" hash="dfc10efaa05c064f956e742877e831fc"/><file name="Purchase.php" hash="9024bc8da7ed7432ea36902e2aecc14d"/><file name="Reminder.php" hash="190dcd087e406fba5254adb58ded959c"/></dir><file name="Logger.php" hash="b9d3b2df0bb8c2a8191763202ad272f8"/><dir name="Model"><dir name="Config"><file name="Env.php" hash="06610d75a570d1f6dbb75969ca11be82"/></dir><file name="Config.php" hash="
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>lipscore</name>
|
4 |
+
<version>1.2.21</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://lipscore.com/signup">Terms of use</license>
|
7 |
<channel>community</channel>
|
11 |
Lipscore has a range of great features that will
|
12 |
take all the hassle out of collecting product reviews, and help convert more
|
13 |
visitors in to profitable customers.</description>
|
14 |
+
<notes>Tracking of Lipscore installations</notes>
|
15 |
<authors><author><name>Henning Frettem</name><user>Lipscore</user><email>henning@lipscore.com</email></author><author><name>Olga Ivanova</name><user>oivanova</user><email>o.ivanova@datacrafts.io</email></author></authors>
|
16 |
+
<date>2015-06-25</date>
|
17 |
+
<time>10:11:03</time>
|
18 |
+
<contents><target name="magecommunity"><dir name="Lipscore"><dir name="RatingsReviews"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="View.php" hash="c88cf05f967d7bdebe16ad4c8cb1864f"/></dir></dir><file name="Init.php" hash="54aa73f8964025643d200ef83d79a21f"/><dir name="Purchase"><file name="Abstract.php" hash="aaaabff2ee4366393c66b3a4469f8957"/><file name="Multishipping.php" hash="5b32395d9054b0a242a59e4f9f38988e"/><file name="Onepage.php" hash="ff7faab280d62e4bb906ebdd45521d65"/></dir><dir name="Review"><file name="Helper.php" hash="ca5340736a6b7ecc41f1635b255ff4fc"/><file name="TabTitle.php" hash="4b823e24b4f497554283791a70c68b09"/></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Coupons.php" hash="359eeb7d3913a2b52e7a704afd978464"/><dir name="Field"><file name="Abstract.php" hash="0e8b5385e58dfe4f1f92ddf6063b6376"/><file name="Apikey.php" hash="4012af99141381375a0a4d294bc60f88"/><file name="Reminderperiod.php" hash="5f094e164d7dd7f6c624feb3b3bfd5e6"/></dir><dir name="Fieldset"><file name="Coupons.php" hash="08b73ed814a47b46c05cf14889bb4ead"/><file name="Dashboardlink.php" hash="910a177378d3a5815b56349b2ddcc9bf"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Abstract.php" hash="65d8d9da169b1b1c4477d7d83c985c84"/><file name="Config.php" hash="10a7f292094fa16515975769bf675d13"/><file name="Coupon.php" hash="748ea1f72a63f22efdd9bffc4db27ce3"/><file name="Data.php" hash="6ae3c816d5d899f6f8050c213860ecf0"/><file name="Locale.php" hash="29665a64635bcde29a8cc841a0100add"/><file name="Module.php" hash="ab2f87306a2a1456eb9835adecdd19d3"/><file name="Product.php" hash="dfc10efaa05c064f956e742877e831fc"/><file name="Purchase.php" hash="9024bc8da7ed7432ea36902e2aecc14d"/><file name="Reminder.php" hash="190dcd087e406fba5254adb58ded959c"/></dir><file name="Logger.php" hash="b9d3b2df0bb8c2a8191763202ad272f8"/><dir name="Model"><dir name="Api"><file name="Request.php" hash="43f5f3dbd1263c51c994d4373f9e243c"/></dir><dir name="Config"><file name="Env.php" hash="06610d75a570d1f6dbb75969ca11be82"/></dir><file name="Config.php" hash="6ea2fdcebaaf66f1ac1cea9438d63ecc"/><dir name="Coupon"><file name="Generator.php" hash="d3164b63b6535e712888ce0c25900e12"/></dir><file name="Observer.php" hash="a7294ba9e660d72b777e3d9694136eb0"/><dir name="Purchase"><file name="Reminder.php" hash="8f3bbd220f479660ef4b27f418b21488"/></dir><file name="Shop.php" hash="6495d5d2f6d1ef5203c33726ab860957"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Apikey.php" hash="9e454095ab56736cf96b4379bb6eea10"/></dir><dir name="Source"><file name="Identifiertype.php" hash="6b6f48d72b35eb5c30389ce2cbd306f3"/><file name="Locale.php" hash="8d9f9fb8207d2721a2e3d97ce7a4fbec"/><dir name="Order"><file name="Status.php" hash="1a5107f688509b981dcdb40c44784f6b"/></dir><file name="Pricerule.php" hash="b100a5b624e5188691fa3f7c0dbed275"/><dir name="Productattr"><file name="Brand.php" hash="0bcb5b3ce8f0fefca0d52108e3b9807c"/><file name="Identifier.php" hash="15af8ee20f4fa40c2a702b90d7f45840"/></dir><file name="Reminderperiod.php" hash="674ad0760ba520655f1f4cabb4340b55"/></dir></dir></dir><dir name="Tracker"><file name="Action.php" hash="451371812bc5eae57fb26afa16bf3388"/><file name="Installation.php" hash="7965dbb24c8b5dd0b6f03e0da67e5adc"/></dir></dir><dir name="controllers"><dir name="Purchases"><file name="RemindersController.php" hash="1ec905ce1e9d29a7768f2bfe26f691fd"/></dir></dir><dir name="data"><dir name="lipscore_ratingsreviews_setup"><file name="data-install-1.2.21.0.php" hash="ad67c2ab5cb793f70207af6385e8d941"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="5edee417a954579c97186a8ebfdf3fbc"/><file name="config.xml" hash="30cb6a3a6d625b25d65d50377f6b2d25"/><dir name="environments"><file name="production.xml" hash="bb3749dea14df3f07007dc9c24658eff"/></dir><file name="system.xml" hash="b0a0096c4dc02018167811a4f287b6a4"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="lipscore"><file name="init.phtml" hash="45db33eec713376d9243f1d690e43e59"/><dir name="purchase"><file name="view.phtml" hash="c2b3c47fdd77a17b2c77d787fef9def4"/></dir><dir name="rating"><file name="view.phtml" hash="50c74a4dc0bda1ebde342a4ff0f4d267"/></dir><dir name="reviews"><file name="tab_title.phtml" hash="cee27e2ae8b71c9705097584e9c0c3cc"/><file name="view.phtml" hash="9d5c3ae48fdbe603b5fbce1d895b9813"/></dir></dir></dir><dir name="layout"><file name="lipscore_ratingsreviews.xml" hash="7f788c747525bf4644a5b86f7f6b20a0"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="lipscore_ratingsreviews.xml" hash="73e5f3cd2b25005bb0456f28c4a40c51"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Lipscore_RatingsReviews.xml" hash="a5bea23f8ccc23ae46ee206b4b827939"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="lipscore.css" hash="ff29f27edd404707ac381e5a29ebcc27"/></dir><dir name="js"><file name="lipscore.js" hash="00726b0be0c2485063adc1b3367dd755"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><file name="lipscore.css" hash="96f1694b0769b92e32142209f389e069"/><dir name="js"><file name="lipscore.js" hash="ac705dc56c03c08adadbbac86f1f10c3"/></dir></dir></dir></dir></target></contents>
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
21 |
</package>
|