Version Notes
Updated javascript tracking code.
Added tracking products purchased.
Added ignore subdomain config.
Split ajax checkout to footer with fix for one-page checkout.
Fixed newsletter subscribe.
Added error checking to prevent faults.
Download this release
Release Info
Developer | Woopra |
Extension | Woopra_Analytics_Event_And_Visitor_Tracking |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.2.0
- app/code/community/Woopra/Analytics/Block/Script.php +5 -1
- app/code/community/Woopra/Analytics/Helper/Data.php +18 -2
- app/code/community/Woopra/Analytics/Model/Observer.php +289 -205
- app/code/community/Woopra/Analytics/etc/config.xml +6 -1
- app/code/community/Woopra/Analytics/etc/system.xml +58 -9
- app/design/frontend/base/default/layout/woopra.xml +3 -0
- app/design/frontend/base/default/template/woopra/checkout.phtml +49 -0
- app/design/frontend/base/default/template/woopra/script.phtml +30 -34
- package.xml +11 -10
app/code/community/Woopra/Analytics/Block/Script.php
CHANGED
@@ -22,7 +22,7 @@ class Woopra_Analytics_Block_Script extends Mage_Core_Block_Template
|
|
22 |
parent::_construct();
|
23 |
|
24 |
// Decide whether the Woopra Module has been activated
|
25 |
-
|
26 |
if(Mage::helper('woopra')->getEnabled() == true) {
|
27 |
$this->setTemplate('woopra/script.phtml');
|
28 |
}
|
@@ -41,6 +41,8 @@ class Woopra_Analytics_Block_Script extends Mage_Core_Block_Template
|
|
41 |
if(empty($data)) {
|
42 |
$data = array(
|
43 |
'enabled' => Mage::helper('woopra')->getEnabled(),
|
|
|
|
|
44 |
'test' => Mage::helper('woopra')->getTest(),
|
45 |
'visitor_timeout' => Mage::helper('woopra')->getVistorTimeout(),
|
46 |
'track_url_parameters' => Mage::helper('woopra')->getTrackUrlParameters(),
|
@@ -56,6 +58,8 @@ class Woopra_Analytics_Block_Script extends Mage_Core_Block_Template
|
|
56 |
'download_tracking_pause' => Mage::helper('woopra')->getDownloadTrackingPause(),
|
57 |
'outgoing_tracking' => Mage::helper('woopra')->getOutgoingTracking(),
|
58 |
'outgoing_tracking_pause' => Mage::helper('woopra')->getOutgoingTrackingPause(),
|
|
|
|
|
59 |
'url' => $_SERVER['HTTP_HOST']
|
60 |
);
|
61 |
|
22 |
parent::_construct();
|
23 |
|
24 |
// Decide whether the Woopra Module has been activated
|
25 |
+
//$website_id = Mage::helper('woopra')->getApiKey();
|
26 |
if(Mage::helper('woopra')->getEnabled() == true) {
|
27 |
$this->setTemplate('woopra/script.phtml');
|
28 |
}
|
41 |
if(empty($data)) {
|
42 |
$data = array(
|
43 |
'enabled' => Mage::helper('woopra')->getEnabled(),
|
44 |
+
'app_id' => Mage::helper('woopra')->getAppId(),
|
45 |
+
'secret_key' => Mage::helper('woopra')->getSecretKey(),
|
46 |
'test' => Mage::helper('woopra')->getTest(),
|
47 |
'visitor_timeout' => Mage::helper('woopra')->getVistorTimeout(),
|
48 |
'track_url_parameters' => Mage::helper('woopra')->getTrackUrlParameters(),
|
58 |
'download_tracking_pause' => Mage::helper('woopra')->getDownloadTrackingPause(),
|
59 |
'outgoing_tracking' => Mage::helper('woopra')->getOutgoingTracking(),
|
60 |
'outgoing_tracking_pause' => Mage::helper('woopra')->getOutgoingTrackingPause(),
|
61 |
+
'outgoing_ignore_subdomain' => Mage::helper('woopra')->getOutgoingIgnoreSubdomain(),
|
62 |
+
'hide_campaign' => Mage::helper('woopra')->getHideCampaign(),
|
63 |
'url' => $_SERVER['HTTP_HOST']
|
64 |
);
|
65 |
|
app/code/community/Woopra/Analytics/Helper/Data.php
CHANGED
@@ -10,9 +10,13 @@
|
|
10 |
|
11 |
class Woopra_Analytics_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
{
|
13 |
-
public function
|
14 |
{
|
15 |
-
return Mage::getStoreConfig('woopra_analytics/woopra/
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
public function getEnabled()
|
18 |
{
|
@@ -78,6 +82,14 @@ class Woopra_Analytics_Helper_Data extends Mage_Core_Helper_Abstract
|
|
78 |
{
|
79 |
return Mage::getStoreConfig('woopra_analytics/woopra_advanced/outgoing_tracking_pause');
|
80 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
public function getCustomerName()
|
82 |
{
|
83 |
return Mage::getStoreConfig('woopra_analytics/woopra_outputs/name');
|
@@ -238,6 +250,10 @@ class Woopra_Analytics_Helper_Data extends Mage_Core_Helper_Abstract
|
|
238 |
{
|
239 |
return Mage::getStoreConfig('woopra_analytics/woopra_events/product_removed_from_wishlist');
|
240 |
}
|
|
|
|
|
|
|
|
|
241 |
public function getProductTagAdded()
|
242 |
{
|
243 |
return Mage::getStoreConfig('woopra_analytics/woopra_events/product_tag_added');
|
10 |
|
11 |
class Woopra_Analytics_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
{
|
13 |
+
public function getAppId()
|
14 |
{
|
15 |
+
return Mage::getStoreConfig('woopra_analytics/woopra/app_id');
|
16 |
+
}
|
17 |
+
public function getSecretKey()
|
18 |
+
{
|
19 |
+
return Mage::getStoreConfig('woopra_analytics/woopra/secret_key');
|
20 |
}
|
21 |
public function getEnabled()
|
22 |
{
|
82 |
{
|
83 |
return Mage::getStoreConfig('woopra_analytics/woopra_advanced/outgoing_tracking_pause');
|
84 |
}
|
85 |
+
public function getOutgoingIgnoreSubdomain()
|
86 |
+
{
|
87 |
+
return Mage::getStoreConfig('woopra_analytics/woopra_advanced/outgoing_ignore_subdomain');
|
88 |
+
}
|
89 |
+
public function getHideCampaign()
|
90 |
+
{
|
91 |
+
return Mage::getStoreConfig('woopra_analytics/woopra_advanced/hide_campaign');
|
92 |
+
}
|
93 |
public function getCustomerName()
|
94 |
{
|
95 |
return Mage::getStoreConfig('woopra_analytics/woopra_outputs/name');
|
250 |
{
|
251 |
return Mage::getStoreConfig('woopra_analytics/woopra_events/product_removed_from_wishlist');
|
252 |
}
|
253 |
+
public function getProductPurchased()
|
254 |
+
{
|
255 |
+
return Mage::getStoreConfig('woopra_analytics/woopra_events/product_purchased');
|
256 |
+
}
|
257 |
public function getProductTagAdded()
|
258 |
{
|
259 |
return Mage::getStoreConfig('woopra_analytics/woopra_events/product_tag_added');
|
app/code/community/Woopra/Analytics/Model/Observer.php
CHANGED
@@ -10,132 +10,146 @@
|
|
10 |
|
11 |
class Woopra_Analytics_Model_Observer extends Varien_Event_Observer
|
12 |
{
|
13 |
-
|
14 |
-
|
15 |
if (Mage::helper('woopra')->getNewsletterSubscribed() != NULL) {
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
}
|
30 |
-
|
31 |
|
32 |
-
|
33 |
{
|
34 |
-
|
35 |
|
36 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'customer_account_loginPost' && Mage::helper('woopra')->getCustomerLogin() != NULL)
|
37 |
-
|
38 |
-
|
39 |
Mage::getSingleton('core/session')->setData('woopra_login_logout_status', Mage::helper('woopra')->getCustomerLogin());
|
40 |
-
|
41 |
|
42 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'customer_account_logoutSuccess' && Mage::helper('woopra')->getCustomerLogout() != NULL)
|
43 |
{
|
44 |
Mage::getSingleton('core/session')->setData('woopra_login_logout_trigger', 1);
|
45 |
Mage::getSingleton('core/session')->setData('woopra_login_logout_status', Mage::helper('woopra')->getCustomerLogout());
|
46 |
}
|
47 |
|
48 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'contacts_index_post' && Mage::helper('woopra')->getContactFormSent() != NULL)
|
49 |
{
|
50 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
57 |
}
|
58 |
|
59 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_add' && Mage::helper('woopra')->getProductAddedToCart() != NULL)
|
60 |
{
|
61 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
69 |
}
|
70 |
|
71 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_delete' && Mage::helper('woopra')->getProductRemovedFromCart() != NULL)
|
72 |
{
|
73 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
82 |
}
|
83 |
|
84 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'wishlist_index_add' && Mage::helper('woopra')->getProductAddedToWishlist() != NULL)
|
85 |
{
|
86 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
|
94 |
}
|
95 |
|
96 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'wishlist_index_remove' && Mage::helper('woopra')->getProductRemovedFromWishlist() != NULL)
|
97 |
{
|
98 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
|
|
107 |
}
|
108 |
|
109 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'catalog_product_compare_add' && Mage::helper('woopra')->getProductAddedToCompare() != NULL)
|
110 |
{
|
111 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
119 |
}
|
120 |
|
121 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'catalog_product_compare_remove' && Mage::helper('woopra')->getProductRemovedFromCompare() != NULL)
|
122 |
{
|
123 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
|
|
|
|
131 |
}
|
132 |
|
133 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_onepage_index' && Mage::helper('woopra')->getCheckoutBillingAddress() != NULL)
|
134 |
{
|
135 |
Mage::getSingleton('core/session')->setData('woopra_checkout_trigger', 1);
|
136 |
}
|
137 |
|
138 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_onepage_savePayment' && Mage::helper('woopra')->getCheckoutPaymentMethod() != NULL)
|
139 |
{
|
140 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
141 |
Mage::getSingleton('core/session')->setData('woopra_checkout_trigger', 1);
|
@@ -147,98 +161,109 @@ class Woopra_Analytics_Model_Observer extends Varien_Event_Observer
|
|
147 |
//Mage::log($request['payment']['cc_type'], null, 'woopra.log');
|
148 |
}
|
149 |
|
150 |
-
if(($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_onepage_success' || $observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_multishipping_success') && Mage::helper('woopra')->getCheckoutSuccess() != NULL)
|
151 |
{
|
152 |
-
//$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
153 |
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
175 |
}
|
176 |
-
//Mage::log($order, null, 'woopra.log');
|
177 |
}
|
178 |
|
179 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'catalogsearch_result_index' && Mage::helper('woopra')->getCatalogSearch() != NULL)
|
180 |
{
|
181 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
182 |
-
|
183 |
-
|
184 |
-
|
|
|
|
|
185 |
}
|
186 |
|
187 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'catalogsearch_advanced_result' && Mage::helper('woopra')->getCatalogSearch() != NULL)
|
188 |
{
|
189 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
$
|
194 |
-
|
|
|
|
|
|
|
195 |
}
|
196 |
-
$
|
197 |
}
|
198 |
-
|
|
|
|
|
199 |
}
|
200 |
-
Mage::getSingleton('core/session')->setData('woopra_search_trigger', 1);
|
201 |
-
Mage::getSingleton('core/session')->setData('woopra_search_keywords', addslashes($search_keywords));
|
202 |
-
//Mage::log($search_keywords, null, 'woopra.log');
|
203 |
}
|
204 |
|
205 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'review_product_list' && Mage::helper('woopra')->getProductReviewRead() != NULL)
|
206 |
{
|
207 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
|
|
|
|
215 |
}
|
216 |
|
217 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'review_product_post' && Mage::helper('woopra')->getProductReviewPosted() != NULL)
|
218 |
{
|
219 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
|
|
|
|
231 |
}
|
232 |
|
233 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'customer_account_forgotpasswordpost' && Mage::helper('woopra')->getForgotPassword() != NULL)
|
234 |
{
|
235 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
236 |
-
|
237 |
-
|
238 |
-
|
|
|
|
|
239 |
}
|
240 |
|
241 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'customer_account_editPost' && Mage::helper('woopra')->getChangedPassword() != NULL)
|
242 |
{
|
243 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
244 |
if ($request['change_password'] == 1 && $request['current_password'] != $request['password']) {
|
@@ -247,63 +272,67 @@ class Woopra_Analytics_Model_Observer extends Varien_Event_Observer
|
|
247 |
//Mage::log($request, null, 'woopra.log');
|
248 |
}
|
249 |
|
250 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'tag_index_save' && Mage::helper('woopra')->getProductTagAdded() != NULL)
|
251 |
{
|
252 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
|
|
|
|
262 |
}
|
263 |
|
264 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_couponPost' && Mage::helper('woopra')->getCouponCodeAdded() != NULL)
|
265 |
{
|
266 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
Mage::getSingleton('core/session')->setData('woopra_coupon_code_status', Mage::helper('woopra')->getCouponCodeAdded());
|
273 |
-
//Mage::log($coupon_id->getData(), null, 'woopra.log');
|
274 |
-
}
|
275 |
-
if ($coupon_id['coupon_id'] != null) {
|
276 |
-
$coupon_rules = Mage::getModel('salesrule/rule')->load($coupon_id->getRuleId());
|
277 |
-
Mage::getSingleton('core/session')->setData('woopra_coupon_code_validity', 'valid');
|
278 |
-
Mage::getSingleton('core/session')->setData('woopra_coupon_code_name', addslashes($coupon_rules->getData('name')));
|
279 |
-
//Mage::log($coupon_rules->getData(), null, 'woopra.log');
|
280 |
-
if ($coupon_rules->getData('is_active') == 1) {
|
281 |
-
Mage::getSingleton('core/session')->setData('woopra_coupon_code_active', 'active');
|
282 |
-
//Mage::log($coupon_rules->getData('is_active').' | = active', null, 'woopra.log');
|
283 |
} else {
|
284 |
-
Mage::getSingleton('core/session')->setData('
|
285 |
-
|
286 |
-
}
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
}
|
292 |
-
Mage::getSingleton('core/session')->setData('woopra_coupon_code', addslashes($request['coupon_code']));
|
293 |
-
//Mage::log($observer, null, 'woopra.log');
|
294 |
}
|
295 |
|
296 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'customer_account_create' && Mage::helper('woopra')->getCustomerCreateAccount() != NULL)
|
297 |
{
|
298 |
Mage::getSingleton('core/session')->setData('woopra_create_account_trigger', 1);
|
299 |
//Mage::log('Create account started.', null, 'woopra.log');
|
300 |
}
|
301 |
|
302 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'customer_account_createpost' && Mage::helper('woopra')->getCustomerCreateAccount() != NULL)
|
303 |
{
|
304 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
305 |
Mage::getSingleton('core/session')->setData('woopra_create_account_success_trigger', 1);
|
306 |
-
if ($request['is_subscribed' == 1
|
307 |
Mage::getSingleton('core/session')->setData('woopra_subscriber_changed', 1);
|
308 |
Mage::getSingleton('core/session')->setData('woopra_subscriber_status', Mage::helper('woopra')->getNewsletterSubscribed());
|
309 |
Mage::getSingleton('core/session')->setData('woopra_subscriber_email', $request[email]);
|
@@ -311,40 +340,95 @@ class Woopra_Analytics_Model_Observer extends Varien_Event_Observer
|
|
311 |
//Mage::log($request, null, 'woopra.log');
|
312 |
}
|
313 |
|
314 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_estimatePost' && Mage::helper('woopra')->getEstimatePost() != NULL)
|
315 |
{
|
316 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
|
|
|
|
323 |
}
|
324 |
|
325 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'cms_index_noRoute' && Mage::helper('woopra')->getCmsNoRoute() != NULL)
|
326 |
{
|
327 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getOriginalPathInfo();
|
328 |
Mage::getSingleton('core/session')->setData('woopra_cms_noroute_trigger', 1);
|
329 |
-
|
330 |
-
|
|
|
|
|
331 |
}
|
332 |
|
333 |
-
if($observer->getEvent()->getControllerAction()->getFullActionName() == 'poll_vote_add' && Mage::helper('woopra')->getPollVote() != NULL)
|
334 |
{
|
335 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
$
|
|
|
|
|
341 |
}
|
|
|
|
|
|
|
|
|
342 |
}
|
343 |
-
Mage::getSingleton('core/session')->setData('woopra_poll_vote_trigger', 1);
|
344 |
-
Mage::getSingleton('core/session')->setData('woopra_poll_vote_title', addslashes($poll_title['poll_title']));
|
345 |
-
Mage::getSingleton('core/session')->setData('woopra_poll_vote_answer', addslashes($answer_title));
|
346 |
-
Mage::log($poll_title['poll_title']." | ".$answer_title, null, 'woopra.log');
|
347 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
}
|
349 |
}
|
350 |
?>
|
10 |
|
11 |
class Woopra_Analytics_Model_Observer extends Varien_Event_Observer
|
12 |
{
|
13 |
+
public function newsletterSubscriberChange(Varien_Event_Observer $observer)
|
14 |
+
{
|
15 |
if (Mage::helper('woopra')->getNewsletterSubscribed() != NULL) {
|
16 |
+
$event = $observer->getEvent();
|
17 |
+
$model = $event->getSubscriber();
|
18 |
+
$subscriber_email = $model->getData(subscriber_email);
|
19 |
+
if ($model->getIsStatusChanged() == 1 && $model->getData(subscriber_status) == 1) {
|
20 |
+
Mage::getSingleton('core/session')->setData('woopra_subscriber_changed', 1);
|
21 |
+
Mage::getSingleton('core/session')->setData('woopra_subscriber_status', Mage::helper('woopra')->getNewsletterSubscribed());
|
22 |
+
Mage::getSingleton('core/session')->setData('woopra_subscriber_email', $subscriber_email);
|
23 |
+
} else if ($model->getIsStatusChanged() == 1 && $model->getData(subscriber_status) == 3) {
|
24 |
+
Mage::getSingleton('core/session')->setData('woopra_subscriber_changed', 1);
|
25 |
+
Mage::getSingleton('core/session')->setData('woopra_subscriber_status', Mage::helper('woopra')->getNewsletterUnsubscribed());
|
26 |
+
Mage::getSingleton('core/session')->setData('woopra_subscriber_email', $subscriber_email);
|
27 |
+
} else {
|
28 |
+
}
|
29 |
}
|
30 |
+
}
|
31 |
|
32 |
+
public function controllerActionBefore(Varien_Event_Observer $observer)
|
33 |
{
|
34 |
+
//Mage::log($observer->getEvent()->getControllerAction()->getFullActionName(), null, 'woopra.log');
|
35 |
|
36 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'customer_account_loginPost' && Mage::helper('woopra')->getCustomerLogin() != NULL)
|
37 |
+
{
|
38 |
+
Mage::getSingleton('core/session')->setData('woopra_login_logout_trigger', 1);
|
39 |
Mage::getSingleton('core/session')->setData('woopra_login_logout_status', Mage::helper('woopra')->getCustomerLogin());
|
40 |
+
}
|
41 |
|
42 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'customer_account_logoutSuccess' && Mage::helper('woopra')->getCustomerLogout() != NULL)
|
43 |
{
|
44 |
Mage::getSingleton('core/session')->setData('woopra_login_logout_trigger', 1);
|
45 |
Mage::getSingleton('core/session')->setData('woopra_login_logout_status', Mage::helper('woopra')->getCustomerLogout());
|
46 |
}
|
47 |
|
48 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'contacts_index_post' && Mage::helper('woopra')->getContactFormSent() != NULL)
|
49 |
{
|
50 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
51 |
+
if ($request) {
|
52 |
+
Mage::getSingleton('core/session')->setData('woopra_contacts_index_post', 1);
|
53 |
+
Mage::getSingleton('core/session')->setData('woopra_contacts_name', addslashes($request['name']));
|
54 |
+
Mage::getSingleton('core/session')->setData('woopra_contacts_email', $request['email']);
|
55 |
+
Mage::getSingleton('core/session')->setData('woopra_contacts_telephone', addslashes($request['telephone']));
|
56 |
+
Mage::getSingleton('core/session')->setData('woopra_contacts_comment', addslashes($request['comment']));
|
57 |
+
//Mage::log($request['name']." | ".$request['email']." | ".$request['telephone']." | ".$request['comment'], null, 'woopra.log');
|
58 |
+
}
|
59 |
}
|
60 |
|
61 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_add' && Mage::helper('woopra')->getProductAddedToCart() != NULL)
|
62 |
{
|
63 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
64 |
+
if ($request) {
|
65 |
+
$product = Mage::getModel('catalog/product')->load($request['product'])->getData();
|
66 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_trigger', 1);
|
67 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_status', Mage::helper('woopra')->getProductAddedToCart());
|
68 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_name', addslashes($product['name']));
|
69 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_sku', addslashes($product['sku']));
|
70 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_price', round($product['price'], 2));
|
71 |
+
//Mage::log($product['name']." | ".$product['sku']." | ".round($product['price'], 2), null, 'woopra.log');
|
72 |
+
}
|
73 |
}
|
74 |
|
75 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_delete' && Mage::helper('woopra')->getProductRemovedFromCart() != NULL)
|
76 |
{
|
77 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
78 |
+
if ($request) {
|
79 |
+
$product_id = Mage::getModel('checkout/cart')->getQuote()->getItemById($request['id'])->getProduct()->getId();
|
80 |
+
$product = Mage::getModel('catalog/product')->load($product_id)->getData();
|
81 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_trigger', 1);
|
82 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_status', Mage::helper('woopra')->getProductRemovedFromCart());
|
83 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_name', addslashes($product['name']));
|
84 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_sku', addslashes($product['sku']));
|
85 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_price', round($product['price'], 2));
|
86 |
+
//Mage::log($product['name']." | ".$product['sku']." | ".round($product['price'], 2), null, 'woopra.log');
|
87 |
+
}
|
88 |
}
|
89 |
|
90 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'wishlist_index_add' && Mage::helper('woopra')->getProductAddedToWishlist() != NULL)
|
91 |
{
|
92 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
93 |
+
if ($request) {
|
94 |
+
$product = Mage::getModel('catalog/product')->load($request['product'])->getData();
|
95 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_trigger', 1);
|
96 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_status', Mage::helper('woopra')->getProductAddedToWishlist());
|
97 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_name', addslashes($product['name']));
|
98 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_sku', addslashes($product['sku']));
|
99 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_price', round($product['price'], 2));
|
100 |
+
//Mage::log($product['name']." | ".$product['sku']." | ".round($product['price'], 2), null, 'woopra.log');
|
101 |
+
}
|
102 |
}
|
103 |
|
104 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'wishlist_index_remove' && Mage::helper('woopra')->getProductRemovedFromWishlist() != NULL)
|
105 |
{
|
106 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
107 |
+
if ($request) {
|
108 |
+
$product_id = Mage::getModel('wishlist/item')->load($request['item'])->getProduct()->getId();
|
109 |
+
$product = Mage::getModel('catalog/product')->load($product_id)->getData();
|
110 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_trigger', 1);
|
111 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_status', Mage::helper('woopra')->getProductRemovedFromWishlist());
|
112 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_name', $product['name']);
|
113 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_sku', $product['sku']);
|
114 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_price', round($product['price'], 2));
|
115 |
+
//Mage::log($product['name']." | ".$product['sku']." | ".round($product['price'], 2), null, 'woopra.log');
|
116 |
+
}
|
117 |
}
|
118 |
|
119 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'catalog_product_compare_add' && Mage::helper('woopra')->getProductAddedToCompare() != NULL)
|
120 |
{
|
121 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
122 |
+
if ($request) {
|
123 |
+
$product = Mage::getModel('catalog/product')->load($request['product'])->getData();
|
124 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_trigger', 1);
|
125 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_status', Mage::helper('woopra')->getProductAddedToCompare());
|
126 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_name', addslashes($product['name']));
|
127 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_sku', addslashes($product['sku']));
|
128 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_price', round($product['price'], 2));
|
129 |
+
//Mage::log($product['name']." | ".$product['sku']." | ".round($product['price'], 2), null, 'woopra.log');
|
130 |
+
}
|
131 |
}
|
132 |
|
133 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'catalog_product_compare_remove' && Mage::helper('woopra')->getProductRemovedFromCompare() != NULL)
|
134 |
{
|
135 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
136 |
+
if ($request) {
|
137 |
+
$product = Mage::getModel('catalog/product')->load($request['product'])->getData();
|
138 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_trigger', 1);
|
139 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_status', Mage::helper('woopra')->getProductRemovedFromCompare());
|
140 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_name', $product['name']);
|
141 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_sku', $product['sku']);
|
142 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_price', round($product['price'], 2));
|
143 |
+
//Mage::log($product['name']." | ".$product['sku']." | ".round($product['price'], 2), null, 'woopra.log');
|
144 |
+
}
|
145 |
}
|
146 |
|
147 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_onepage_index' && Mage::helper('woopra')->getCheckoutBillingAddress() != NULL)
|
148 |
{
|
149 |
Mage::getSingleton('core/session')->setData('woopra_checkout_trigger', 1);
|
150 |
}
|
151 |
|
152 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_onepage_savePayment' && Mage::helper('woopra')->getCheckoutPaymentMethod() != NULL)
|
153 |
{
|
154 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
155 |
Mage::getSingleton('core/session')->setData('woopra_checkout_trigger', 1);
|
161 |
//Mage::log($request['payment']['cc_type'], null, 'woopra.log');
|
162 |
}
|
163 |
|
164 |
+
if (($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_onepage_success' || $observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_multishipping_success') && Mage::helper('woopra')->getCheckoutSuccess() != NULL)
|
165 |
{
|
|
|
166 |
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
167 |
+
if ($lastOrderId) {
|
168 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($lastOrderId);
|
169 |
+
$cost = 0;
|
170 |
+
Mage::getSingleton('core/session')->setData('woopra_checkout_success_trigger', 1);
|
171 |
+
Mage::getSingleton('core/session')->setData('woopra_checkout_success_coupon_code', addslashes($order->getCouponCode()));
|
172 |
+
Mage::getSingleton('core/session')->setData('woopra_checkout_success_discount_amount', round($order->getDiscountAmount(), 2));
|
173 |
+
Mage::getSingleton('core/session')->setData('woopra_checkout_success_order_id', addslashes($lastOrderId));
|
174 |
+
Mage::getSingleton('core/session')->setData('woopra_checkout_success_order_subtotal', round($order->getSubtotal(), 2));
|
175 |
+
Mage::getSingleton('core/session')->setData('woopra_checkout_success_order_total', round($order->getGrandTotal(), 2));
|
176 |
+
Mage::getSingleton('core/session')->setData('woopra_checkout_success_order_weight', round($order->getWeight(), 2));
|
177 |
+
Mage::getSingleton('core/session')->setData('woopra_checkout_success_shipping_amount', round($order->getShippingAmount(), 2));
|
178 |
+
Mage::getSingleton('core/session')->setData('woopra_checkout_success_shipping_description', addslashes($order->getShippingDescription()));
|
179 |
+
Mage::getSingleton('core/session')->setData('woopra_checkout_success_total_items_ordered', round($order->getTotalQtyOrdered(), 0));
|
180 |
+
$items = $order->getAllVisibleItems();
|
181 |
+
foreach ($items as $itemId => $item)
|
182 |
+
{
|
183 |
+
$cost = $cost + Mage::getModel('catalog/product')->load($item->getProductId())->getData('cost');
|
184 |
+
}
|
185 |
+
$profit = $order->getSubtotal() - $cost;
|
186 |
+
if ($cost != 0)
|
187 |
+
{
|
188 |
+
Mage::getSingleton('core/session')->setData('woopra_checkout_success_profit', round($profit, 2));
|
189 |
+
}
|
190 |
+
//Mage::log($order, null, 'woopra.log');
|
191 |
}
|
|
|
192 |
}
|
193 |
|
194 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'catalogsearch_result_index' && Mage::helper('woopra')->getCatalogSearch() != NULL)
|
195 |
{
|
196 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
197 |
+
if ($request) {
|
198 |
+
Mage::getSingleton('core/session')->setData('woopra_search_trigger', 1);
|
199 |
+
Mage::getSingleton('core/session')->setData('woopra_search_keywords', addslashes($request['q']));
|
200 |
+
//Mage::log($request['q'], null, 'woopra.log');
|
201 |
+
}
|
202 |
}
|
203 |
|
204 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'catalogsearch_advanced_result' && Mage::helper('woopra')->getCatalogSearch() != NULL)
|
205 |
{
|
206 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
207 |
+
if ($request) {
|
208 |
+
foreach ($request as $key => $answer) {
|
209 |
+
if (is_array($answer) == true) {
|
210 |
+
foreach ($answer as $subkey => $subanswer) {
|
211 |
+
$subtotal = $subtotal." ".$subkey.":".$subanswer;
|
212 |
+
$answer = $subtotal;
|
213 |
+
}
|
214 |
+
$subtotal = NULL;
|
215 |
}
|
216 |
+
$search_keywords = $search_keywords." | ".$key.": ".$answer;
|
217 |
}
|
218 |
+
Mage::getSingleton('core/session')->setData('woopra_search_trigger', 1);
|
219 |
+
Mage::getSingleton('core/session')->setData('woopra_search_keywords', addslashes($search_keywords));
|
220 |
+
//Mage::log($search_keywords, null, 'woopra.log');
|
221 |
}
|
|
|
|
|
|
|
222 |
}
|
223 |
|
224 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'review_product_list' && Mage::helper('woopra')->getProductReviewRead() != NULL)
|
225 |
{
|
226 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
227 |
+
if ($request) {
|
228 |
+
$product = Mage::getModel('catalog/product')->load($request['id'])->getData();
|
229 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_trigger', 1);
|
230 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_status', Mage::helper('woopra')->getProductReviewRead());
|
231 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_name', addslashes($product['name']));
|
232 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_sku', addslashes($product['sku']));
|
233 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_price', round($product['price'], 2));
|
234 |
+
//Mage::log($product['name']." | ".$product['sku']." | ".round($product['price'], 2), null, 'woopra.log');
|
235 |
+
}
|
236 |
}
|
237 |
|
238 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'review_product_post' && Mage::helper('woopra')->getProductReviewPosted() != NULL)
|
239 |
{
|
240 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
241 |
+
if ($request) {
|
242 |
+
$product = Mage::getModel('catalog/product')->load($request['id'])->getData();
|
243 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_trigger', 1);
|
244 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_status', Mage::helper('woopra')->getProductReviewPosted());
|
245 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_name', addslashes($product['name']));
|
246 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_sku', addslashes($product['sku']));
|
247 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_price', round($product['price'], 2));
|
248 |
+
Mage::getSingleton('core/session')->setData('woopra_product_review_trigger', 1);
|
249 |
+
Mage::getSingleton('core/session')->setData('woopra_product_review_nickname', addslashes($request['nickname']));
|
250 |
+
Mage::getSingleton('core/session')->setData('woopra_product_review_title', addslashes($request['title']));
|
251 |
+
Mage::getSingleton('core/session')->setData('woopra_product_review_detail', addslashes($request['detail']));
|
252 |
+
//Mage::log($product['name']." | ".$product['sku']." | ".round($product['price'], 2)." | ".$request['nickname']." | ".$request['title']." | ".$request['detail'], null, 'woopra.log');
|
253 |
+
}
|
254 |
}
|
255 |
|
256 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'customer_account_forgotpasswordpost' && Mage::helper('woopra')->getForgotPassword() != NULL)
|
257 |
{
|
258 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
259 |
+
Mage::getSingleton('core/session')->setData('woopra_forgot_password_trigger', 1);
|
260 |
+
if ($request) {
|
261 |
+
Mage::getSingleton('core/session')->setData('woopra_forgot_password_email', $request['email']);
|
262 |
+
//Mage::log($request['email'], null, 'woopra.log');
|
263 |
+
}
|
264 |
}
|
265 |
|
266 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'customer_account_editPost' && Mage::helper('woopra')->getChangedPassword() != NULL)
|
267 |
{
|
268 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
269 |
if ($request['change_password'] == 1 && $request['current_password'] != $request['password']) {
|
272 |
//Mage::log($request, null, 'woopra.log');
|
273 |
}
|
274 |
|
275 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'tag_index_save' && Mage::helper('woopra')->getProductTagAdded() != NULL)
|
276 |
{
|
277 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
278 |
+
if ($request) {
|
279 |
+
$product = Mage::getModel('catalog/product')->load($request['product'])->getData();
|
280 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_trigger', 1);
|
281 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_status', Mage::helper('woopra')->getProductTagAdded());
|
282 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_name', addslashes($product['name']));
|
283 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_sku', addslashes($product['sku']));
|
284 |
+
Mage::getSingleton('core/session')->setData('woopra_cart_wishlist_price', round($product['price'], 2));
|
285 |
+
Mage::getSingleton('core/session')->setData('woopra_product_tag_added_trigger', 1);
|
286 |
+
Mage::getSingleton('core/session')->setData('woopra_product_tag_name', addslashes($request['productTagName']));
|
287 |
+
//Mage::log($product['name']." | ".$product['sku']." | ".round($product['price'], 2)." | ".$request['productTagName'], null, 'woopra.log');
|
288 |
+
}
|
289 |
}
|
290 |
|
291 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_couponPost' && Mage::helper('woopra')->getCouponCodeAdded() != NULL)
|
292 |
{
|
293 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
294 |
+
if ($request) {
|
295 |
+
$coupon_id = Mage::getModel('salesrule/coupon')->load($request['coupon_code'], 'code');
|
296 |
+
Mage::getSingleton('core/session')->setData('woopra_coupon_code_trigger', 1);
|
297 |
+
if ($request['remove'] == 1) {
|
298 |
+
Mage::getSingleton('core/session')->setData('woopra_coupon_code_status', Mage::helper('woopra')->getCouponCodeRemoved());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
} else {
|
300 |
+
Mage::getSingleton('core/session')->setData('woopra_coupon_code_status', Mage::helper('woopra')->getCouponCodeAdded());
|
301 |
+
//Mage::log($coupon_id->getData(), null, 'woopra.log');
|
302 |
+
}
|
303 |
+
if ($coupon_id['coupon_id'] != null) {
|
304 |
+
$coupon_rules = Mage::getModel('salesrule/rule')->load($coupon_id->getRuleId());
|
305 |
+
Mage::getSingleton('core/session')->setData('woopra_coupon_code_validity', 'valid');
|
306 |
+
Mage::getSingleton('core/session')->setData('woopra_coupon_code_name', addslashes($coupon_rules->getData('name')));
|
307 |
+
//Mage::log($coupon_rules->getData(), null, 'woopra.log');
|
308 |
+
if ($coupon_rules->getData('is_active') == 1) {
|
309 |
+
Mage::getSingleton('core/session')->setData('woopra_coupon_code_active', 'active');
|
310 |
+
//Mage::log($coupon_rules->getData('is_active').' | = active', null, 'woopra.log');
|
311 |
+
} else {
|
312 |
+
Mage::getSingleton('core/session')->setData('woopra_coupon_code_active', 'inactive');
|
313 |
+
//Mage::log($coupon_rules->getData('is_active').' | = inactive', null, 'woopra.log');
|
314 |
+
}
|
315 |
+
} else {
|
316 |
+
Mage::getSingleton('core/session')->setData('woopra_coupon_code_validity', 'invalid');
|
317 |
+
Mage::getSingleton('core/session')->setData('woopra_coupon_code_name', '-');
|
318 |
+
Mage::getSingleton('core/session')->setData('woopra_coupon_code_active', '-');
|
319 |
+
}
|
320 |
+
Mage::getSingleton('core/session')->setData('woopra_coupon_code', addslashes($request['coupon_code']));
|
321 |
+
//Mage::log($observer, null, 'woopra.log');
|
322 |
}
|
|
|
|
|
323 |
}
|
324 |
|
325 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'customer_account_create' && Mage::helper('woopra')->getCustomerCreateAccount() != NULL)
|
326 |
{
|
327 |
Mage::getSingleton('core/session')->setData('woopra_create_account_trigger', 1);
|
328 |
//Mage::log('Create account started.', null, 'woopra.log');
|
329 |
}
|
330 |
|
331 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'customer_account_createpost' && Mage::helper('woopra')->getCustomerCreateAccount() != NULL)
|
332 |
{
|
333 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
334 |
Mage::getSingleton('core/session')->setData('woopra_create_account_success_trigger', 1);
|
335 |
+
if ($request['is_subscribed'] == 1) {
|
336 |
Mage::getSingleton('core/session')->setData('woopra_subscriber_changed', 1);
|
337 |
Mage::getSingleton('core/session')->setData('woopra_subscriber_status', Mage::helper('woopra')->getNewsletterSubscribed());
|
338 |
Mage::getSingleton('core/session')->setData('woopra_subscriber_email', $request[email]);
|
340 |
//Mage::log($request, null, 'woopra.log');
|
341 |
}
|
342 |
|
343 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_estimatePost' && Mage::helper('woopra')->getEstimatePost() != NULL)
|
344 |
{
|
345 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
346 |
+
if ($request) {
|
347 |
+
$region = Mage::getModel('directory/region')->load($request['region_id']);
|
348 |
+
Mage::getSingleton('core/session')->setData('woopra_estimate_post_trigger', 1);
|
349 |
+
Mage::getSingleton('core/session')->setData('woopra_estimate_post_country', $request['country_id']);
|
350 |
+
Mage::getSingleton('core/session')->setData('woopra_estimate_post_state', $region->getName());
|
351 |
+
Mage::getSingleton('core/session')->setData('woopra_estimate_post_zip', $request['estimate_postcode']);
|
352 |
+
//Mage::log($request['country_id']." | ".$region->getName()." | ".$request['estimate_postcode'], null, 'woopra.log');
|
353 |
+
}
|
354 |
}
|
355 |
|
356 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'cms_index_noRoute' && Mage::helper('woopra')->getCmsNoRoute() != NULL)
|
357 |
{
|
358 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getOriginalPathInfo();
|
359 |
Mage::getSingleton('core/session')->setData('woopra_cms_noroute_trigger', 1);
|
360 |
+
if ($request) {
|
361 |
+
Mage::getSingleton('core/session')->setData('woopra_cms_noroute_path', $request);
|
362 |
+
//Mage::log($request, null, 'woopra.log');
|
363 |
+
}
|
364 |
}
|
365 |
|
366 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'poll_vote_add' && Mage::helper('woopra')->getPollVote() != NULL)
|
367 |
{
|
368 |
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
369 |
+
if ($request) {
|
370 |
+
$poll_title = Mage::getModel('poll/poll')->load($request['poll_id'])->getData();
|
371 |
+
$poll_answers = Mage::getResourceModel('poll/poll_answer_collection')->addPollFilter($request['poll_id'])->getData();
|
372 |
+
foreach ($poll_answers as $key => $answer) {
|
373 |
+
if ($answer['answer_id'] == $request['vote']) {
|
374 |
+
$answer_title = $answer['answer_title'];
|
375 |
+
}
|
376 |
}
|
377 |
+
Mage::getSingleton('core/session')->setData('woopra_poll_vote_trigger', 1);
|
378 |
+
Mage::getSingleton('core/session')->setData('woopra_poll_vote_title', addslashes($poll_title['poll_title']));
|
379 |
+
Mage::getSingleton('core/session')->setData('woopra_poll_vote_answer', addslashes($answer_title));
|
380 |
+
//Mage::log($poll_title['poll_title']." | ".$answer_title, null, 'woopra.log');
|
381 |
}
|
|
|
|
|
|
|
|
|
382 |
}
|
383 |
+
|
384 |
+
/* Send tracking events during checkout using HTTP Tracking API - Coming One Day(TM)
|
385 |
+
if ($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_onepage_progress')
|
386 |
+
{
|
387 |
+
function sendTracking($event) {
|
388 |
+
$customer = Mage::getSingleton('customer/session');
|
389 |
+
$visitor = Mage::getSingleton('core/session')->getVisitorData();
|
390 |
+
$url = 'host='.Mage::helper('woopra')->getHostname();
|
391 |
+
$url .= '&cookie='.$visitor[session_id];
|
392 |
+
$url .= '&ip='.$visitor[http_host];
|
393 |
+
$url .= '&browser='.$visitor[http_user_agent];
|
394 |
+
$url .= '&event='.$event;
|
395 |
+
$url .= '&cv_name='.$customer->getName();
|
396 |
+
$url .= '&cv_email='.$customer->getEmail();
|
397 |
+
//Mage::log(urlencode($url), null, 'woopra.log');
|
398 |
+
$curl = new Varien_Http_Adapter_Curl();
|
399 |
+
$curl->setConfig(array('timeout' => 10));
|
400 |
+
$curl->write(Zend_Http_Client::GET, 'http://www.woopra.com/track/ce/?'.urlencode($url));
|
401 |
+
//Mage::log($curl->read(), null, 'woopra.log');
|
402 |
+
}
|
403 |
+
|
404 |
+
$request = $observer->getEvent()->getControllerAction()->getRequest()->getParams();
|
405 |
+
switch ($request[toStep]) {
|
406 |
+
case 'checkout_onepage_index':
|
407 |
+
Mage::log("BILLING", null, 'woopra.log');
|
408 |
+
sendTracking("checkout_billing_address");
|
409 |
+
break;
|
410 |
+
case 'billing':
|
411 |
+
Mage::log("BILLING", null, 'woopra.log');
|
412 |
+
sendTracking("checkout_billing_address");
|
413 |
+
break;
|
414 |
+
case 'shipping':
|
415 |
+
Mage::log("SHIPPING", null, 'woopra.log');
|
416 |
+
sendTracking("checkout_shipping_address");
|
417 |
+
break;
|
418 |
+
case 'shipping_method':
|
419 |
+
Mage::log("SHIPPING METHOD", null, 'woopra.log');
|
420 |
+
sendTracking("checkout_shipping_method");
|
421 |
+
break;
|
422 |
+
case 'payment':
|
423 |
+
Mage::log("PAYMENT", null, 'woopra.log');
|
424 |
+
sendTracking("checkout_payment_method");
|
425 |
+
break;
|
426 |
+
case 'review':
|
427 |
+
Mage::log("REVIEW", null, 'woopra.log');
|
428 |
+
sendTracking("checkout_review");
|
429 |
+
break;
|
430 |
+
}
|
431 |
+
}*/
|
432 |
}
|
433 |
}
|
434 |
?>
|
app/code/community/Woopra/Analytics/etc/config.xml
CHANGED
@@ -65,7 +65,9 @@
|
|
65 |
<woopra>
|
66 |
<enabled>1</enabled>
|
67 |
<hostname></hostname>
|
68 |
-
<
|
|
|
|
|
69 |
<test>0</test>
|
70 |
</woopra>
|
71 |
<woopra_advanced>
|
@@ -82,6 +84,8 @@
|
|
82 |
<download_tracking_pause></download_tracking_pause>
|
83 |
<outgoing_tracking>1</outgoing_tracking>
|
84 |
<outgoing_tracking_pause></outgoing_tracking_pause>
|
|
|
|
|
85 |
</woopra_advanced>
|
86 |
<woopra_outputs>
|
87 |
<name>name</name>
|
@@ -126,6 +130,7 @@
|
|
126 |
<product_removed_from_compare>product_removed_from_compare</product_removed_from_compare>
|
127 |
<product_added_to_wishlist>product_added_to_wishlist</product_added_to_wishlist>
|
128 |
<product_removed_from_wishlist>product_removed_from_wishlist</product_removed_from_wishlist>
|
|
|
129 |
<product_tag_added>product_tag_added</product_tag_added>
|
130 |
<product_review_read>product_review_read</product_review_read>
|
131 |
<product_review_posted>product_review_posted</product_review_posted>
|
65 |
<woopra>
|
66 |
<enabled>1</enabled>
|
67 |
<hostname></hostname>
|
68 |
+
<app_id></app_id>
|
69 |
+
<secret_key></secret_key>
|
70 |
+
<!--<schema_update></schema_update>-->
|
71 |
<test>0</test>
|
72 |
</woopra>
|
73 |
<woopra_advanced>
|
84 |
<download_tracking_pause></download_tracking_pause>
|
85 |
<outgoing_tracking>1</outgoing_tracking>
|
86 |
<outgoing_tracking_pause></outgoing_tracking_pause>
|
87 |
+
<outgoing_ignore_subdomain>1</outgoing_ignore_subdomain>
|
88 |
+
<hide_campaign></hide_campaign>
|
89 |
</woopra_advanced>
|
90 |
<woopra_outputs>
|
91 |
<name>name</name>
|
130 |
<product_removed_from_compare>product_removed_from_compare</product_removed_from_compare>
|
131 |
<product_added_to_wishlist>product_added_to_wishlist</product_added_to_wishlist>
|
132 |
<product_removed_from_wishlist>product_removed_from_wishlist</product_removed_from_wishlist>
|
133 |
+
<product_purchased>product_purchased</product_purchased>
|
134 |
<product_tag_added>product_tag_added</product_tag_added>
|
135 |
<product_review_read>product_review_read</product_review_read>
|
136 |
<product_review_posted>product_review_posted</product_review_posted>
|
app/code/community/Woopra/Analytics/etc/system.xml
CHANGED
@@ -53,21 +53,41 @@
|
|
53 |
<show_in_website>1</show_in_website>
|
54 |
<show_in_store>1</show_in_store>
|
55 |
</hostname>
|
56 |
-
|
57 |
-
<label>Woopra
|
58 |
-
<comment>Your
|
59 |
<frontend_type>text</frontend_type>
|
60 |
<validate>validate-alphanum</validate>
|
61 |
<sort_order>30</sort_order>
|
62 |
<show_in_default>1</show_in_default>
|
63 |
<show_in_website>1</show_in_website>
|
64 |
<show_in_store>1</show_in_store>
|
65 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
<test translate="label">
|
67 |
<label>Show Test Alert</label>
|
68 |
<frontend_type>select</frontend_type>
|
69 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
70 |
-
<sort_order>
|
71 |
<show_in_default>1</show_in_default>
|
72 |
<show_in_website>1</show_in_website>
|
73 |
<show_in_store>1</show_in_store>
|
@@ -84,8 +104,8 @@
|
|
84 |
<expanded>0</expanded>
|
85 |
<fields>
|
86 |
<subdomain translate="label">
|
87 |
-
<label>Subdomain
|
88 |
-
<comment>Enter subdomain
|
89 |
<frontend_type>text</frontend_type>
|
90 |
<sort_order>5</sort_order>
|
91 |
<show_in_default>1</show_in_default>
|
@@ -114,7 +134,7 @@
|
|
114 |
</track_url_parameters>
|
115 |
<tracking_cookie_expiration translate="label">
|
116 |
<label>Tracking Cookie Expiration</label>
|
117 |
-
<comment>The tracking cookie expiration in days (Default:
|
118 |
<frontend_type>text</frontend_type>
|
119 |
<validate>validate-digits</validate>
|
120 |
<sort_order>30</sort_order>
|
@@ -124,7 +144,7 @@
|
|
124 |
</tracking_cookie_expiration>
|
125 |
<tracking_cookie_name translate="label">
|
126 |
<label>Tracking Cookie Name</label>
|
127 |
-
<comment>Change the name of the cookie stored by Woopra (Default:
|
128 |
<frontend_type>text</frontend_type>
|
129 |
<sort_order>40</sort_order>
|
130 |
<show_in_default>1</show_in_default>
|
@@ -209,6 +229,26 @@
|
|
209 |
<show_in_website>1</show_in_website>
|
210 |
<show_in_store>1</show_in_store>
|
211 |
</outgoing_tracking_pause>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
</fields>
|
213 |
</woopra_advanced>
|
214 |
<woopra_outputs translate="label" module="woopra">
|
@@ -593,6 +633,15 @@
|
|
593 |
<show_in_website>1</show_in_website>
|
594 |
<show_in_store>1</show_in_store>
|
595 |
</product_removed_from_wishlist>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
596 |
<product_tag_added translate="label">
|
597 |
<label>Product Tag Added</label>
|
598 |
<comment>Product tag added event tracking name (empty to disable).</comment>
|
53 |
<show_in_website>1</show_in_website>
|
54 |
<show_in_store>1</show_in_store>
|
55 |
</hostname>
|
56 |
+
<!--<app_id translate="label">
|
57 |
+
<label>Woopra App ID</label>
|
58 |
+
<comment>Your App ID can be found on woopra.com under My Websites -> Setup -> Access Keys.</comment>
|
59 |
<frontend_type>text</frontend_type>
|
60 |
<validate>validate-alphanum</validate>
|
61 |
<sort_order>30</sort_order>
|
62 |
<show_in_default>1</show_in_default>
|
63 |
<show_in_website>1</show_in_website>
|
64 |
<show_in_store>1</show_in_store>
|
65 |
+
</app_id>
|
66 |
+
<secret_key translate="label">
|
67 |
+
<label>Woopra Secret Key</label>
|
68 |
+
<comment>Your Secret Key can be found on woopra.com under My Websites -> Setup -> Access Keys.</comment>
|
69 |
+
<frontend_type>text</frontend_type>
|
70 |
+
<validate>validate-alphanum</validate>
|
71 |
+
<sort_order>40</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>1</show_in_store>
|
75 |
+
</secret_key>
|
76 |
+
<schema_update translate="label">
|
77 |
+
<label>Schema Update</label>
|
78 |
+
<comment>Run schema update one time after install. Note: Requires App ID and Secret Key.</comment>
|
79 |
+
<frontend_type>button</frontend_type>
|
80 |
+
<frontend_model>woopra/button</frontend_model>
|
81 |
+
<sort_order>50</sort_order>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>1</show_in_website>
|
84 |
+
<show_in_store>1</show_in_store>
|
85 |
+
</schema_update>-->
|
86 |
<test translate="label">
|
87 |
<label>Show Test Alert</label>
|
88 |
<frontend_type>select</frontend_type>
|
89 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
90 |
+
<sort_order>60</sort_order>
|
91 |
<show_in_default>1</show_in_default>
|
92 |
<show_in_website>1</show_in_website>
|
93 |
<show_in_store>1</show_in_store>
|
104 |
<expanded>0</expanded>
|
105 |
<fields>
|
106 |
<subdomain translate="label">
|
107 |
+
<label>Subdomain </label>
|
108 |
+
<comment>Enter subdomain to track (ie: subdomain).</comment>
|
109 |
<frontend_type>text</frontend_type>
|
110 |
<sort_order>5</sort_order>
|
111 |
<show_in_default>1</show_in_default>
|
134 |
</track_url_parameters>
|
135 |
<tracking_cookie_expiration translate="label">
|
136 |
<label>Tracking Cookie Expiration</label>
|
137 |
+
<comment>The tracking cookie expiration in days (Default: 730)</comment>
|
138 |
<frontend_type>text</frontend_type>
|
139 |
<validate>validate-digits</validate>
|
140 |
<sort_order>30</sort_order>
|
144 |
</tracking_cookie_expiration>
|
145 |
<tracking_cookie_name translate="label">
|
146 |
<label>Tracking Cookie Name</label>
|
147 |
+
<comment>Change the name of the cookie stored by Woopra (Default: wooTracker)</comment>
|
148 |
<frontend_type>text</frontend_type>
|
149 |
<sort_order>40</sort_order>
|
150 |
<show_in_default>1</show_in_default>
|
229 |
<show_in_website>1</show_in_website>
|
230 |
<show_in_store>1</show_in_store>
|
231 |
</outgoing_tracking_pause>
|
232 |
+
<outgoing_ignore_subdomain translate="label">
|
233 |
+
<label>Outgoing Ignore Subdomain</label>
|
234 |
+
<comment>Do not include links to subdomains as outgoing links (Default: Enable)</comment>
|
235 |
+
<frontend_type>select</frontend_type>
|
236 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
237 |
+
<sort_order>125</sort_order>
|
238 |
+
<show_in_default>1</show_in_default>
|
239 |
+
<show_in_website>1</show_in_website>
|
240 |
+
<show_in_store>1</show_in_store>
|
241 |
+
</outgoing_ignore_subdomain>
|
242 |
+
<hide_campaign translate="label">
|
243 |
+
<label>Hide Campaign</label>
|
244 |
+
<comment>Enabling this option will remove campaign properties from the URL when they’re captured (Default: Disabled)</comment>
|
245 |
+
<frontend_type>select</frontend_type>
|
246 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
247 |
+
<sort_order>130</sort_order>
|
248 |
+
<show_in_default>1</show_in_default>
|
249 |
+
<show_in_website>1</show_in_website>
|
250 |
+
<show_in_store>1</show_in_store>
|
251 |
+
</hide_campaign>
|
252 |
</fields>
|
253 |
</woopra_advanced>
|
254 |
<woopra_outputs translate="label" module="woopra">
|
633 |
<show_in_website>1</show_in_website>
|
634 |
<show_in_store>1</show_in_store>
|
635 |
</product_removed_from_wishlist>
|
636 |
+
<product_purchased translate="label">
|
637 |
+
<label>Product Purchased</label>
|
638 |
+
<comment>Product purchased name (empty to disable).</comment>
|
639 |
+
<frontend_type>text</frontend_type>
|
640 |
+
<sort_order>245</sort_order>
|
641 |
+
<show_in_default>1</show_in_default>
|
642 |
+
<show_in_website>1</show_in_website>
|
643 |
+
<show_in_store>1</show_in_store>
|
644 |
+
</product_purchased>
|
645 |
<product_tag_added translate="label">
|
646 |
<label>Product Tag Added</label>
|
647 |
<comment>Product tag added event tracking name (empty to disable).</comment>
|
app/design/frontend/base/default/layout/woopra.xml
CHANGED
@@ -14,5 +14,8 @@
|
|
14 |
<reference name="head">
|
15 |
<block type="woopra/script" name="woopra" as="woopra" template="woopra/script.phtml"/>
|
16 |
</reference>
|
|
|
|
|
|
|
17 |
</default>
|
18 |
</layout>
|
14 |
<reference name="head">
|
15 |
<block type="woopra/script" name="woopra" as="woopra" template="woopra/script.phtml"/>
|
16 |
</reference>
|
17 |
+
<reference name="before_body_end">
|
18 |
+
<block type="woopra/script" name="woopraCheckout" as="woopraCheckout" template="woopra/checkout.phtml"/>
|
19 |
+
</reference>
|
20 |
</default>
|
21 |
</layout>
|
app/design/frontend/base/default/template/woopra/checkout.phtml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Woopra Module for Magento
|
4 |
+
*
|
5 |
+
* @package Woopra_Analytics
|
6 |
+
* @author K3Live for Woopra
|
7 |
+
* @copyright Copyright (c) 2013 Woopra (http://www.woopra.com/)
|
8 |
+
* @license Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
?>
|
11 |
+
<?php if($this->getSetting('enabled')) { ?>
|
12 |
+
<!-- Start of Woopra Code -->
|
13 |
+
<?php if ($this->getSetting('woopra_checkout_trigger') == 1) { ?>
|
14 |
+
<script type="text/javascript">
|
15 |
+
//<![CDATA[
|
16 |
+
Checkout.prototype.gotoSection = function (section) {
|
17 |
+
woopra_action = section;
|
18 |
+
if (woopra_action == '')
|
19 |
+
woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutBillingAddress(); ?>';
|
20 |
+
else if (woopra_action == 'billing')
|
21 |
+
woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutBillingAddress(); ?>';
|
22 |
+
else if (woopra_action == 'shipping')
|
23 |
+
woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutShippingAddress(); ?>';
|
24 |
+
else if (woopra_action == 'shipping_method')
|
25 |
+
woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutShippingMethod(); ?>';
|
26 |
+
else if (woopra_action == 'payment')
|
27 |
+
woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutPaymentMethod(); ?>';
|
28 |
+
else if (woopra_action == 'review')
|
29 |
+
woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutReview(); ?>';
|
30 |
+
try {
|
31 |
+
woopra.track({
|
32 |
+
name: ''+woopra_action+''
|
33 |
+
});
|
34 |
+
} catch(err) { }
|
35 |
+
//section = $('opc-'+section);
|
36 |
+
//section.addClassName('allow');
|
37 |
+
//this.accordion.openSection(section);
|
38 |
+
|
39 |
+
this.currentStep = section;
|
40 |
+
var sectionElement = $('opc-' + section);
|
41 |
+
sectionElement.addClassName('allow');
|
42 |
+
this.accordion.openSection('opc-' + section);
|
43 |
+
this.reloadProgressBlock(section);
|
44 |
+
};
|
45 |
+
//]]>
|
46 |
+
</script>
|
47 |
+
<?php } ?>
|
48 |
+
<!-- End of Woopra Code -->
|
49 |
+
<?php } ?>
|
app/design/frontend/base/default/template/woopra/script.phtml
CHANGED
@@ -9,39 +9,10 @@
|
|
9 |
*/
|
10 |
?>
|
11 |
<?php if($this->getSetting('enabled')) { ?>
|
12 |
-
|
13 |
<!-- Start of Woopra Code -->
|
14 |
-
<?php if ($this->getSetting('woopra_checkout_trigger') == 1) { ?>
|
15 |
<script type="text/javascript">
|
16 |
-
|
17 |
-
|
18 |
-
if (woopra_action == '')
|
19 |
-
woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutBillingAddress(); ?>';
|
20 |
-
else if (woopra_action == 'billing')
|
21 |
-
woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutBillingAddress(); ?>';
|
22 |
-
else if (woopra_action == 'shipping')
|
23 |
-
woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutShippingAddress(); ?>';
|
24 |
-
else if (woopra_action == 'shipping_method')
|
25 |
-
woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutShippingMethod(); ?>';
|
26 |
-
else if (woopra_action == 'payment')
|
27 |
-
woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutPaymentMethod(); ?>';
|
28 |
-
else if (woopra_action == 'review')
|
29 |
-
woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutReview(); ?>';
|
30 |
-
try {
|
31 |
-
woopra.track({
|
32 |
-
name: ''+woopra_action+''
|
33 |
-
});
|
34 |
-
} catch(err) { }
|
35 |
-
section = $('opc-'+section);
|
36 |
-
section.addClassName('allow');
|
37 |
-
this.accordion.openSection(section);
|
38 |
-
};
|
39 |
-
</script>
|
40 |
-
<?php } ?>
|
41 |
-
<script type="text/javascript">
|
42 |
-
(function(){
|
43 |
-
var t,i,e,n=window,o=document,a=arguments,s="script",r=["config","track","identify","visit","push","call"],c=function(){var t,i=this;for(i._e=[],t=0;r.length>t;t++)(function(t){i[t]=function(){return i._e.push([t].concat(Array.prototype.slice.call(arguments,0))),i}})(r[t])};for(n._w=n._w||{},t=0;a.length>t;t++)n._w[a[t]]=n[a[t]]=n[a[t]]||new c;i=o.createElement(s),i.async=1,i.src="//static.woopra.com/js/w.js",e=o.getElementsByTagName(s)[0],e.parentNode.insertBefore(i,e)
|
44 |
-
})("woopra");
|
45 |
woopra.config('app', 'magento');
|
46 |
<?php if ($this->getSetting('tracking_cookie_expiration') != NULL) { ?> var expires = new Date();<?php echo "\n"; ?>
|
47 |
expires.setDate(expires.getDate() + <?php echo $this->getSetting('tracking_cookie_expiration'); ?>);
|
@@ -55,11 +26,13 @@ var t,i,e,n=window,o=document,a=arguments,s="script",r=["config","track","identi
|
|
55 |
<?php if ($this->getSetting('download_tracking_pause') != NULL && $this->getSetting('download_tracking') == 1) { ?> woopra.config('download_pause', <?php echo $this->getSetting('download_tracking_pause'); ?>);<?php echo "\n"; } ?>
|
56 |
<?php if ($this->getSetting('outgoing_tracking') == 0) { ?> woopra.config('outgoing_tracking', false);<?php echo "\n"; } ?>
|
57 |
<?php if ($this->getSetting('outgoing_tracking_pause') != NULL && $this->getSetting('outgoing_tracking') == 1) { ?> woopra.config('outgoing_pause', <?php echo $this->getSetting('outgoing_tracking_pause'); ?>);<?php echo "\n"; } ?>
|
|
|
|
|
58 |
<?php if ($this->getSetting('hostname') != NULL) { ?> woopra.config('domain', '<?php echo $this->getSetting('hostname'); ?>');<?php echo "\n"; ?>
|
59 |
<?php } else { ?> woopra.config('domain', '<?php echo $this->getSetting('url'); ?>');<?php echo "\n"; } ?>
|
60 |
<?php if ($this->getSetting('visitor_timeout') != NULL) { ?> woopra.config('idle_timeout', <?php echo $this->getSetting('visitor_timeout') * 60 * 1000; ?>);<?php echo "\n"; ?>
|
61 |
<?php } else { ?> woopra.config('idle_timeout', 1800000);<?php echo "\n"; } ?>
|
62 |
-
<?php if ($this->getSetting('subdomain') != NULL) { ?> woopra.
|
63 |
<?php if ($this->getSetting('customer_name') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerName(); ?>', '<?php echo $this->getSetting('customer_name'); ?>');<?php echo "\n"; } ?>
|
64 |
<?php if ($this->getSetting('customer_email') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerEmail(); ?>', '<?php echo $this->getSetting('customer_email'); ?>');<?php echo "\n"; } ?>
|
65 |
<?php if ($this->getSetting('customer_company') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerCompany(); ?>', '<?php echo $this->getSetting('customer_company'); ?>');<?php echo "\n"; } ?>
|
@@ -93,7 +66,12 @@ var t,i,e,n=window,o=document,a=arguments,s="script",r=["config","track","identi
|
|
93 |
name: '<?php echo $this->getSetting('woopra_subscriber_status'); ?>',
|
94 |
email: '<?php echo $this->getSetting('woopra_subscriber_email'); ?>'
|
95 |
<?php echo " });\n"; } ?>
|
96 |
-
<?php if ($this->getSetting('woopra_contacts_index_post') == 1) { ?>
|
|
|
|
|
|
|
|
|
|
|
97 |
name: '<?php echo Mage::helper('woopra')->getContactFormSent(); ?>',
|
98 |
customer_name: '<?php echo $this->getSetting('woopra_contacts_name'); ?>',
|
99 |
customer_email: '<?php echo $this->getSetting('woopra_contacts_email'); ?>',
|
@@ -158,8 +136,25 @@ var t,i,e,n=window,o=document,a=arguments,s="script",r=["config","track","identi
|
|
158 |
shipping_method: '<?php echo $this->getSetting('woopra_checkout_success_shipping_description'); ?>',
|
159 |
total_items_ordered: '<?php echo $this->getSetting('woopra_checkout_success_total_items_ordered'); ?>'
|
160 |
<?php echo " });\n"; } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
</script>
|
162 |
-
|
163 |
<?php if($this->getSetting('test')) { ?>
|
164 |
<script type="text/javascript">
|
165 |
alert('Woopra module is correctly installed, you can safely turn off the test alert.\n' +
|
@@ -177,6 +172,7 @@ var t,i,e,n=window,o=document,a=arguments,s="script",r=["config","track","identi
|
|
177 |
'Cart Total: <?php echo $this->getSetting('customer_cart_total'); ?>\n' +
|
178 |
'Wishlist Items: <?php echo $this->getSetting('customer_wishlist_items'); ?>\n' +
|
179 |
'Wishlist Total: <?php echo $this->getSetting('customer_wishlist_total'); ?>\n');
|
|
|
180 |
</script><?php } ?>
|
181 |
<!-- End of Woopra Code -->
|
182 |
<?php } ?>
|
9 |
*/
|
10 |
?>
|
11 |
<?php if($this->getSetting('enabled')) { ?>
|
|
|
12 |
<!-- Start of Woopra Code -->
|
|
|
13 |
<script type="text/javascript">
|
14 |
+
//<![CDATA[
|
15 |
+
!function(){var a,b,c,d=window,e=document,f=arguments,g="script",h=["config","track","trackForm","trackClick","identify","visit","push","call"],i=function(){var a,b=this,c=function(a){b[a]=function(){return b._e.push([a].concat(Array.prototype.slice.call(arguments,0))),b}};for(b._e=[],a=0;a<h.length;a++)c(h[a])};for(d.__woo=d.__woo||{},a=0;a<f.length;a++)d.__woo[f[a]]=d[f[a]]=d[f[a]]||new i;b=e.createElement(g),b.async=1,b.src="//static.woopra.com/js/w.js",c=e.getElementsByTagName(g)[0],c.parentNode.insertBefore(b,c)}("woopra");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
woopra.config('app', 'magento');
|
17 |
<?php if ($this->getSetting('tracking_cookie_expiration') != NULL) { ?> var expires = new Date();<?php echo "\n"; ?>
|
18 |
expires.setDate(expires.getDate() + <?php echo $this->getSetting('tracking_cookie_expiration'); ?>);
|
26 |
<?php if ($this->getSetting('download_tracking_pause') != NULL && $this->getSetting('download_tracking') == 1) { ?> woopra.config('download_pause', <?php echo $this->getSetting('download_tracking_pause'); ?>);<?php echo "\n"; } ?>
|
27 |
<?php if ($this->getSetting('outgoing_tracking') == 0) { ?> woopra.config('outgoing_tracking', false);<?php echo "\n"; } ?>
|
28 |
<?php if ($this->getSetting('outgoing_tracking_pause') != NULL && $this->getSetting('outgoing_tracking') == 1) { ?> woopra.config('outgoing_pause', <?php echo $this->getSetting('outgoing_tracking_pause'); ?>);<?php echo "\n"; } ?>
|
29 |
+
<?php if ($this->getSetting('outgoing_ignore_subdomain') == 0) { ?> woopra.config('outgoing_ignore_subdomain', false);<?php echo "\n"; } ?>
|
30 |
+
<?php if ($this->getSetting('hide_campaign') == 1) { ?> woopra.config('hide_campaign', true);<?php echo "\n"; } ?>
|
31 |
<?php if ($this->getSetting('hostname') != NULL) { ?> woopra.config('domain', '<?php echo $this->getSetting('hostname'); ?>');<?php echo "\n"; ?>
|
32 |
<?php } else { ?> woopra.config('domain', '<?php echo $this->getSetting('url'); ?>');<?php echo "\n"; } ?>
|
33 |
<?php if ($this->getSetting('visitor_timeout') != NULL) { ?> woopra.config('idle_timeout', <?php echo $this->getSetting('visitor_timeout') * 60 * 1000; ?>);<?php echo "\n"; ?>
|
34 |
<?php } else { ?> woopra.config('idle_timeout', 1800000);<?php echo "\n"; } ?>
|
35 |
+
<?php if ($this->getSetting('subdomain') != NULL) { ?> woopra.identify('subdomain', '<?php echo $this->getSetting('subdomain'); ?>');<?php echo "\n"; } ?>
|
36 |
<?php if ($this->getSetting('customer_name') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerName(); ?>', '<?php echo $this->getSetting('customer_name'); ?>');<?php echo "\n"; } ?>
|
37 |
<?php if ($this->getSetting('customer_email') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerEmail(); ?>', '<?php echo $this->getSetting('customer_email'); ?>');<?php echo "\n"; } ?>
|
38 |
<?php if ($this->getSetting('customer_company') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerCompany(); ?>', '<?php echo $this->getSetting('customer_company'); ?>');<?php echo "\n"; } ?>
|
66 |
name: '<?php echo $this->getSetting('woopra_subscriber_status'); ?>',
|
67 |
email: '<?php echo $this->getSetting('woopra_subscriber_email'); ?>'
|
68 |
<?php echo " });\n"; } ?>
|
69 |
+
<?php if ($this->getSetting('woopra_contacts_index_post') == 1) { ?>
|
70 |
+
<?php if ($this->getSetting('customer_group') == "NOT LOGGED IN") { ?>
|
71 |
+
woopra.identify('<?php echo Mage::helper('woopra')->getCustomerName(); ?>', '<?php echo $this->getSetting('woopra_contacts_name'); ?>');<?php echo "\n"; ?>
|
72 |
+
woopra.identify('<?php echo Mage::helper('woopra')->getCustomerEmail(); ?>', '<?php echo $this->getSetting('woopra_contacts_email'); ?>');<?php echo "\n"; ?>
|
73 |
+
<?php } ?>
|
74 |
+
woopra.track({<?php echo "\n";?>
|
75 |
name: '<?php echo Mage::helper('woopra')->getContactFormSent(); ?>',
|
76 |
customer_name: '<?php echo $this->getSetting('woopra_contacts_name'); ?>',
|
77 |
customer_email: '<?php echo $this->getSetting('woopra_contacts_email'); ?>',
|
136 |
shipping_method: '<?php echo $this->getSetting('woopra_checkout_success_shipping_description'); ?>',
|
137 |
total_items_ordered: '<?php echo $this->getSetting('woopra_checkout_success_total_items_ordered'); ?>'
|
138 |
<?php echo " });\n"; } ?>
|
139 |
+
<?php if (Mage::helper('woopra')->getProductPurchased() != NULL && $this->getSetting('woopra_checkout_success_trigger') == 1) {
|
140 |
+
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
141 |
+
if ($lastOrderId) {
|
142 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($lastOrderId);
|
143 |
+
$items = $order->getAllVisibleItems();
|
144 |
+
foreach ($items as $itemId => $item)
|
145 |
+
{
|
146 |
+
$product_name = Mage::getModel('catalog/product')->load($item->getProductId())->getData('name');
|
147 |
+
$product_sku = Mage::getModel('catalog/product')->load($item->getProductId())->getData('sku');
|
148 |
+
$product_price = Mage::getModel('catalog/product')->load($item->getProductId())->getData('price');
|
149 |
+
?> woopra.track({<?php echo "\n";?>
|
150 |
+
name: '<?php echo Mage::helper('woopra')->getProductPurchased(); ?>',
|
151 |
+
product_name: '<?php echo $product_name; ?>',
|
152 |
+
product_sku: '<?php echo $product_sku; ?>',
|
153 |
+
product_price: '<?php echo $product_price; ?>',
|
154 |
+
product_qty: '<?php echo $item->getData('qty_ordered'); ?>'
|
155 |
+
<?php echo " });\n"; } ?>
|
156 |
+
<?php } }?>
|
157 |
</script>
|
|
|
158 |
<?php if($this->getSetting('test')) { ?>
|
159 |
<script type="text/javascript">
|
160 |
alert('Woopra module is correctly installed, you can safely turn off the test alert.\n' +
|
172 |
'Cart Total: <?php echo $this->getSetting('customer_cart_total'); ?>\n' +
|
173 |
'Wishlist Items: <?php echo $this->getSetting('customer_wishlist_items'); ?>\n' +
|
174 |
'Wishlist Total: <?php echo $this->getSetting('customer_wishlist_total'); ?>\n');
|
175 |
+
//]]>
|
176 |
</script><?php } ?>
|
177 |
<!-- End of Woopra Code -->
|
178 |
<?php } ?>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Woopra_Analytics_Event_And_Visitor_Tracking</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/OSL-3.0">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -19,15 +19,16 @@ Access custom reports instantly. No more bugging IT. No old-school interfaces. N
|
|
19 |
<a href="http://www.k3live.com/magento-extensions/magento-woopra-tracking"><img src="http://www.magentocommerce.com/magento-connect/media/catalog/product/w/o/woopra_tracking_5_1_1.png" /></a><br /><br />
|
20 |
Note: This module will not work without a subscription to the <a href="http://www.woopra.com/?woo_campaign=affiliate&woo_medium=referral&woo_source=k3live">Woopra</a> service.</description>
|
21 |
<notes>Updated javascript tracking code.
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
<
|
29 |
-
<
|
30 |
-
<
|
|
|
31 |
<compatible/>
|
32 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
33 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Woopra_Analytics_Event_And_Visitor_Tracking</name>
|
4 |
+
<version>1.2.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/OSL-3.0">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
19 |
<a href="http://www.k3live.com/magento-extensions/magento-woopra-tracking"><img src="http://www.magentocommerce.com/magento-connect/media/catalog/product/w/o/woopra_tracking_5_1_1.png" /></a><br /><br />
|
20 |
Note: This module will not work without a subscription to the <a href="http://www.woopra.com/?woo_campaign=affiliate&woo_medium=referral&woo_source=k3live">Woopra</a> service.</description>
|
21 |
<notes>Updated javascript tracking code.
|
22 |
+
Added tracking products purchased.
|
23 |
+
Added ignore subdomain config.
|
24 |
+
Split ajax checkout to footer with fix for one-page checkout.
|
25 |
+
Fixed newsletter subscribe.
|
26 |
+
Added error checking to prevent faults.
|
27 |
+
</notes>
|
28 |
+
<authors><author><name>Woopra</name><user>Woopra</user><email>support@woopra.com</email></author><author><name>K3Live</name><user>K3Live</user><email>support@k3live.com</email></author></authors>
|
29 |
+
<date>2014-05-14</date>
|
30 |
+
<time>23:21:43</time>
|
31 |
+
<contents><target name="magecommunity"><dir><dir name="Woopra"><dir name="Analytics"><dir name="Block"><file name="Script.php" hash="bb3b76276e028d9e11eac15b4adb07b1"/></dir><dir name="Helper"><file name="Data.php" hash="2a918bd8ba1c9094acc02dac8f933953"/></dir><dir name="Model"><file name="Observer.php" hash="1c315a62e5463209d1bb792982e055ea"/></dir><dir name="etc"><file name="config.xml" hash="852e6c9b1b5a1ff8d7474bad6dc52840"/><file name="system.xml" hash="90ebdc742914fe9ff990a39f27ef32e8"/></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="woopra.xml" hash="3f21344a558babd0d9ea0ed1edc6a87f"/></dir><dir name="template"><dir name="woopra"><file name="script.phtml" hash="2c9c55c9aa17d3b7f87f448636cef2b9"/><file name="checkout.phtml" hash="7123ef5e64ebb752aeecc6ea69f0264e"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Woopra_Analytics.xml" hash="a4715864833c0024017692871431cb91"/></dir></dir></target></contents>
|
32 |
<compatible/>
|
33 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
34 |
</package>
|