Version Notes
Fixed minor bugs
Download this release
Release Info
Developer | aftership |
Extension | aftership |
Version | 0.1.16 |
Comparing to | |
See all releases |
Code changes from version 0.1.15 to 0.1.16
app/code/community/Aftership/Track/Model/Observer.php
CHANGED
@@ -4,25 +4,25 @@ class Aftership_Track_Model_Observer
|
|
4 |
{
|
5 |
public function salesOrderShipmentTrackSaveAfter(Varien_Event_Observer $observer)
|
6 |
{
|
7 |
-
|
8 |
$config = Mage::getStoreConfig('aftership_options/messages');
|
9 |
|
10 |
/*if(array_key_exists("notification",$config)){
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
|
27 |
$track = $observer->getEvent()->getTrack();
|
28 |
$track_data = $track->getData();
|
@@ -43,10 +43,10 @@ class Aftership_Track_Model_Observer
|
|
43 |
->addFieldToFilter('order_id', array('eq' => $order_data["order_id"]))
|
44 |
->getData();
|
45 |
|
|
|
46 |
if (!$exist_track_data) {
|
47 |
$track = Mage::getModel('track/track');
|
48 |
|
49 |
-
|
50 |
$track->setTrackingNumber($track_no);
|
51 |
|
52 |
$track->setShipCompCode($track_data["carrier_code"]);
|
@@ -65,13 +65,13 @@ class Aftership_Track_Model_Observer
|
|
65 |
}
|
66 |
|
67 |
/*
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
|
76 |
|
77 |
if (array_key_exists("status", $config) && $config["status"]) {
|
@@ -83,7 +83,9 @@ class Aftership_Track_Model_Observer
|
|
83 |
$track->save();
|
84 |
}
|
85 |
|
86 |
-
|
|
|
|
|
87 |
$api_key = $config["api_key"];
|
88 |
|
89 |
$post_tracks = Mage::getModel('track/track')
|
@@ -92,23 +94,26 @@ class Aftership_Track_Model_Observer
|
|
92 |
->getData();
|
93 |
|
94 |
$url_params = array("api_key" => $api_key);
|
|
|
95 |
foreach ($post_tracks as $track) {
|
96 |
$url = "https://api.aftership.com/v1/trackings";
|
97 |
$url_params["tracking_number"] = $track["tracking_number"];
|
98 |
-
$url_params["smses"]
|
99 |
-
$url_params["emails"]
|
100 |
-
$url_params["title"]
|
101 |
-
$url_params["order_id"]
|
102 |
|
103 |
$ch = curl_init();
|
104 |
curl_setopt($ch, CURLOPT_URL, $url);
|
105 |
|
106 |
curl_setopt($ch, CURLOPT_POST, true);
|
107 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS,
|
108 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
109 |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
110 |
curl_setopt($ch, CURLOPT_HEADER, 0);
|
111 |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
|
|
|
|
112 |
|
113 |
$response = curl_exec($ch);
|
114 |
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
@@ -116,7 +121,8 @@ class Aftership_Track_Model_Observer
|
|
116 |
curl_close($ch);
|
117 |
$response_obj = json_decode($response, true);
|
118 |
|
119 |
-
if ($http_status == "201")
|
|
|
120 |
$track_obj = Mage::getModel('track/track');
|
121 |
$track_obj->load($track["track_id"]);
|
122 |
$track_obj->setPosted(1);
|
@@ -126,6 +132,8 @@ class Aftership_Track_Model_Observer
|
|
126 |
}
|
127 |
}
|
128 |
}
|
|
|
|
|
129 |
}
|
130 |
|
131 |
public function adminSystemConfigChangedSectionAftership($obj)
|
4 |
{
|
5 |
public function salesOrderShipmentTrackSaveAfter(Varien_Event_Observer $observer)
|
6 |
{
|
7 |
+
ob_start();
|
8 |
$config = Mage::getStoreConfig('aftership_options/messages');
|
9 |
|
10 |
/*if(array_key_exists("notification",$config)){
|
11 |
+
$notifications = explode(",",$config["notification"]);
|
12 |
+
if(array_search("1",$notifications)!==False){ // email
|
13 |
+
$is_notify_email = true;
|
14 |
+
}else{
|
15 |
+
$is_notify_email = false;
|
16 |
+
}
|
17 |
+
if(array_search("2",$notifications)!==False){ // sms
|
18 |
+
$is_notify_sms = true;
|
19 |
+
}else{
|
20 |
+
$is_notify_sms = false;
|
21 |
+
}
|
22 |
+
}else{
|
23 |
+
$is_notify_email = false;
|
24 |
+
$is_notify_sms = false;
|
25 |
+
}*/
|
26 |
|
27 |
$track = $observer->getEvent()->getTrack();
|
28 |
$track_data = $track->getData();
|
43 |
->addFieldToFilter('order_id', array('eq' => $order_data["order_id"]))
|
44 |
->getData();
|
45 |
|
46 |
+
|
47 |
if (!$exist_track_data) {
|
48 |
$track = Mage::getModel('track/track');
|
49 |
|
|
|
50 |
$track->setTrackingNumber($track_no);
|
51 |
|
52 |
$track->setShipCompCode($track_data["carrier_code"]);
|
65 |
}
|
66 |
|
67 |
/*
|
68 |
+
if($is_notify_email){
|
69 |
+
$track->setEmail($order_data["customer_email"]);
|
70 |
+
}
|
71 |
|
72 |
+
if($is_notify_sms){
|
73 |
+
$track->setTelephone($shipping_address_data["telephone"]);
|
74 |
+
}*/
|
75 |
|
76 |
|
77 |
if (array_key_exists("status", $config) && $config["status"]) {
|
83 |
$track->save();
|
84 |
}
|
85 |
|
86 |
+
|
87 |
+
if (array_key_exists("status", $config) && $config["status"])
|
88 |
+
{
|
89 |
$api_key = $config["api_key"];
|
90 |
|
91 |
$post_tracks = Mage::getModel('track/track')
|
94 |
->getData();
|
95 |
|
96 |
$url_params = array("api_key" => $api_key);
|
97 |
+
|
98 |
foreach ($post_tracks as $track) {
|
99 |
$url = "https://api.aftership.com/v1/trackings";
|
100 |
$url_params["tracking_number"] = $track["tracking_number"];
|
101 |
+
$url_params["smses"] = array($track["telephone"]);
|
102 |
+
$url_params["emails"] = array($track["email"]);
|
103 |
+
$url_params["title"] = $track["title"];
|
104 |
+
$url_params["order_id"] = $track["order_id"];
|
105 |
|
106 |
$ch = curl_init();
|
107 |
curl_setopt($ch, CURLOPT_URL, $url);
|
108 |
|
109 |
curl_setopt($ch, CURLOPT_POST, true);
|
110 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $url_params);
|
111 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
112 |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
113 |
curl_setopt($ch, CURLOPT_HEADER, 0);
|
114 |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
115 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); //the SSL is not correct
|
116 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); //the SSL is not correct
|
117 |
|
118 |
$response = curl_exec($ch);
|
119 |
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
121 |
curl_close($ch);
|
122 |
$response_obj = json_decode($response, true);
|
123 |
|
124 |
+
if ($http_status == "201" || $http_status == "422") //422: repeated
|
125 |
+
{
|
126 |
$track_obj = Mage::getModel('track/track');
|
127 |
$track_obj->load($track["track_id"]);
|
128 |
$track_obj->setPosted(1);
|
132 |
}
|
133 |
}
|
134 |
}
|
135 |
+
|
136 |
+
ob_end_clean();
|
137 |
}
|
138 |
|
139 |
public function adminSystemConfigChangedSectionAftership($obj)
|
app/code/community/Aftership/Track/etc/config.xml
CHANGED
@@ -12,9 +12,6 @@
|
|
12 |
<track>
|
13 |
<table>as_track</table>
|
14 |
</track>
|
15 |
-
<!--<user>
|
16 |
-
<table>as_user</table>
|
17 |
-
</user>-->
|
18 |
</entities>
|
19 |
</track_mysql4>
|
20 |
<status>
|
@@ -53,7 +50,7 @@
|
|
53 |
</global>
|
54 |
<modules>
|
55 |
<Aftership_Track>
|
56 |
-
<version>0.1.
|
57 |
</Aftership_Track>
|
58 |
</modules>
|
59 |
<frontend>
|
12 |
<track>
|
13 |
<table>as_track</table>
|
14 |
</track>
|
|
|
|
|
|
|
15 |
</entities>
|
16 |
</track_mysql4>
|
17 |
<status>
|
50 |
</global>
|
51 |
<modules>
|
52 |
<Aftership_Track>
|
53 |
+
<version>0.1.16</version>
|
54 |
</Aftership_Track>
|
55 |
</modules>
|
56 |
<frontend>
|
app/code/community/Aftership/Track/sql/track_setup/{mysql4-install-0.1.0.php → mysql4-install-0.1.16.php}
RENAMED
File without changes
|
package.xml
CHANGED
@@ -1,25 +1,19 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>aftership</name>
|
4 |
-
<version>0.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>AfterShip magento extension interface. Tracking number will be added to the aftership.com
|
10 |
-
|
11 |
-
|
12 |
-
<
|
13 |
-
stores can also automatically inform their customers of the latest delivery status through SMS, email and
|
14 |
-
Twitter. All the messages are white-labeled and can be customized for any marketing opportunities. Aftership
|
15 |
-
also provides online stores a reporting tool so that they can easily find out any shipping problems like delayed
|
16 |
-
delivery and solve immediately. Aftership currently supports over 40 shipping companies worldwide.</description>
|
17 |
-
<notes>Fixed minor bugs
|
18 |
-
Support V2</notes>
|
19 |
<authors><author><name>aftership</name><user>aftership</user><email>support@aftership.com</email></author></authors>
|
20 |
-
<date>2012-09-
|
21 |
-
<time>
|
22 |
-
<contents><target name="magecommunity"><dir
|
23 |
<compatible/>
|
24 |
<dependencies><required><php><min>5.2.17</min><max>6.0.0</max></php></required></dependencies>
|
25 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>aftership</name>
|
4 |
+
<version>0.1.16</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>AfterShip magento extension interface. Tracking number will be added to the aftership.com account at the same time when input in magento shipment.
|
10 |
+
Please go to aftership.com to change the notification setting and value.</summary>
|
11 |
+
<description>Users can simply link their online stores to Aftership and view all packages in one place. Online stores can also automatically inform their customers of the latest delivery status through SMS, email and Twitter. All the messages are white-labeled and can be customized for any marketing opportunities. Aftership also provides online stores a reporting tool so that they can easily find out any shipping problems like delayed delivery and solve immediately. Aftership currently supports over 40 shipping companies worldwide.</description>
|
12 |
+
<notes>Fixed minor bugs</notes>
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
<authors><author><name>aftership</name><user>aftership</user><email>support@aftership.com</email></author></authors>
|
14 |
+
<date>2012-09-19</date>
|
15 |
+
<time>05:08:37</time>
|
16 |
+
<contents><target name="magecommunity"><dir name="Aftership"><dir name="Track"><dir name="Helper"><file name="Data.php" hash="970d03deb3e5fc478f5d86e5ff3670cb"/></dir><dir name="Model"><file name="Methods.php" hash="d9fa7ef3df0353c01662ff4bdf210f60"/><dir name="Mysql4"><dir name="Track"><file name="Collection.php" hash="336c4b0fba8db78e1222da01aa8c5744"/></dir><file name="Track.php" hash="90ad226fa98576fceb223b85fe88b642"/></dir><file name="Observer.php" hash="9fea70bb15867c43dfb59a1e62a45829"/><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="b53f65ecc832752c8394f0da74b2f90d"/></dir></dir><file name="Track.php" hash="eb12833d5f084b0b919cbde45f8170eb"/><file name="Words.php" hash="7789e47b991f718fb3097b5e274eb71f"/></dir><dir name="controllers"><file name="IndexController.php" hash="3ee34f42957e816ff336f8f8215a218b"/></dir><dir name="etc"><file name="config.xml" hash="9464ce90e641252897520a5a4b0afc6b"/><file name="system.xml" hash="857fa4fae0433c10ba468bff794ca9ef"/></dir><dir name="sql"><dir name="track_setup"><file name="mysql4-install-0.1.16.php" hash="a8f81083585c85a89e8a3097f5f3045c"/></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Aftership_Track.xml" hash="6518f61d8f390f4fc8a517b2b15b01d1"/></dir></dir></dir></target></contents>
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.2.17</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|