Version Notes
Support details statistic
Download this release
Release Info
Developer | Woomio |
Extension | Woo |
Version | 1.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.1.3
- app/code/local/Woomio/Tracker/controllers/IndexController.php +198 -115
- app/code/local/Woomio/Tracker/etc/config.xml +1 -1
- app/code/local/Woomio/Tracker/sql/tracker_setup/{install-1.1.2.php → install-1.1.3.php} +2 -0
- app/code/local/Woomio/Tracker/sql/tracker_setup/{upgrade-1.0.10-1.1.2.php → upgrade-1.0.10-1.1.3.php} +2 -0
- app/code/local/Woomio/Tracker/sql/tracker_setup/{upgrade-1.0.11-1.1.2.php → upgrade-1.0.11-1.1.3.php} +2 -0
- app/code/local/Woomio/Tracker/sql/tracker_setup/{upgrade-1.0.12-1.1.2.php → upgrade-1.0.12-1.1.3.php} +2 -0
- app/code/local/Woomio/Tracker/sql/tracker_setup/{upgrade-1.1.0-1.1.2.php → upgrade-1.1.0-1.1.3.php} +2 -0
- app/code/local/Woomio/Tracker/sql/tracker_setup/{upgrade-1.1.1-1.1.2.php → upgrade-1.1.1-1.1.3.php} +2 -0
- app/code/local/Woomio/Tracker/sql/tracker_setup/upgrade-1.1.2-1.1.3.php +46 -0
- app/design/frontend/base/default/layout/tracker.xml +1 -1
- app/design/frontend/base/default/template/woomio_tracker/tracking.phtml +2 -2
- app/etc/modules/Woomio_Tracker.xml +1 -1
- package.xml +4 -4
app/code/local/Woomio/Tracker/controllers/IndexController.php
CHANGED
@@ -2,130 +2,213 @@
|
|
2 |
class Woomio_Tracker_IndexController extends Mage_Core_Controller_Front_Action{
|
3 |
public function IndexAction() {
|
4 |
|
5 |
-
$AllowedIP
|
6 |
-
$GetParams
|
7 |
-
$woomioTable
|
8 |
-
$response = array();
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
$response['status_message'] = "IP allowed";
|
14 |
-
if(!$GetParams['hrs']){
|
15 |
-
$HRS = 1;
|
16 |
-
}else{
|
17 |
-
$HRS = $GetParams['hrs'];
|
18 |
-
}
|
19 |
-
if(!$GetParams['wacs']){
|
20 |
-
$WACSID = 0;
|
21 |
-
}else{
|
22 |
-
$WACSID = $GetParams['wacs'];
|
23 |
-
}
|
24 |
-
if(!$GetParams['id']){
|
25 |
-
$_ID = 0;
|
26 |
-
}else{
|
27 |
-
$_ID = $GetParams['id'];
|
28 |
-
}
|
29 |
-
switch($GetParams['type']){
|
30 |
-
case 'orders':
|
31 |
-
|
32 |
-
$_conn = Mage::getSingleton('core/resource')->getConnection('core_read');
|
33 |
-
$fromDate = date('Y-m-d H:i:s', strtotime('now -'.$HRS.' hours'));
|
34 |
-
$toDate = date('Y-m-d H:i:s', strtotime('now'));
|
35 |
-
if($_ID){
|
36 |
-
$Order = Mage::getModel('sales/order')->load($_ID);
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
if($WACSID){
|
47 |
-
$woomioRow = $_conn->fetchRow('SELECT wacsid FROM '.$woomioTable.' WHERE orderid = '.$Order->getId());
|
48 |
-
if($woomioRow['wacsid']){
|
49 |
-
$response['orders'][$Order->getId()] = $Order->getData();
|
50 |
-
foreach($Order->getAllItems() as $Item):
|
51 |
-
$response['orders'][$Order->getId()]['items'][] = array('id' => $Item->getProductId(), 'sku' => $Item->getSku(), 'name' => $Item->getName());
|
52 |
-
endforeach;
|
53 |
-
$response['orders'][$Order->getId()]['customer'] = $Order->getBillingAddress()->getData();
|
54 |
-
$response['orders'][$Order->getId()]['customer']['fullname'] = $Order->getCustomerName();
|
55 |
-
$response['orders'][$Order->getId()]['customer']['fullstreet'] = $Order->getBillingAddress()->getStreetFull();
|
56 |
-
$response['orders'][$Order->getId()]['wacsid'] = $woomioRow['wacsid'];
|
57 |
-
}
|
58 |
-
}else{
|
59 |
-
$woomioRow = $_conn->fetchRow('SELECT wacsid FROM '.$woomioTable.' WHERE orderid = '.$Order->getId());
|
60 |
-
$response['orders'][$Order->getId()] = $Order->getData();
|
61 |
-
foreach($Order->getAllItems() as $Item):
|
62 |
-
$response['orders'][$Order->getId()]['items'][] = array('id' => $Item->getProductId(), 'sku' => $Item->getSku(), 'name' => $Item->getName());
|
63 |
-
endforeach;
|
64 |
-
$response['orders'][$Order->getId()]['customer'] = $Order->getBillingAddress()->getData();
|
65 |
-
$response['orders'][$Order->getId()]['customer']['fullname'] = $Order->getCustomerName();
|
66 |
-
$response['orders'][$Order->getId()]['customer']['fullstreet'] = $Order->getBillingAddress()->getStreetFull();
|
67 |
-
if($woomioRow['wacsid']){
|
68 |
-
$response['orders'][$Order->getId()]['wacsid'] = $woomioRow['wacsid'];
|
69 |
-
}else{
|
70 |
-
$response['orders'][$Order->getId()]['wacsid'] = 0;
|
71 |
-
}
|
72 |
-
}
|
73 |
-
}
|
74 |
-
}
|
75 |
-
|
76 |
break;
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
87 |
}
|
|
|
|
|
88 |
break;
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
}
|
112 |
-
|
113 |
}
|
|
|
|
|
114 |
break;
|
115 |
-
}
|
116 |
-
}else{
|
117 |
-
$response['status'] = "error";
|
118 |
-
$response['status_message'] = "IP NOT allowed";
|
119 |
-
}
|
120 |
-
|
121 |
-
if($GetParams['debug'] == 'true'){
|
122 |
-
echo "<pre>";
|
123 |
-
var_dump($response);
|
124 |
-
echo "</pre>";
|
125 |
-
Mage::getModel('core/cookie')->set('wacsid', '999');
|
126 |
-
}else{
|
127 |
-
echo json_encode($response);
|
128 |
}
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
}
|
131 |
}
|
2 |
class Woomio_Tracker_IndexController extends Mage_Core_Controller_Front_Action{
|
3 |
public function IndexAction() {
|
4 |
|
5 |
+
$AllowedIP = gethostbyname('ping.woomio.com');
|
6 |
+
$GetParams = Mage::app()->getRequest()->getParams();
|
7 |
+
$woomioTable = Mage::getSingleton("core/resource")->getTableName('woomio');
|
|
|
8 |
|
9 |
+
if($_SERVER['REMOTE_ADDR'] !== $AllowedIP) {
|
10 |
+
die;
|
11 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
$hrs = ((isset($_GET['hrs']) && is_numeric($_GET['hrs'])) ? $_GET['hrs'] : null);
|
14 |
+
$affiliated = (isset($_GET['affiliated']) && $_GET['affiliated'] === 'true');
|
15 |
+
$id = (isset($_GET['id']) ? $_GET['id'] : 0);
|
16 |
+
|
17 |
+
switch($GetParams['type']){
|
18 |
+
case 'orders':
|
19 |
+
$response = new stdClass();
|
20 |
+
$response->orders = $this->get_orders($affiliated, $id, $hrs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
break;
|
22 |
+
|
23 |
+
case 'customers':
|
24 |
+
$response = array();
|
25 |
+
|
26 |
+
if($id){
|
27 |
+
$Address = Mage::getModel('sales/order_address')->load($id);
|
28 |
+
$response['customers'][] = $Address->getData();
|
29 |
+
}
|
30 |
+
else{
|
31 |
+
$Addresses = Mage::getModel('sales/order_address')->getCollection()->addFieldToSelect('*')->addFieldToFilter('address_type', 'billing');
|
32 |
+
foreach($Addresses as $Address) {
|
33 |
+
$response['customers'][$Address->getId()] = $Address->getData();
|
34 |
}
|
35 |
+
unset($Address);
|
36 |
+
}
|
37 |
break;
|
38 |
+
case 'products':
|
39 |
+
$response = array();
|
40 |
+
if($id){
|
41 |
+
$Products = Mage::getModel('catalog/product')->load($id);
|
42 |
+
$response['products'][] = $Products->getData();
|
43 |
+
}
|
44 |
+
else{
|
45 |
+
$Products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
|
46 |
+
if($hrs !== null){
|
47 |
+
$startDate = date('Y-m-d', strtotime('now -' . $hrs . ' hours'));
|
48 |
+
$finishDate = date('Y-m-d', strtotime('now'));
|
49 |
+
$Products->addAttributeToFilter(array(array('attribute' => 'created_at','from' => $startDate,'to' => $finishDate)));
|
50 |
+
}
|
51 |
|
52 |
+
foreach($Products as $Product){
|
53 |
+
$response['products'][$Product->getId()] = $Product->getData();
|
54 |
+
// Categories
|
55 |
+
$Categories = $Product->getCategoryCollection()->addAttributeToSelect('name');
|
56 |
+
foreach ($Categories as $Category) {
|
57 |
+
$response['products'][$Product->getId()]["categories"] .= $Category -> getName() . "|";
|
58 |
+
}
|
59 |
+
unset($Product);
|
|
|
|
|
60 |
}
|
61 |
+
unset($Product);
|
62 |
+
}
|
63 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
|
66 |
+
echo json_encode($response);
|
67 |
+
}
|
68 |
+
|
69 |
+
function get_orders($affiliated, $id, $hrs) {
|
70 |
+
global $wpdb;
|
71 |
+
|
72 |
+
//If no orders return empty order array
|
73 |
+
$orders = array();
|
74 |
+
|
75 |
+
$db_resource = Mage::getSingleton('core/resource');
|
76 |
+
$read_connection = $db_resource->getConnection('core_read');
|
77 |
+
|
78 |
+
$table_woomio = $db_resource->getTableName('woomio');
|
79 |
+
$table_order = $db_resource->getTableName('sales_flat_order');
|
80 |
+
|
81 |
+
$now = new DateTime(null, new DateTimeZone('UTC'));
|
82 |
+
|
83 |
+
//Get orders
|
84 |
+
$query = "SELECT entity_id, created_at, shipping_method, shipping_amount, shipping_tax_amount, order_currency_code, remote_ip, customer_is_guest, customer_id, customer_email, discount_amount, tax_amount, grand_total, shipping_address_id, billing_address_id";
|
85 |
+
if($affiliated === true) {
|
86 |
+
$query .= ", wacsid";
|
87 |
+
}
|
88 |
+
$query .= " FROM " . $table_order;
|
89 |
+
if($affiliated === true) {
|
90 |
+
$query .= ", " . $table_woomio;
|
91 |
+
}
|
92 |
+
$query .= " WHERE entity_id >= 0"; //Always true condition to allow adding the other conditionals based on parameters
|
93 |
+
if($affiliated === true) {
|
94 |
+
$query .= " AND entity_id=orderid";
|
95 |
+
}
|
96 |
+
if($id) {
|
97 |
+
$query .= " AND entity_id = :id";
|
98 |
+
}
|
99 |
+
if($hrs !== null) {
|
100 |
+
$now->sub(new DateInterval('PT' . $hrs . 'H'));
|
101 |
+
$query .= " AND created_at >= :created_at";
|
102 |
+
}
|
103 |
+
$query .= " ORDER BY entity_id;";
|
104 |
+
|
105 |
+
$query_binds = array();
|
106 |
+
if ($id && $hrs !== null) {
|
107 |
+
$query_binds['id'] = $id;
|
108 |
+
$query_binds['created_at'] = $now->format('Y-m-d H:i:s');
|
109 |
+
}
|
110 |
+
else if($id) {
|
111 |
+
$query_binds['id'] = $id;
|
112 |
+
}
|
113 |
+
else if($hrs !== null) {
|
114 |
+
$query_binds['created_at'] = $now->format('Y-m-d H:i:s');
|
115 |
+
}
|
116 |
+
|
117 |
+
$result = $read_connection->query($query, $query_binds);
|
118 |
+
while($row = $result->fetch()) {
|
119 |
+
$order = new stdClass();
|
120 |
+
$order->id = $row['entity_id'];
|
121 |
+
$order->time = $row['created_at'];
|
122 |
+
$order->items = array();
|
123 |
+
$order->shippings = array();
|
124 |
+
$order->currency = $row['order_currency_code'];
|
125 |
+
$order->customer_order_ip = $row['remote_ip'];
|
126 |
+
$order->user_agent = ''; // Magento does not seem to store the user agent
|
127 |
+
$order->is_guest = ($row['customer_is_guest'] === '0');
|
128 |
+
$order->customer_id = $row['customer_id'];
|
129 |
+
$order->shippings[0] = new stdClass();
|
130 |
+
$order->shippings[0]->shipping_cost = $row['shipping_amount'];
|
131 |
+
$order->customer_email = $row['customer_email'];
|
132 |
+
$order->cart_discount = $row['discount_amount'];
|
133 |
+
$order->cart_discount_tax = 0; //Magento does not seem to calculate tax on discounts
|
134 |
+
$order->order_tax = $row['tax_amount'];
|
135 |
+
$order->total = $row['grand_total'];
|
136 |
+
if($affiliated === true) {
|
137 |
+
$order->wacsid = $row['wacsid'];
|
138 |
+
}
|
139 |
+
$order->billing_address = $row['billing_address_id'];
|
140 |
+
$order->shippings[0]->shipping_address = $row['shipping_address_id'];
|
141 |
+
$orders[] = $order;
|
142 |
+
}
|
143 |
+
|
144 |
+
$table_order_item = $db_resource->getTableName('sales_flat_order_item');
|
145 |
+
$table_order_address = $db_resource->getTableName('sales_flat_order_address');
|
146 |
+
|
147 |
+
$item_query = "SELECT qty_ordered, product_id, name, sku, tax_amount, row_total, row_total_incl_tax";
|
148 |
+
$item_query .= " FROM " . $table_order_item;
|
149 |
+
$item_query .= " WHERE order_id = :order_id AND product_type = 'configurable' ORDER BY item_id;";
|
150 |
+
|
151 |
+
$address_query = "SELECT t1.region as shipping_region, t1.postcode AS shipping_postcode, t1.lastname AS shipping_lastname, t1.street AS shipping_address, t1.city AS shipping_city, t1.firstname AS shipping_firstname, t1.middlename AS shipping_middlename, t1.company AS shipping_company, t1.country_id AS shipping_country";
|
152 |
+
$address_query .= ", t2.region AS billing_region, t2.postcode AS billing_postcode, t2.lastname AS billing_lastname, t2.street AS billing_address, t2.city AS billing_city, t2.telephone AS billing_phone, t2.firstname AS billing_firstname, t2.middlename AS billing_middlename, t2.company AS billing_company, t2.country_id AS billing_country";
|
153 |
+
$address_query .= " FROM " . $table_order_address . " AS t1";
|
154 |
+
$address_query .= " INNER JOIN " . $table_order_address . " AS t2";
|
155 |
+
$address_query .= " ON t2.entity_id = :billing_entity_id";
|
156 |
+
$address_query .= " WHERE t1.entity_id = :shipping_entity_id;";
|
157 |
+
|
158 |
+
foreach($orders as $order) {
|
159 |
+
$item_query_binds = array('order_id' => $order->id);
|
160 |
+
//Get order items
|
161 |
+
$result = $read_connection->query($item_query, $item_query_binds);
|
162 |
+
$count = 0;
|
163 |
+
while($row = $result->fetch()) {
|
164 |
+
$order->items[$count] = new stdClass();
|
165 |
+
$order->items[$count]->quantity = $row['qty_ordered'];
|
166 |
+
$order->items[$count]->product_id = $row['product_id'];
|
167 |
+
$order->items[$count]->name = $row['name'];
|
168 |
+
$order->items[$count]->sku = $row['sku'];
|
169 |
+
$order->items[$count]->subtotal = $row['row_total'];
|
170 |
+
$order->items[$count]->tax = $row['tax_amount'];
|
171 |
+
$order->items[$count]->total = $row['row_total_incl_tax'];
|
172 |
+
$count++;
|
173 |
+
}
|
174 |
+
|
175 |
+
//Get shipping and billing addresses
|
176 |
+
$address_query_binds = array(
|
177 |
+
'shipping_entity_id' => $order->shippings[0]->shipping_address,
|
178 |
+
'billing_entity_id' => $order->billing_address
|
179 |
+
);
|
180 |
+
$result = $read_connection->query($address_query, $address_query_binds);
|
181 |
+
while($row = $result->fetch()) {
|
182 |
+
$order->shippings[0]->shipping_state = $row['shipping_region'];
|
183 |
+
$order->shippings[0]->shipping_postcode = $row['shipping_postcode'];
|
184 |
+
$order->shippings[0]->shipping_last_name = "";
|
185 |
+
if($row['shipping_middlename'] !== null) {
|
186 |
+
$order->shippings[0]->shipping_last_name .= $row['shipping_middlename'] . " ";
|
187 |
+
}
|
188 |
+
$order->shippings[0]->shipping_last_name .= $row['shipping_lastname'];
|
189 |
+
$order->shippings[0]->shipping_address = $row['shipping_address'];
|
190 |
+
$order->shippings[0]->shipping_city = $row['shipping_city'];
|
191 |
+
$order->shippings[0]->shipping_first_name = $row['shipping_firstname'];
|
192 |
+
$order->shippings[0]->shipping_company = $row['shipping_company'];
|
193 |
+
$order->shippings[0]->shipping_country = $row['shipping_country'];
|
194 |
+
|
195 |
+
$order->billing_state = $row['billing_state'];
|
196 |
+
$order->billing_postcode = $row['billing_postcode'];
|
197 |
+
$order->billing_lastname = "";
|
198 |
+
if($row['billing_middlename'] !== null) {
|
199 |
+
$order->billing_last_name .= $row['billing_middlename'] . " ";
|
200 |
+
}
|
201 |
+
$order->billing_last_name .= $row['billing_lastname'];
|
202 |
+
$order->billing_address = $row['billing_address'];
|
203 |
+
$order->billing_city = $row['billing_city'];
|
204 |
+
$order->customer_phone = $row['billing_phone'];
|
205 |
+
$order->billing_first_name = $row['billing_firstname'];
|
206 |
+
$order->billing_company = $row['billing_company'];
|
207 |
+
$order->billing_country = $row['billing_country'];
|
208 |
+
}
|
209 |
+
}
|
210 |
+
unset($order);
|
211 |
+
|
212 |
+
return $orders;
|
213 |
}
|
214 |
}
|
app/code/local/Woomio/Tracker/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Woomio_Tracker>
|
5 |
-
<version>1.1.
|
6 |
</Woomio_Tracker>
|
7 |
</modules>
|
8 |
<frontend>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Woomio_Tracker>
|
5 |
+
<version>1.1.3</version>
|
6 |
</Woomio_Tracker>
|
7 |
</modules>
|
8 |
<frontend>
|
app/code/local/Woomio/Tracker/sql/tracker_setup/{install-1.1.2.php → install-1.1.3.php}
RENAMED
@@ -18,6 +18,8 @@ if(is_numeric($data_key) === false) {
|
|
18 |
$Lang = substr(Mage::getStoreConfig('general/locale/code'),0,2);
|
19 |
$Name = Mage::getStoreConfig('trans_email/ident_general/name');
|
20 |
|
|
|
|
|
21 |
$SetupCallbackUrl = 'https://www.woomio.com/endpoints/RetailerSignup?name=' . urlencode($Name) . '&domain=' . urlencode($Domain) . '&country=' . urlencode($Lang) . '&email=' . urlencode($Email) . '&platform=1';
|
22 |
|
23 |
//Ignore errors returned by the server
|
18 |
$Lang = substr(Mage::getStoreConfig('general/locale/code'),0,2);
|
19 |
$Name = Mage::getStoreConfig('trans_email/ident_general/name');
|
20 |
|
21 |
+
error_log("Installing woomio plugin 1.1.3. Email: " . $Email . "; Domain: " . $Domain . "; Lang: " . $Lang . "; Name: " . $Name);
|
22 |
+
|
23 |
$SetupCallbackUrl = 'https://www.woomio.com/endpoints/RetailerSignup?name=' . urlencode($Name) . '&domain=' . urlencode($Domain) . '&country=' . urlencode($Lang) . '&email=' . urlencode($Email) . '&platform=1';
|
24 |
|
25 |
//Ignore errors returned by the server
|
app/code/local/Woomio/Tracker/sql/tracker_setup/{upgrade-1.0.10-1.1.2.php → upgrade-1.0.10-1.1.3.php}
RENAMED
@@ -18,6 +18,8 @@ if(is_numeric($data_key) === false) {
|
|
18 |
$Lang = substr(Mage::getStoreConfig('general/locale/code'),0,2);
|
19 |
$Name = Mage::getStoreConfig('trans_email/ident_general/name');
|
20 |
|
|
|
|
|
21 |
$SetupCallbackUrl = 'https://www.woomio.com/endpoints/RetailerSignup?name=' . urlencode($Name) . '&domain=' . urlencode($Domain) . '&country=' . urlencode($Lang) . '&email=' . urlencode($Email) . '&platform=1';
|
22 |
|
23 |
//Ignore errors returned by the server
|
18 |
$Lang = substr(Mage::getStoreConfig('general/locale/code'),0,2);
|
19 |
$Name = Mage::getStoreConfig('trans_email/ident_general/name');
|
20 |
|
21 |
+
error_log("Updating to woomio plugin 1.1.3 from 1.0.10. Email: " . $Email . "; Domain: " . $Domain . "; Lang: " . $Lang . "; Name: " . $Name);
|
22 |
+
|
23 |
$SetupCallbackUrl = 'https://www.woomio.com/endpoints/RetailerSignup?name=' . urlencode($Name) . '&domain=' . urlencode($Domain) . '&country=' . urlencode($Lang) . '&email=' . urlencode($Email) . '&platform=1';
|
24 |
|
25 |
//Ignore errors returned by the server
|
app/code/local/Woomio/Tracker/sql/tracker_setup/{upgrade-1.0.11-1.1.2.php → upgrade-1.0.11-1.1.3.php}
RENAMED
@@ -18,6 +18,8 @@ if(is_numeric($data_key) === false) {
|
|
18 |
$Lang = substr(Mage::getStoreConfig('general/locale/code'),0,2);
|
19 |
$Name = Mage::getStoreConfig('trans_email/ident_general/name');
|
20 |
|
|
|
|
|
21 |
$SetupCallbackUrl = 'https://www.woomio.com/endpoints/RetailerSignup?name=' . urlencode($Name) . '&domain=' . urlencode($Domain) . '&country=' . urlencode($Lang) . '&email=' . urlencode($Email) . '&platform=1';
|
22 |
|
23 |
//Ignore errors returned by the server
|
18 |
$Lang = substr(Mage::getStoreConfig('general/locale/code'),0,2);
|
19 |
$Name = Mage::getStoreConfig('trans_email/ident_general/name');
|
20 |
|
21 |
+
error_log("Updating to woomio plugin 1.1.3 from 1.0.11. Email: " . $Email . "; Domain: " . $Domain . "; Lang: " . $Lang . "; Name: " . $Name);
|
22 |
+
|
23 |
$SetupCallbackUrl = 'https://www.woomio.com/endpoints/RetailerSignup?name=' . urlencode($Name) . '&domain=' . urlencode($Domain) . '&country=' . urlencode($Lang) . '&email=' . urlencode($Email) . '&platform=1';
|
24 |
|
25 |
//Ignore errors returned by the server
|
app/code/local/Woomio/Tracker/sql/tracker_setup/{upgrade-1.0.12-1.1.2.php → upgrade-1.0.12-1.1.3.php}
RENAMED
@@ -18,6 +18,8 @@ if(is_numeric($data_key) === false) {
|
|
18 |
$Lang = substr(Mage::getStoreConfig('general/locale/code'),0,2);
|
19 |
$Name = Mage::getStoreConfig('trans_email/ident_general/name');
|
20 |
|
|
|
|
|
21 |
$SetupCallbackUrl = 'https://www.woomio.com/endpoints/RetailerSignup?name=' . urlencode($Name) . '&domain=' . urlencode($Domain) . '&country=' . urlencode($Lang) . '&email=' . urlencode($Email) . '&platform=1';
|
22 |
|
23 |
//Ignore errors returned by the server
|
18 |
$Lang = substr(Mage::getStoreConfig('general/locale/code'),0,2);
|
19 |
$Name = Mage::getStoreConfig('trans_email/ident_general/name');
|
20 |
|
21 |
+
error_log("Updating to woomio plugin 1.1.3 from 1.0.12. Email: " . $Email . "; Domain: " . $Domain . "; Lang: " . $Lang . "; Name: " . $Name);
|
22 |
+
|
23 |
$SetupCallbackUrl = 'https://www.woomio.com/endpoints/RetailerSignup?name=' . urlencode($Name) . '&domain=' . urlencode($Domain) . '&country=' . urlencode($Lang) . '&email=' . urlencode($Email) . '&platform=1';
|
24 |
|
25 |
//Ignore errors returned by the server
|
app/code/local/Woomio/Tracker/sql/tracker_setup/{upgrade-1.1.0-1.1.2.php → upgrade-1.1.0-1.1.3.php}
RENAMED
@@ -18,6 +18,8 @@ if(is_numeric($data_key) === false) {
|
|
18 |
$Lang = substr(Mage::getStoreConfig('general/locale/code'),0,2);
|
19 |
$Name = Mage::getStoreConfig('trans_email/ident_general/name');
|
20 |
|
|
|
|
|
21 |
$SetupCallbackUrl = 'https://www.woomio.com/endpoints/RetailerSignup?name=' . urlencode($Name) . '&domain=' . urlencode($Domain) . '&country=' . urlencode($Lang) . '&email=' . urlencode($Email) . '&platform=1';
|
22 |
|
23 |
//Ignore errors returned by the server
|
18 |
$Lang = substr(Mage::getStoreConfig('general/locale/code'),0,2);
|
19 |
$Name = Mage::getStoreConfig('trans_email/ident_general/name');
|
20 |
|
21 |
+
error_log("Updating to woomio plugin 1.1.3 from 1.1.0. Email: " . $Email . "; Domain: " . $Domain . "; Lang: " . $Lang . "; Name: " . $Name);
|
22 |
+
|
23 |
$SetupCallbackUrl = 'https://www.woomio.com/endpoints/RetailerSignup?name=' . urlencode($Name) . '&domain=' . urlencode($Domain) . '&country=' . urlencode($Lang) . '&email=' . urlencode($Email) . '&platform=1';
|
24 |
|
25 |
//Ignore errors returned by the server
|
app/code/local/Woomio/Tracker/sql/tracker_setup/{upgrade-1.1.1-1.1.2.php → upgrade-1.1.1-1.1.3.php}
RENAMED
@@ -18,6 +18,8 @@ if(is_numeric($data_key) === false) {
|
|
18 |
$Lang = substr(Mage::getStoreConfig('general/locale/code'),0,2);
|
19 |
$Name = Mage::getStoreConfig('trans_email/ident_general/name');
|
20 |
|
|
|
|
|
21 |
$SetupCallbackUrl = 'https://www.woomio.com/endpoints/RetailerSignup?name=' . urlencode($Name) . '&domain=' . urlencode($Domain) . '&country=' . urlencode($Lang) . '&email=' . urlencode($Email) . '&platform=1';
|
22 |
|
23 |
//Ignore errors returned by the server
|
18 |
$Lang = substr(Mage::getStoreConfig('general/locale/code'),0,2);
|
19 |
$Name = Mage::getStoreConfig('trans_email/ident_general/name');
|
20 |
|
21 |
+
error_log("Updating to woomio plugin 1.1.3 from 1.1.1. Email: " . $Email . "; Domain: " . $Domain . "; Lang: " . $Lang . "; Name: " . $Name);
|
22 |
+
|
23 |
$SetupCallbackUrl = 'https://www.woomio.com/endpoints/RetailerSignup?name=' . urlencode($Name) . '&domain=' . urlencode($Domain) . '&country=' . urlencode($Lang) . '&email=' . urlencode($Email) . '&platform=1';
|
24 |
|
25 |
//Ignore errors returned by the server
|
app/code/local/Woomio/Tracker/sql/tracker_setup/upgrade-1.1.2-1.1.3.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function w_error_handler_112($errno, $errstr, $errfile, $errline, $errcontext) {
|
3 |
+
error_log('An error occurred registering with woomio backend, and was bypassed. ' . $errno . ': ' . $errstr);
|
4 |
+
return true;
|
5 |
+
}
|
6 |
+
|
7 |
+
$installer = $this;
|
8 |
+
$installer->startSetup();
|
9 |
+
|
10 |
+
//Check if data_key is already in config and that it is a number
|
11 |
+
$data_key = Mage::getStoreConfig('tracker/general/data_key');
|
12 |
+
if(is_numeric($data_key) === false) {
|
13 |
+
$sql = 'DROP TABLE IF EXISTS `'.$this->getTable('woomio').'`;';
|
14 |
+
$sql .= 'CREATE TABLE '.$this->getTable('woomio').'(orderid int not null auto_increment, wacsid varchar(100), primary key(orderid));';
|
15 |
+
|
16 |
+
$Email = Mage::getStoreConfig('trans_email/ident_general/email');
|
17 |
+
$Domain = Mage::getStoreConfig('web/unsecure/base_url');
|
18 |
+
$Lang = substr(Mage::getStoreConfig('general/locale/code'),0,2);
|
19 |
+
$Name = Mage::getStoreConfig('trans_email/ident_general/name');
|
20 |
+
|
21 |
+
error_log("Updating to woomio plugin 1.1.3 from 1.1.2. Email: " . $Email . "; Domain: " . $Domain . "; Lang: " . $Lang . "; Name: " . $Name);
|
22 |
+
|
23 |
+
$SetupCallbackUrl = 'https://www.woomio.com/endpoints/RetailerSignup?name=' . urlencode($Name) . '&domain=' . urlencode($Domain) . '&country=' . urlencode($Lang) . '&email=' . urlencode($Email) . '&platform=1';
|
24 |
+
|
25 |
+
//Ignore errors returned by the server
|
26 |
+
$context = stream_context_create(array(
|
27 |
+
'http' => array('ignore_errors' => true)
|
28 |
+
));
|
29 |
+
|
30 |
+
set_error_handler('w_error_handler_112');
|
31 |
+
$Response = @file_get_contents($SetupCallbackUrl, false, $context);
|
32 |
+
restore_error_handler();
|
33 |
+
|
34 |
+
if($Response !== false) {
|
35 |
+
$configModel = new Mage_Core_Model_Config();
|
36 |
+
//We save to default since the plugin can only be one in a multistore setup anyhow
|
37 |
+
$configModel->saveConfig('tracker/general/data_key', $Response, 'default', 0);
|
38 |
+
//Make sure cache gets updated with the new config
|
39 |
+
$configModel->reinit();
|
40 |
+
Mage::app()->reinitStores();
|
41 |
+
}
|
42 |
+
|
43 |
+
$installer->run($sql);
|
44 |
+
}
|
45 |
+
|
46 |
+
$installer->endSetup();
|
app/design/frontend/base/default/layout/tracker.xml
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<layout version="1.1.
|
3 |
<default>
|
4 |
<reference name="head">
|
5 |
<block type="tracker/tracking" name="tracking" as="tracker_tracking_head" template="woomio_tracker/tracking.phtml" />
|
1 |
<?xml version="1.0"?>
|
2 |
+
<layout version="1.1.3">
|
3 |
<default>
|
4 |
<reference name="head">
|
5 |
<block type="tracker/tracking" name="tracking" as="tracker_tracking_head" template="woomio_tracker/tracking.phtml" />
|
app/design/frontend/base/default/template/woomio_tracker/tracking.phtml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
$DATAR = Mage::getStoreConfig('tracker/general/data_key');
|
3 |
?>
|
4 |
<?php if($DATAR):?>
|
5 |
-
<script src="https://woomio.com/assets/js/analytics/ro.js" data-r="<?php echo $DATAR;?>" data-v="1.1.
|
6 |
<?php else: ?>
|
7 |
-
<script src="https://woomio.com/assets/js/analytics/ro.js" data-v="1.1.
|
8 |
<?php endif; ?>
|
2 |
$DATAR = Mage::getStoreConfig('tracker/general/data_key');
|
3 |
?>
|
4 |
<?php if($DATAR):?>
|
5 |
+
<script src="https://woomio.com/assets/js/analytics/ro.js" data-r="<?php echo $DATAR;?>" data-v="1.1.3"></script>
|
6 |
<?php else: ?>
|
7 |
+
<script src="https://woomio.com/assets/js/analytics/ro.js" data-v="1.1.3"></script>
|
8 |
<?php endif; ?>
|
app/etc/modules/Woomio_Tracker.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<Woomio_Tracker>
|
5 |
<active>true</active>
|
6 |
<codePool>local</codePool>
|
7 |
-
<version>1.1.
|
8 |
</Woomio_Tracker>
|
9 |
</modules>
|
10 |
</config>
|
4 |
<Woomio_Tracker>
|
5 |
<active>true</active>
|
6 |
<codePool>local</codePool>
|
7 |
+
<version>1.1.3</version>
|
8 |
</Woomio_Tracker>
|
9 |
</modules>
|
10 |
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Woo</name>
|
4 |
-
<version>1.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.woomio.com">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -23,9 +23,9 @@ Compatibility
|
|
23 |
Woomio is fully compatible with all Magento versions and modules.</description>
|
24 |
<notes>Support details statistic </notes>
|
25 |
<authors><author><name>Woomio</name><user>Woomio</user><email>developer@woomio.com</email></author></authors>
|
26 |
-
<date>2015-07-
|
27 |
-
<time>
|
28 |
-
<contents><target name="magelocal"><dir name="Woomio"><dir name="Tracker"><dir name="Block"><file name="Index.php" hash="949b7c689724a7eeeba5168a9cf03507"/><file name="Tracking.php" hash="1e3cb6eb08e18f13913b3a172571603d"/></dir><dir name="Helper"><file name="Data.php" hash="53a3a643e1eea3a72e02b5c64daa9edd"/></dir><dir name="Model"><file name="Observer.php" hash="6cfacdde5c3aa358c889ef1f842a61f3"/></dir><dir name="controllers"><file name="IndexController.php" hash="
|
29 |
<compatible/>
|
30 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
31 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Woo</name>
|
4 |
+
<version>1.1.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.woomio.com">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
23 |
Woomio is fully compatible with all Magento versions and modules.</description>
|
24 |
<notes>Support details statistic </notes>
|
25 |
<authors><author><name>Woomio</name><user>Woomio</user><email>developer@woomio.com</email></author></authors>
|
26 |
+
<date>2015-07-14</date>
|
27 |
+
<time>08:15:54</time>
|
28 |
+
<contents><target name="magelocal"><dir name="Woomio"><dir name="Tracker"><dir name="Block"><file name="Index.php" hash="949b7c689724a7eeeba5168a9cf03507"/><file name="Tracking.php" hash="1e3cb6eb08e18f13913b3a172571603d"/></dir><dir name="Helper"><file name="Data.php" hash="53a3a643e1eea3a72e02b5c64daa9edd"/></dir><dir name="Model"><file name="Observer.php" hash="6cfacdde5c3aa358c889ef1f842a61f3"/></dir><dir name="controllers"><file name="IndexController.php" hash="fe9ee0123f98a64343dda627fe9e1e64"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f4f46675a9901fece5c8b74bb44f7d27"/><file name="config.xml" hash="73f0bb06ff7e7ca3fc44b855c230087c"/></dir><dir name="sql"><dir name="tracker_setup"><file name="install-1.1.3.php" hash="1f3e8778278cb8f9f6d3e70910791a45"/><file name="upgrade-1.0.10-1.1.3.php" hash="5d31b933b9e425f753b8bb22c0e6167e"/><file name="upgrade-1.0.11-1.1.3.php" hash="ab33630769f0a902f738d89e16c95e39"/><file name="upgrade-1.0.12-1.1.3.php" hash="41e462d03c359949955c0f5db22dc120"/><file name="upgrade-1.1.0-1.1.3.php" hash="22dabb86716ec90b677325d55c2b24c3"/><file name="upgrade-1.1.1-1.1.3.php" hash="b0e07d69f69f1ab31febdf4da6d23b87"/><file name="upgrade-1.1.2-1.1.3.php" hash="1f3b264f0d6a6ced3e852fc7950c8c23"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="tracker.xml" hash="ee5c53ead3a2d6ffb26bc55a1ee077cb"/></dir><dir name="template"><dir name="woomio_tracker"><file name="tracking.phtml" hash="283464ea6d5648e744fe693c9372fe04"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Woomio_Tracker.xml" hash="08cbc0ee37ed4610137d04ab67baa85d"/></dir></target></contents>
|
29 |
<compatible/>
|
30 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
31 |
</package>
|