Version Notes
1.0.0
Download this release
Release Info
Developer | EcomwiseTeam |
Extension | Ecomwise_BestsellerSidebarFree |
Version | 1.0.0 |
Comparing to | |
See all releases |
Code changes from version 0.1.0 to 1.0.0
- INSTALLATION GUIDE.txt +0 -57
- USER GUIDE.txt +0 -40
- app/code/community/Ecomwise/Base/Block/NotificationsNotifier/System/Config/Form/Fieldset/Ecomwise/Extensions.php +44 -0
- app/code/community/Ecomwise/Base/Helper/Data.php +5 -0
- app/code/community/Ecomwise/Base/Model/ExtensionsLicencer/Observer.php +188 -0
- app/code/community/Ecomwise/Base/Model/NotificationsNotifier/Observer.php +136 -0
- app/code/community/Ecomwise/Base/Model/NotificationsNotifier/Source/Updates/Type.php +39 -0
- app/code/community/Ecomwise/Base/etc/config.xml +87 -0
- app/code/community/Ecomwise/Base/etc/system.xml +50 -0
- app/code/community/Ecomwise/FreeBestsellerssidebar/etc/config.xml +1 -1
- app/code/community/Ecomwise/FreeBestsellerssidebar/etc/system.xml +2 -2
- app/etc/modules/Ecomwise_Base.xml +9 -0
- app/etc/modules/Ecomwise_FreeBestsellerssidebar.xml +3 -0
- package.xml +9 -9
INSTALLATION GUIDE.txt
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
---- INSTALL NOTES ----
|
2 |
-
|
3 |
-
1. Copy the folders (and its content): "app","js" and "skin" to your root magento directory
|
4 |
-
2. If you are not using the default theme, then additionaly copy the following files and folders to your theme directory:
|
5 |
-
app/design/frontend/default/default/layout/callme.xml (file)
|
6 |
-
app/design/frontend/default/default/template/callme (folder and its content)
|
7 |
-
3.Clear the magento cache
|
8 |
-
4.Log out and log in again in your magento admin
|
9 |
-
5. For older versions like Magento 1.3.x it might be even needed for you to explicitely clear the magento cache files from /root/var/cache
|
10 |
-
So, once you are here, select all folders, and delete them including their content.
|
11 |
-
6. One additional measure that might need to be applied for Magento 1.3.x versions might be to clear your browser history (browser cache)
|
12 |
-
|
13 |
-
-- IMPORTANT NOTE --
|
14 |
-
|
15 |
-
Due to translating Java script purposes this extension overrides the Magento core file:
|
16 |
-
app/code/core/Mage/Core/Helper/Js.php
|
17 |
-
by using the file:
|
18 |
-
app/code/core/Mage/Core/Helper/Js.php
|
19 |
-
|
20 |
-
The changes are actually a added java script error for translation on lines: 208-209
|
21 |
-
|
22 |
-
|
23 |
-
If you already have a override of the Js.php file just make sure to copy these two lines
|
24 |
-
from the extension file and put it in the already present one.
|
25 |
-
If not you are risking to loose the previous overrides.
|
26 |
-
|
27 |
-
|
28 |
-
---- CONFIGURATION ----
|
29 |
-
|
30 |
-
In the magento admin browse to: System->Configuration,
|
31 |
-
and then under the "General" tab, look for the "Call me" link.
|
32 |
-
|
33 |
-
Two parameters are editable:
|
34 |
-
- the "email" to whom the request for call will be sent
|
35 |
-
- the "frontend message", which is purely the text that shows in the block
|
36 |
-
after the user has submitted the form successfully
|
37 |
-
- the "default message", which is purely the text that shows in the block by default
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
---- USAGE ----
|
43 |
-
|
44 |
-
You can call the block with a code simmilar to:
|
45 |
-
|
46 |
-
<reference name="reference_name">
|
47 |
-
<block type="Ecomwise_Callme/callme" name="block_name" template="callme/callme.phtml"></block>
|
48 |
-
</reference>
|
49 |
-
|
50 |
-
|
51 |
-
---- COMPATIBILITY ----
|
52 |
-
|
53 |
-
Magento 1.4.0, 1.4.1, 1.4.2
|
54 |
-
Magento 1.3.0, 1.3.1, 1.3.2
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
USER GUIDE.txt
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
-- CONFIGURATION --
|
2 |
-
|
3 |
-
The configuration for this extension is done via the Magento's backend:
|
4 |
-
System -> Configuration -> Catalog -> Bestsellers Sidebar
|
5 |
-
|
6 |
-
In the parameters section you are allowed to specify only the title of the block that is shown on the front.
|
7 |
-
For more options take a look at the Pro version of this extension
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
-- LOCATION OF DISPLAY --
|
12 |
-
|
13 |
-
The location of display is determined with the bestsellerssidebar.xml file found in app/design/frontend/default/default/layout folder
|
14 |
-
|
15 |
-
By default the block is displayed in all pages on the rightsidebar (pages that do have right sidebar).
|
16 |
-
|
17 |
-
To display the block on every page the <default></default> tag is used.
|
18 |
-
And the actual code that dispayls the block is:
|
19 |
-
<reference name="right">
|
20 |
-
<block type="bestsellerssidebar/bestsellers"/>
|
21 |
-
</reference>
|
22 |
-
|
23 |
-
The code above can be called in other .xml files as well.
|
24 |
-
|
25 |
-
Wyas to change the display
|
26 |
-
|
27 |
-
Example problem: lets say you only like to display this block on the only and only on the category page and only on the left sidebar.
|
28 |
-
|
29 |
-
Example solution:
|
30 |
-
- First remove the <default></default> tag and all its content from bestsellerssidebar.xml file.
|
31 |
-
- Open the catalog.xml file from your theme
|
32 |
-
- Add the following code
|
33 |
-
<reference name="left">
|
34 |
-
<block type="bestsellerssidebar/bestsellers"/>
|
35 |
-
</reference>
|
36 |
-
under the following tag: <catalog_category_default translate="label">
|
37 |
-
|
38 |
-
For more details about Magento layouts please visit:
|
39 |
-
http://www.magentocommerce.com/design_guide/articles/intro-to-layouts
|
40 |
-
http://magebase.com/magento-tutorials/demystifying-magentos-layout-xml-part-1/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Ecomwise/Base/Block/NotificationsNotifier/System/Config/Form/Fieldset/Ecomwise/Extensions.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ecomwise_Base_Block_NotificationsNotifier_System_Config_Form_Fieldset_Ecomwise_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $_dummyElement;
|
7 |
+
protected $_fieldRenderer;
|
8 |
+
protected $_values;
|
9 |
+
|
10 |
+
public function render(Varien_Data_Form_Element_Abstract $element){
|
11 |
+
$html = $this->_getHeaderHtml($element);
|
12 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules'));
|
13 |
+
sort($modules);
|
14 |
+
|
15 |
+
foreach ($modules as $moduleName) {
|
16 |
+
if(strstr($moduleName, 'Ecomwise_') !== false){
|
17 |
+
$html.= $this->_getFieldHtml($element, $moduleName);
|
18 |
+
}
|
19 |
+
}
|
20 |
+
$html .= $this->_getFooterHtml($element);
|
21 |
+
|
22 |
+
return $html;
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function _getFieldRenderer(){
|
26 |
+
if (empty($this->_fieldRenderer)){
|
27 |
+
$this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
|
28 |
+
}
|
29 |
+
return $this->_fieldRenderer;
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function _getFieldHtml($fieldset, $moduleName){
|
33 |
+
$version = Mage::getConfig()->getNode()->modules->$moduleName->version;
|
34 |
+
if ($version) {
|
35 |
+
$field = $fieldset->addField($moduleName, 'label', array(
|
36 |
+
'name' => $moduleName,
|
37 |
+
'label' => $moduleName,
|
38 |
+
'value' => 'v' . $version,
|
39 |
+
))->setRenderer($this->_getFieldRenderer());
|
40 |
+
return $field->toHtml();
|
41 |
+
}
|
42 |
+
return '';
|
43 |
+
}
|
44 |
+
}
|
app/code/community/Ecomwise/Base/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ecomwise_Base_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
+
|
4 |
+
|
5 |
+
}
|
app/code/community/Ecomwise/Base/Model/ExtensionsLicencer/Observer.php
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ecomwise_Base_Model_ExtensionsLicencer_Observer {
|
3 |
+
|
4 |
+
const EXTENSION_USE_HTTPS_PATH = 'base/licencer/use_https';
|
5 |
+
const EXTENSION_LICENCER_URL_PATH = 'base/licencer/url';
|
6 |
+
const EXTENSION_FREQUENCY_PATH = 'base/licencer/check_frequency';
|
7 |
+
|
8 |
+
public function checkExtensionLicence(){
|
9 |
+
if(($this->getFrequency() + $this->getLastUpdate()) > time()){
|
10 |
+
return $this;
|
11 |
+
}
|
12 |
+
|
13 |
+
$domain = parse_url(Mage::getStoreConfig(Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_URL));
|
14 |
+
$extensions = $this->getInstalledExtensions();
|
15 |
+
foreach($extensions as $key => $extension){
|
16 |
+
if($extension != "base"){
|
17 |
+
$license_number = Mage::getStoreConfig($extension . "/settings/serial");
|
18 |
+
$response = $this->getServerResponse($extension, $domain["host"], $license_number);
|
19 |
+
$this->setExtensionOutput($key, $response);
|
20 |
+
$this->setExtensionStatus($extension, $response);
|
21 |
+
$this->setExtensionWarning($extension, $response);
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
Mage::app()->getStore()->resetConfig();
|
26 |
+
$this->setLastUpdate();
|
27 |
+
|
28 |
+
return $this;
|
29 |
+
}
|
30 |
+
|
31 |
+
public function showAdminMessages(){
|
32 |
+
$disabled_extensions = array();
|
33 |
+
$warned_extensions = array();
|
34 |
+
|
35 |
+
$this->checkExtensionLicence();
|
36 |
+
$extensions = $this->getInstalledExtensions();
|
37 |
+
foreach($extensions as $extension){
|
38 |
+
$status = Mage::getStoreConfig($extension . '/status/valid');
|
39 |
+
if($status == "disable"){
|
40 |
+
$disabled_extensions[] = ucfirst($extension);
|
41 |
+
}
|
42 |
+
|
43 |
+
$warning = Mage::getStoreConfig($extension . '/status/warning');
|
44 |
+
if($warning != "" && $warning != NULL){
|
45 |
+
$warned_extensions[ucfirst($extension)] = $warning;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
if(!empty($warned_extensions)){
|
50 |
+
if(count($warned_extensions) > 1){
|
51 |
+
$text1 = array();
|
52 |
+
$text2 = array();
|
53 |
+
if(count($warned_extensions) == 2){
|
54 |
+
foreach($warned_extensions as $key => $value){
|
55 |
+
$text1[] = $key;
|
56 |
+
$text2[] = $key . " extension will be disabled in " . $value;
|
57 |
+
}
|
58 |
+
$text1 = implode(" and ", $text1);
|
59 |
+
$text2 = implode(" and the ", $text2);
|
60 |
+
}else{
|
61 |
+
foreach($warned_extensions as $key => $value){
|
62 |
+
$text1[] = $key;
|
63 |
+
$text2[] = $key . " extension will be disabled in " . $value;
|
64 |
+
}
|
65 |
+
$last_element = array_pop($text1);
|
66 |
+
$text1 = implode(", ", $text1) . " and " . $last_element;
|
67 |
+
$last_element = array_pop($text2);
|
68 |
+
$text2 = implode(", the ", $text2) . " and the " . $last_element;
|
69 |
+
}
|
70 |
+
|
71 |
+
$message = Mage::Helper("base")->__("Please insert the license key for the " . $text1 . " extensions. The " . $text2 . ".");
|
72 |
+
}else{
|
73 |
+
$text1 = min(array_keys($warned_extensions));
|
74 |
+
$text2 = $warned_extensions[$text1];
|
75 |
+
$message = Mage::Helper("base")->__("Please insert the license key for the " . $text1 . " extension. The extension will be disabled in " . $text2 . ".");
|
76 |
+
}
|
77 |
+
|
78 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
79 |
+
}
|
80 |
+
|
81 |
+
if(!empty($disabled_extensions)){
|
82 |
+
if(count($disabled_extensions) > 1){
|
83 |
+
$text = "";
|
84 |
+
if(count($disabled_extensions) == 2){
|
85 |
+
$text = implode(" and ", $disabled_extensions);
|
86 |
+
}else{
|
87 |
+
$last_element = array_pop($disabled_extensions);
|
88 |
+
$text = implode(", ", $disabled_extensions) . " and " . $last_element;
|
89 |
+
}
|
90 |
+
$message = Mage::Helper("base")->__("The " . $text . " extensions are disabled. Please insert the license key.");
|
91 |
+
}else{
|
92 |
+
$text = $disabled_extensions[0];
|
93 |
+
$message = Mage::Helper("base")->__("The " . $text . " extension is disabled. Please insert the license key.");
|
94 |
+
}
|
95 |
+
|
96 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
97 |
+
}
|
98 |
+
|
99 |
+
return $this;
|
100 |
+
}
|
101 |
+
|
102 |
+
private function getInstalledExtensions(){
|
103 |
+
$ecomwise_extensions = array();
|
104 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
105 |
+
sort($modules);
|
106 |
+
foreach($modules as $extension){
|
107 |
+
$is_enable = Mage::helper('core')->isModuleEnabled($extension);
|
108 |
+
if ($is_enable === true && strstr($extension, 'Ecomwise_') !== false){
|
109 |
+
$extensionName = explode("_", $extension);
|
110 |
+
$ecomwise_extensions[$extension] = strtolower($extensionName[1]);
|
111 |
+
}
|
112 |
+
}
|
113 |
+
return $ecomwise_extensions;
|
114 |
+
}
|
115 |
+
|
116 |
+
private function getLicenserUrl(){
|
117 |
+
$licencer_url = (Mage::getStoreConfigFlag(self::EXTENSION_USE_HTTPS_PATH) ? 'https://' : 'http://') . Mage::getStoreConfig(self::EXTENSION_LICENCER_URL_PATH);
|
118 |
+
return $licencer_url;
|
119 |
+
}
|
120 |
+
|
121 |
+
private function getServerResponse($extension, $domain, $license_number){
|
122 |
+
$curl = new Varien_Http_Adapter_Curl();
|
123 |
+
$curl->setConfig(array(
|
124 |
+
'timeout' => 2
|
125 |
+
));
|
126 |
+
|
127 |
+
$ip_address = $this->getIpAddress();
|
128 |
+
$base_version = Mage::getConfig()->getModuleConfig("Ecomwise_Base")->version;
|
129 |
+
$parametars = "extension/$extension/domain/$domain/ip_address/$ip_address/licence_number/$license_number/base_version/$base_version";
|
130 |
+
$curl->write(Zend_Http_Client::GET, $this->getLicenserUrl() . $parametars, '1.0');
|
131 |
+
$data = $curl->read();
|
132 |
+
if ($data === false){
|
133 |
+
return "503";
|
134 |
+
}
|
135 |
+
$data = preg_split('/^\r?$/m', $data, 2);
|
136 |
+
$data = str_replace("\n", "", trim($data[1]));
|
137 |
+
$curl->close();
|
138 |
+
|
139 |
+
return json_decode($data, true);
|
140 |
+
}
|
141 |
+
|
142 |
+
private function setExtensionOutput($extension, $response){
|
143 |
+
$response = isset($response["code"]) && $response["code"] == "100" ? "1" : "0";
|
144 |
+
Mage::getConfig()->saveConfig('advanced/modules_disable_output/' . $extension, $response);
|
145 |
+
return $this;
|
146 |
+
}
|
147 |
+
|
148 |
+
private function setExtensionStatus($extension, $response){
|
149 |
+
$response = isset($response["code"]) && $response["code"] == "100" ? "disable" : "active";
|
150 |
+
Mage::getConfig()->saveConfig($extension . '/status/valid', $response);
|
151 |
+
return $this;
|
152 |
+
}
|
153 |
+
|
154 |
+
private function setExtensionWarning($extension, $response){
|
155 |
+
$response = isset($response["code"]) && $response["code"] == "500" ? $response["message"] : "";
|
156 |
+
Mage::getConfig()->saveConfig($extension . '/status/warning', $response);
|
157 |
+
return $this;
|
158 |
+
}
|
159 |
+
|
160 |
+
private function getIpAddress(){
|
161 |
+
$ip_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR');
|
162 |
+
foreach ($ip_keys as $key){
|
163 |
+
if (array_key_exists($key, $_SERVER) === true){
|
164 |
+
foreach (explode(',', $_SERVER[$key]) as $ip){
|
165 |
+
$ip = trim($ip);
|
166 |
+
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false){
|
167 |
+
return $ip;
|
168 |
+
}
|
169 |
+
}
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : "";
|
174 |
+
}
|
175 |
+
|
176 |
+
private function getFrequency(){
|
177 |
+
return Mage::getStoreConfig(self::EXTENSION_FREQUENCY_PATH);
|
178 |
+
}
|
179 |
+
|
180 |
+
private function getLastUpdate(){
|
181 |
+
return Mage::app()->loadCache('base_extensions_lastcheck');
|
182 |
+
}
|
183 |
+
|
184 |
+
private function setLastUpdate(){
|
185 |
+
Mage::app()->saveCache(time(), 'base_extensions_lastcheck');
|
186 |
+
return $this;
|
187 |
+
}
|
188 |
+
}
|
app/code/community/Ecomwise/Base/Model/NotificationsNotifier/Observer.php
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ecomwise_Base_Model_NotificationsNotifier_Observer {
|
3 |
+
|
4 |
+
const XML_USE_HTTPS_PATH = 'base/rss/use_https';
|
5 |
+
const XML_FEED_URL_PATH = 'base/rss/url';
|
6 |
+
const XML_FREQUENCY_PATH = 'base/rss/check_frequency';
|
7 |
+
const XML_FREQUENCY_ENABLE = 'base/rss/enabled';
|
8 |
+
const XML_LAST_UPDATE_PATH = 'base/rss/last_update';
|
9 |
+
const XML_FEED_OPTION = 'base/rss/feed';
|
10 |
+
|
11 |
+
public function adminUserLoginSuccess(){
|
12 |
+
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
13 |
+
if (!Mage::getStoreConfig(self::XML_FREQUENCY_ENABLE)) {
|
14 |
+
return;
|
15 |
+
}
|
16 |
+
$this->checkUpdate();
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
private function checkUpdate(){
|
21 |
+
$feedData = array();
|
22 |
+
$feedModel = Mage::getModel('adminnotification/feed');
|
23 |
+
|
24 |
+
if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
|
25 |
+
return $this;
|
26 |
+
}
|
27 |
+
|
28 |
+
$feed_options = $this->getFeedOptions();
|
29 |
+
foreach($feed_options as $feed_option){
|
30 |
+
if($feed_option == "GENERAL_INFO"){
|
31 |
+
$this->saveFeedData("generalinfo");
|
32 |
+
break;
|
33 |
+
}else if($feed_option == "MY_EXTENSIONS"){
|
34 |
+
$extensions = $this->getInstalledExtensions();
|
35 |
+
foreach($extensions as $extension){
|
36 |
+
$this->saveFeedData($extension);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
return $this;
|
41 |
+
}
|
42 |
+
|
43 |
+
private function saveFeedData($extension){
|
44 |
+
$feedModel = Mage::getModel('adminnotification/feed');
|
45 |
+
$feedXml = $this->getFeedData($extension);
|
46 |
+
|
47 |
+
if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
|
48 |
+
foreach ($feedXml->channel->item as $item) {
|
49 |
+
$feedData[] = array(
|
50 |
+
'severity' => (int)$item->source,
|
51 |
+
'date_added' => $feedModel->getDate((string)$item->pubDate),
|
52 |
+
'title' => (string)$item->title,
|
53 |
+
'description' => (string)$item->description,
|
54 |
+
'url' => (string)$item->link,
|
55 |
+
);
|
56 |
+
}
|
57 |
+
|
58 |
+
if ($feedData) {
|
59 |
+
Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
63 |
+
$this->setLastUpdate();
|
64 |
+
}
|
65 |
+
|
66 |
+
private function getFeedUrl(){
|
67 |
+
$feed_url = (Mage::getStoreConfigFlag(self::XML_USE_HTTPS_PATH) ? 'https://' : 'http://') . Mage::getStoreConfig(self::XML_FEED_URL_PATH);
|
68 |
+
return $feed_url;
|
69 |
+
}
|
70 |
+
|
71 |
+
private function getFeedData($extension){
|
72 |
+
$curl = new Varien_Http_Adapter_Curl();
|
73 |
+
$curl->setConfig(array(
|
74 |
+
'timeout' => 2
|
75 |
+
));
|
76 |
+
$url = $this->getFeedUrl() . $extension;
|
77 |
+
$curl->write(Zend_Http_Client::GET, $this->getFeedUrl() . $extension, '1.0');
|
78 |
+
$data = $curl->read();
|
79 |
+
if ($data === false) {
|
80 |
+
return false;
|
81 |
+
}
|
82 |
+
$data = preg_split('/^\r?$/m', $data, 2);
|
83 |
+
$data = trim($data[1]);
|
84 |
+
$curl->close();
|
85 |
+
|
86 |
+
try {
|
87 |
+
$xml = new SimpleXMLElement($data);
|
88 |
+
}catch (Exception $e) {
|
89 |
+
return false;
|
90 |
+
}
|
91 |
+
|
92 |
+
return $xml;
|
93 |
+
}
|
94 |
+
|
95 |
+
private function getFeedOptions(){
|
96 |
+
$options = array(Mage::getStoreConfig(self::XML_FEED_OPTION));
|
97 |
+
$results = Mage::getModel('core/config_data')->getCollection();
|
98 |
+
$results->getSelect()->where("path='base/rss/feed'");
|
99 |
+
|
100 |
+
if(!empty($results)){
|
101 |
+
foreach ($results as $result) {
|
102 |
+
$options = explode(",", $result->getValue());
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
return $options;
|
107 |
+
}
|
108 |
+
|
109 |
+
private function getInstalledExtensions(){
|
110 |
+
$ecomwise_extensions = array();
|
111 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules'));
|
112 |
+
sort($modules);
|
113 |
+
foreach ($modules as $extension) {
|
114 |
+
$is_enable = Mage::helper('core')->isModuleEnabled($extension);
|
115 |
+
if ($is_enable === true && strstr($extension, 'Ecomwise_') !== false) {
|
116 |
+
$extensionName = explode("_", $extension);
|
117 |
+
$ecomwise_extensions[] = strtolower($extensionName[1]);
|
118 |
+
}
|
119 |
+
}
|
120 |
+
return $ecomwise_extensions;
|
121 |
+
}
|
122 |
+
|
123 |
+
private function getFrequency(){
|
124 |
+
return Mage::getStoreConfig(self::XML_FREQUENCY_PATH);
|
125 |
+
}
|
126 |
+
|
127 |
+
private function getLastUpdate(){
|
128 |
+
return Mage::app()->loadCache('base_notifications_lastcheck');
|
129 |
+
}
|
130 |
+
|
131 |
+
private function setLastUpdate(){
|
132 |
+
Mage::app()->saveCache(time(), 'base_notifications_lastcheck');
|
133 |
+
return $this;
|
134 |
+
}
|
135 |
+
|
136 |
+
}
|
app/code/community/Ecomwise/Base/Model/NotificationsNotifier/Source/Updates/Type.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ecomwise_Base_Model_NotificationsNotifier_Source_Updates_Type extends Mage_Eav_Model_Entity_Attribute_Source_Abstract{
|
4 |
+
|
5 |
+
const TYPE_GENERAL_INFO = 'GENERAL_INFO';
|
6 |
+
const TYPE_MY_EXTENSIONS = 'MY_EXTENSIONS';
|
7 |
+
|
8 |
+
|
9 |
+
public function toOptionArray(){
|
10 |
+
return array(
|
11 |
+
array('value' => self::TYPE_GENERAL_INFO, 'label' => Mage::helper('base')->__('General Info')),
|
12 |
+
array('value' => self::TYPE_MY_EXTENSIONS, 'label' => Mage::helper('base')->__('My extensions')),
|
13 |
+
);
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getAllOptions(){
|
17 |
+
return $this->toOptionArray();
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
public function getLabel($value){
|
22 |
+
$options = $this->toOptionArray();
|
23 |
+
foreach ($options as $v) {
|
24 |
+
if ($v['value'] == $value) {
|
25 |
+
return $v['label'];
|
26 |
+
}
|
27 |
+
}
|
28 |
+
return '';
|
29 |
+
}
|
30 |
+
|
31 |
+
public function getGridOptions(){
|
32 |
+
$items = $this->getAllOptions();
|
33 |
+
$out = array();
|
34 |
+
foreach ($items as $item) {
|
35 |
+
$out[$item['value']] = $item['label'];
|
36 |
+
}
|
37 |
+
return $out;
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Ecomwise/Base/etc/config.xml
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ecomwise_Base>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Ecomwise_Base>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<base>
|
11 |
+
<class>Ecomwise_Base_Model</class>
|
12 |
+
</base>
|
13 |
+
</models>
|
14 |
+
<helpers>
|
15 |
+
<base>
|
16 |
+
<class>Ecomwise_Base_Helper</class>
|
17 |
+
</base>
|
18 |
+
</helpers>
|
19 |
+
<blocks>
|
20 |
+
<base>
|
21 |
+
<class>Ecomwise_Base_Block</class>
|
22 |
+
</base>
|
23 |
+
</blocks>
|
24 |
+
<events>
|
25 |
+
<admin_session_user_login_success>
|
26 |
+
<observers>
|
27 |
+
<base_notificationsnotifier_admin_user_login>
|
28 |
+
<class>Ecomwise_Base_Model_NotificationsNotifier_Observer</class>
|
29 |
+
<method>adminUserLoginSuccess</method>
|
30 |
+
</base_notificationsnotifier_admin_user_login>
|
31 |
+
<base_extensionslicencer_admin_user_login>
|
32 |
+
<class>Ecomwise_Base_Model_ExtensionsLicencer_Observer</class>
|
33 |
+
<method>showAdminMessages</method>
|
34 |
+
</base_extensionslicencer_admin_user_login>
|
35 |
+
</observers>
|
36 |
+
</admin_session_user_login_success>
|
37 |
+
<controller_action_postdispatch>
|
38 |
+
<observers>
|
39 |
+
<base_extensionslicencer_postdispatch_action>
|
40 |
+
<class>Ecomwise_Base_Model_ExtensionsLicencer_Observer</class>
|
41 |
+
<method>checkExtensionLicence</method>
|
42 |
+
</base_extensionslicencer_postdispatch_action>
|
43 |
+
</observers>
|
44 |
+
</controller_action_postdispatch>
|
45 |
+
</events>
|
46 |
+
</global>
|
47 |
+
<adminhtml>
|
48 |
+
<acl>
|
49 |
+
<resources>
|
50 |
+
<all>
|
51 |
+
<title>Allow Everything</title>
|
52 |
+
</all>
|
53 |
+
<admin>
|
54 |
+
<children>
|
55 |
+
<system>
|
56 |
+
<children>
|
57 |
+
<config>
|
58 |
+
<children>
|
59 |
+
<base>
|
60 |
+
<title>Ecomwise - All</title>
|
61 |
+
</base>
|
62 |
+
</children>
|
63 |
+
</config>
|
64 |
+
</children>
|
65 |
+
</system>
|
66 |
+
</children>
|
67 |
+
</admin>
|
68 |
+
</resources>
|
69 |
+
</acl>
|
70 |
+
</adminhtml>
|
71 |
+
<default>
|
72 |
+
<base>
|
73 |
+
<rss>
|
74 |
+
<url>www.b2b-extensions.com/provider/extensions/feed/name/</url>
|
75 |
+
<use_https>0</use_https>
|
76 |
+
<check_frequency>86400</check_frequency>
|
77 |
+
<enabled>1</enabled>
|
78 |
+
<feed>GENERAL_INFO</feed>
|
79 |
+
</rss>
|
80 |
+
<licencer>
|
81 |
+
<url>www.b2b-extensions.com/extensions/licence/check/</url>
|
82 |
+
<use_https>0</use_https>
|
83 |
+
<check_frequency>86400</check_frequency>
|
84 |
+
</licencer>
|
85 |
+
</base>
|
86 |
+
</default>
|
87 |
+
</config>
|
app/code/community/Ecomwise/Base/etc/system.xml
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<ecomwise translate="label">
|
5 |
+
<label>B2B-extensions</label>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</ecomwise>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<base translate="label" module="base">
|
11 |
+
<label>Notifications</label>
|
12 |
+
<tab>ecomwise</tab>
|
13 |
+
<sort_order>10</sort_order>
|
14 |
+
<show_in_default>1</show_in_default>
|
15 |
+
<show_in_website>1</show_in_website>
|
16 |
+
<show_in_store>1</show_in_store>
|
17 |
+
<groups>
|
18 |
+
<extensions translate="label">
|
19 |
+
<label>Installed Extensions</label>
|
20 |
+
<frontend_type>text</frontend_type>
|
21 |
+
<frontend_model>base/notificationsNotifier_system_config_form_fieldset_ecomwise_extensions</frontend_model>
|
22 |
+
<sort_order>1</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
</extensions>
|
27 |
+
<rss translate="label">
|
28 |
+
<label>Options</label>
|
29 |
+
<frontend_type>text</frontend_type>
|
30 |
+
<sort_order>2</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
<fields>
|
35 |
+
<feed translate="label">
|
36 |
+
<label>I'd like to be informed by Ecomwise about:</label>
|
37 |
+
<frontend_type>multiselect</frontend_type>
|
38 |
+
<sort_order>100</sort_order>
|
39 |
+
<show_in_default>1</show_in_default>
|
40 |
+
<show_in_website>1</show_in_website>
|
41 |
+
<show_in_store>1</show_in_store>
|
42 |
+
<can_be_empty>1</can_be_empty>
|
43 |
+
<source_model>base/notificationsNotifier_source_updates_type</source_model>
|
44 |
+
</feed>
|
45 |
+
</fields>
|
46 |
+
</rss>
|
47 |
+
</groups>
|
48 |
+
</base>
|
49 |
+
</sections>
|
50 |
+
</config>
|
app/code/community/Ecomwise/FreeBestsellerssidebar/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Ecomwise_FreeBestsellerssidebar>
|
5 |
-
<version>
|
6 |
</Ecomwise_FreeBestsellerssidebar>
|
7 |
</modules>
|
8 |
<frontend>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Ecomwise_FreeBestsellerssidebar>
|
5 |
+
<version>1.0.0</version>
|
6 |
</Ecomwise_FreeBestsellerssidebar>
|
7 |
</modules>
|
8 |
<frontend>
|
app/code/community/Ecomwise/FreeBestsellerssidebar/etc/system.xml
CHANGED
@@ -43,11 +43,11 @@
|
|
43 |
<show_in_store>1</show_in_store>
|
44 |
</disable_ext>
|
45 |
</fields>
|
46 |
-
</info>
|
47 |
<parameters translate="label">
|
48 |
<label>Parameters</label>
|
49 |
<frontend_type>text</frontend_type>
|
50 |
-
<sort_order>
|
51 |
<show_in_default>1</show_in_default>
|
52 |
<show_in_website>1</show_in_website>
|
53 |
<show_in_store>1</show_in_store>
|
43 |
<show_in_store>1</show_in_store>
|
44 |
</disable_ext>
|
45 |
</fields>
|
46 |
+
</info>
|
47 |
<parameters translate="label">
|
48 |
<label>Parameters</label>
|
49 |
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>2</sort_order>
|
51 |
<show_in_default>1</show_in_default>
|
52 |
<show_in_website>1</show_in_website>
|
53 |
<show_in_store>1</show_in_store>
|
app/etc/modules/Ecomwise_Base.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ecomwise_Base>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Ecomwise_Base>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Ecomwise_FreeBestsellerssidebar.xml
CHANGED
@@ -5,6 +5,9 @@
|
|
5 |
<Ecomwise_FreeBestsellerssidebar>
|
6 |
<active>true</active>
|
7 |
<codePool>community</codePool>
|
|
|
|
|
|
|
8 |
</Ecomwise_FreeBestsellerssidebar>
|
9 |
</modules>
|
10 |
</config>
|
5 |
<Ecomwise_FreeBestsellerssidebar>
|
6 |
<active>true</active>
|
7 |
<codePool>community</codePool>
|
8 |
+
<depends>
|
9 |
+
<Ecomwise_Base />
|
10 |
+
</depends>
|
11 |
</Ecomwise_FreeBestsellerssidebar>
|
12 |
</modules>
|
13 |
</config>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Ecomwise_BestsellerSidebarFree</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL-3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description>
|
11 |
-
<notes>
|
12 |
-
<authors><author><name>EcomwiseTeam</name><user>EcomwiseTeam</user><email>info@
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir><dir name="Ecomwise"><dir name="
|
16 |
<compatible/>
|
17 |
-
<dependencies><required><php><min>5.0.0</min><max>5.
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Ecomwise_BestsellerSidebarFree</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL-3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Ecomwise_BestsellerSidebarFree</summary>
|
10 |
+
<description>Ecomwise_BestsellerSidebarFree</description>
|
11 |
+
<notes>1.0.0</notes>
|
12 |
+
<authors><author><name>EcomwiseTeam</name><user>EcomwiseTeam</user><email>info@ecomwise.com</email></author></authors>
|
13 |
+
<date>2014-04-30</date>
|
14 |
+
<time>13:14:03</time>
|
15 |
+
<contents><target name="magecommunity"><dir><dir name="Ecomwise"><dir name="Base"><dir name="Block"><dir name="NotificationsNotifier"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="Ecomwise"><file name="Extensions.php" hash="bd35aca3be511e975d9f52200b61793a"/></dir></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7b4c6e200a7c96d8b636057efad0cc1e"/></dir><dir name="Model"><dir name="ExtensionsLicencer"><file name="Observer.php" hash="05a3c4eaccc4d0ea3dfcb5c954fbfa0d"/></dir><dir name="NotificationsNotifier"><file name="Observer.php" hash="d7717cc44d954eb771a26160ea6206ae"/><dir name="Source"><dir name="Updates"><file name="Type.php" hash="9dc2b16665b60c4334a5e9b75bbcd1fd"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="3eb70b9f2f5d52fb54335ad34ae4ebba"/><file name="system.xml" hash="89d092ed5df73b846826e6032d741885"/></dir></dir><dir name="FreeBestsellerssidebar"><dir name="Block"><file name="Bestsellers.php" hash="8d5091f0ec6732939351b1168704a5db"/><dir name="System"><dir name="Config"><file name="Version.php" hash="4a10e2f43f98048da892a8bf019c19be"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="b9f99eb6fe6e0ce7882f59bcf461fc47"/></dir><dir name="controllers"><file name="IndexController.php" hash="da6e76303cfd35a4bb93a15f743a4be2"/></dir><dir name="etc"><file name="config.xml" hash="055d89d4f87e82e6e7f585ee4bcd4d98"/><file name="system.xml" hash="886001b0de34b560e6f45c3e8323a619"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Ecomwise_Base.xml" hash=""/><file name="Ecomwise_FreeBestsellerssidebar.xml" hash=""/></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="freebestsellerssidebar.xml" hash=""/></dir><dir name="template"><dir name="freebestsellerssidebar"><file name="freebestsellerssidebar.phtml" hash=""/></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.0.0</min><max>5.9.9</max></php></required></dependencies>
|
18 |
</package>
|