Version Notes
Added a small fix.
Download this release
Release Info
Developer | EaDesign |
Extension | Eadesigndev_Urgent |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.3
app/code/local/Eadesigndev/Urgent/Helper/Data.php
CHANGED
@@ -37,7 +37,7 @@ class Eadesigndev_Urgent_Helper_Data extends Mage_Core_Helper_Abstract
|
|
37 |
->addFieldToFilter('country_id', $countryId)
|
38 |
->addFieldToFilter('region_id', $regionId);
|
39 |
|
40 |
-
$count =
|
41 |
|
42 |
if($count < 2){
|
43 |
return false;
|
37 |
->addFieldToFilter('country_id', $countryId)
|
38 |
->addFieldToFilter('region_id', $regionId);
|
39 |
|
40 |
+
$count = count($cityCollection->getData());
|
41 |
|
42 |
if($count < 2){
|
43 |
return false;
|
app/code/local/Eadesigndev/Urgent/Model/Eacore/Feed.php
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
Class Eadesigndev_Urgent_Model_Eacore_Feed extends Mage_AdminNotification_Model_Feed
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $eadesignUrl;
|
7 |
+
|
8 |
+
public function checkUpdate()
|
9 |
+
{
|
10 |
+
|
11 |
+
if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
|
12 |
+
return $this;
|
13 |
+
}
|
14 |
+
|
15 |
+
$this->getClientData();
|
16 |
+
$feedData = array();
|
17 |
+
|
18 |
+
$feedXml = $this->getFeedData();
|
19 |
+
|
20 |
+
if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
|
21 |
+
foreach ($feedXml->channel->item as $item) {
|
22 |
+
$feedData[] = array(
|
23 |
+
'severity' => (int)$item->severity,
|
24 |
+
'date_added' => $this->getDate((string)$item->pubDate),
|
25 |
+
'title' => (string)$item->title,
|
26 |
+
'description' => (string)$item->description,
|
27 |
+
'url' => (string)$item->link,
|
28 |
+
);
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
if ($feedData) {
|
33 |
+
Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
$this->setLastUpdate();
|
39 |
+
|
40 |
+
return $this;
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Retrieve Last update time
|
46 |
+
*
|
47 |
+
* @return int
|
48 |
+
*/
|
49 |
+
public function getLastUpdate()
|
50 |
+
{
|
51 |
+
return Mage::app()->loadCache('eadesign_lastcheck');
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Set last update time (now)
|
56 |
+
*
|
57 |
+
* @return Mage_AdminNotification_Model_Feed
|
58 |
+
*/
|
59 |
+
public function setLastUpdate()
|
60 |
+
{
|
61 |
+
Mage::app()->saveCache(time(), 'eadesign_lastcheck');
|
62 |
+
return $this;
|
63 |
+
}
|
64 |
+
|
65 |
+
public function getFeedUrl()
|
66 |
+
{
|
67 |
+
if (is_null($this->eadesignUrl)) {
|
68 |
+
$this->eadesignUrl = 'https://www.eadesign.ro/notifications.rss';
|
69 |
+
}
|
70 |
+
return $this->eadesignUrl;
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
public function getFeedData()
|
75 |
+
{
|
76 |
+
$curl = new Varien_Http_Adapter_Curl();
|
77 |
+
$curl->setConfig(array(
|
78 |
+
'timeout' => 3
|
79 |
+
));
|
80 |
+
|
81 |
+
$curl->write(Zend_Http_Client::GET, $this->getFeedUrl(), '1.0');
|
82 |
+
$data = $curl->read();
|
83 |
+
if ($data === false) {
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
$data = preg_split('/^\r?$/m', $data, 2);
|
87 |
+
$data = trim($data[1]);
|
88 |
+
$curl->close();
|
89 |
+
|
90 |
+
try {
|
91 |
+
$xml = new SimpleXMLElement($data);
|
92 |
+
} catch (Exception $e) {
|
93 |
+
return false;
|
94 |
+
}
|
95 |
+
|
96 |
+
return $xml;
|
97 |
+
}
|
98 |
+
|
99 |
+
public function getClientData()
|
100 |
+
{
|
101 |
+
$eadesignUrl = 'https://www.eadesign.ro/';
|
102 |
+
|
103 |
+
$extension = 'Eadesigndev_Urgent';
|
104 |
+
|
105 |
+
$moduleVersion = Mage::getConfig()->getModuleConfig($extension)->version;
|
106 |
+
|
107 |
+
$baseUrl = 'track/index/update?url=' . Mage::getBaseUrl();
|
108 |
+
$version = '&version=' . $moduleVersion;
|
109 |
+
$moduleExtension = '&extension='.$extension;
|
110 |
+
|
111 |
+
$url = $eadesignUrl.$baseUrl.$version.$moduleExtension;
|
112 |
+
|
113 |
+
$curl = new Varien_Http_Adapter_Curl();
|
114 |
+
$curl->setConfig(array(
|
115 |
+
'timeout' => 3
|
116 |
+
));
|
117 |
+
|
118 |
+
$curl->write(Zend_Http_Client::GET, $url, '1.0');
|
119 |
+
$curl->read();
|
120 |
+
$curl->close();
|
121 |
+
}
|
122 |
+
|
123 |
+
}
|
app/code/local/Eadesigndev/Urgent/Model/Eacore/Observer.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eadesigndev_Urgent_Model_Eacore_Observer
|
3 |
+
{
|
4 |
+
public function preDispatch(Varien_Event_Observer $observer)
|
5 |
+
{
|
6 |
+
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
7 |
+
|
8 |
+
$feedModel = Mage::getModel('urgent/eacore_feed');
|
9 |
+
|
10 |
+
$feedModel->checkUpdate();
|
11 |
+
}
|
12 |
+
}
|
13 |
+
}
|
app/code/local/Eadesigndev/Urgent/etc/config.xml
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Eadesigndev_Urgent>
|
5 |
-
<version>1.0.
|
6 |
</Eadesigndev_Urgent>
|
7 |
</modules>
|
8 |
<global>
|
@@ -70,4 +70,16 @@
|
|
70 |
</urgentadmin>
|
71 |
</routers>
|
72 |
</admin>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Eadesigndev_Urgent>
|
5 |
+
<version>1.0.3</version>
|
6 |
</Eadesigndev_Urgent>
|
7 |
</modules>
|
8 |
<global>
|
70 |
</urgentadmin>
|
71 |
</routers>
|
72 |
</admin>
|
73 |
+
<adminhtml>
|
74 |
+
<events>
|
75 |
+
<controller_action_predispatch>
|
76 |
+
<observers>
|
77 |
+
<eadesigndev_urgent>
|
78 |
+
<class>urgent/eacore_observer</class>
|
79 |
+
<method>preDispatch</method>
|
80 |
+
</eadesigndev_urgent>
|
81 |
+
</observers>
|
82 |
+
</controller_action_predispatch>
|
83 |
+
</events>
|
84 |
+
</adminhtml>
|
85 |
</config>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Eadesigndev_Urgent</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Extension license name (OSL v3.0)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>This extension integrates Magento with Urgent-Cargus Courier Romania.</summary>
|
10 |
<description>The extension uses the url from Urgent-Cargus Courier Romania to get the estimated cost in Magetno for the regions and cities from Romania.</description>
|
11 |
-
<notes>
|
12 |
<authors><author><name>EaDesign</name><user>eadesign</user><email>office@eadesign.ro</email></author></authors>
|
13 |
-
<date>2015-09-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocal"><dir name="Eadesigndev"><dir name="Urgent"><dir name="Block"><dir name="Adminhtml"><dir name="Block"><dir name="System"><file name="Update.php" hash="69066f7fb83dca619580c7ba774c36ad"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>5.6.3</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Eadesigndev_Urgent</name>
|
4 |
+
<version>1.0.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Extension license name (OSL v3.0)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>This extension integrates Magento with Urgent-Cargus Courier Romania.</summary>
|
10 |
<description>The extension uses the url from Urgent-Cargus Courier Romania to get the estimated cost in Magetno for the regions and cities from Romania.</description>
|
11 |
+
<notes>Added a small fix.</notes>
|
12 |
<authors><author><name>EaDesign</name><user>eadesign</user><email>office@eadesign.ro</email></author></authors>
|
13 |
+
<date>2015-09-16</date>
|
14 |
+
<time>13:08:13</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Eadesigndev"><dir name="Urgent"><dir name="Block"><dir name="Adminhtml"><dir name="Block"><dir name="System"><file name="Update.php" hash="69066f7fb83dca619580c7ba774c36ad"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="2fd14bbd308be4da0d7d1fe4f48f8548"/><file name="Update.php" hash="405bd6a31e96aeb8509060df8a56dfc4"/><file name="Urgent.php" hash="11b1c466c9de87f716b5caebb4928d5d"/></dir><dir name="Model"><dir name="Carrier"><file name="Urgent.php" hash="36102a10365e5d9ea97786a6486ea5b3"/></dir><dir name="Eacore"><file name="Feed.php" hash="b5c96e76284d3d7408741d25edca5648"/><file name="Observer.php" hash="37ad0702c8204b9c100c1310830e966c"/></dir><dir name="Mysql4"><dir name="Urgent"><file name="Collection.php" hash="fbc97b9f454181770129c2278e673cc6"/></dir><file name="Urgent.php" hash="733cedf99d593149a5dbf7d5378e4579"/></dir><dir name="System"><file name="Abstract.php" hash="28da5ccd4466fc334a6688d7a847c766"/><file name="Pachet.php" hash="ae9b264de1373882e22012f01411291f"/><file name="Plantarifar.php" hash="ee1985ec225f0a2fa74a117fb0aabf53"/><file name="Punctridicare.php" hash="3b46b40bebf020b68f13cc5843c9088c"/><file name="Tarifeafisate.php" hash="913bd9302763f350a610ea0a5457c930"/></dir><file name="Urgent.php" hash="e32e91b5e2f1cbf0b08c045862bea4bd"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="d5d788bd1a94d444951a8f7437ff6501"/></dir></dir><dir name="etc"><file name="config.xml" hash="2c2a5336639d92af3fecf4dd625d191a"/><file name="system.xml" hash="08545a878542a973e0e60257f55f7907"/></dir><dir name="sql"><dir name="eadsign_urgent_setup"><file name="mysql4-install-1.0.1.php" hash="1b52c65cdfbf67fd1e1aaf96404f8c0a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="."><file name="Eadesigndev_Urgent.xml" hash=""/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>5.6.3</max></php></required></dependencies>
|
18 |
</package>
|