etracker_connect - Version 1.0.0

Version Notes

Initial Stable Version

Download this release

Release Info

Developer Magento Core Team
Extension etracker_connect
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Etracker/Etracker/Block/Catalog/Product/View/Media.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * justselling Germany Ltd. EULA
4
+ * http://www.justselling.de/
5
+ * Read the license at http://www.justselling.de/lizenz
6
+ *
7
+ * Do not edit or add to this file, please refer to http://www.justselling.de for more information.
8
+ *
9
+ * @category justselling
10
+ * @package justselling_etracker
11
+ * @copyright Copyright (c) 2013 justselling Germany Ltd. (http://www.justselling.de)
12
+ * @license http://www.justselling.de/lizenz
13
+ * @author Bodo Schulte
14
+ */
15
+ class Etracker_Etracker_Block_Catalog_Product_View_Media extends Mage_Catalog_Block_Product_View_Media {
16
+
17
+ /**
18
+ * To support version < 1.4.2 we add child block html on this way as we do not need to overwrite any template file.
19
+ * (This is a better solution and causes less problems together with other modules).
20
+ * @return string
21
+ */
22
+ protected function _toHtml() {
23
+ $html = parent::_toHtml();
24
+ return Etracker_Etracker_Helper_Data::getDynamicChildBlockHtml($this, $html, 'etracker_img');
25
+ }
26
+ }
app/code/community/Etracker/Etracker/Block/Checkout/Cart.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * justselling Germany Ltd. EULA
4
+ * http://www.justselling.de/
5
+ * Read the license at http://www.justselling.de/lizenz
6
+ *
7
+ * Do not edit or add to this file, please refer to http://www.justselling.de for more information.
8
+ *
9
+ * @category justselling
10
+ * @package justselling_etracker
11
+ * @copyright Copyright (c) 2013 justselling Germany Ltd. (http://www.justselling.de)
12
+ * @license http://www.justselling.de/lizenz
13
+ * @author Bodo Schulte
14
+ */
15
+ class Etracker_Etracker_Block_Checkout_Cart extends Mage_Checkout_Block_Cart {
16
+
17
+ /**
18
+ * To support version < 1.4.2 we add child block html on this way as we do not need to overwrite any template file.
19
+ * (This is a better solution and causes less problems together with other modules).
20
+ * @return string
21
+ */
22
+ protected function _toHtml() {
23
+ $html = parent::_toHtml();
24
+ return Etracker_Etracker_Helper_Data::getDynamicChildBlockHtml($this, $html, 'etracker_cart');
25
+ }
26
+ }
app/code/community/Etracker/Etracker/Block/Checkout/Onepage.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * justselling Germany Ltd. EULA
4
+ * http://www.justselling.de/
5
+ * Read the license at http://www.justselling.de/lizenz
6
+ *
7
+ * Do not edit or add to this file, please refer to http://www.justselling.de for more information.
8
+ *
9
+ * @category justselling
10
+ * @package justselling_etracker
11
+ * @copyright Copyright (c) 2013 justselling Germany Ltd. (http://www.justselling.de)
12
+ * @license http://www.justselling.de/lizenz
13
+ * @author Bodo Schulte
14
+ */
15
+ class Etracker_Etracker_Block_Checkout_Onepage extends Mage_Checkout_Block_Onepage {
16
+
17
+ /**
18
+ * To support version < 1.4.2 we add child block html on this way as we do not need to overwrite any template file.
19
+ * (This is a better solution and causes less problems together with other modules).
20
+ * @return string
21
+ */
22
+ protected function _toHtml() {
23
+ $html = parent::_toHtml();
24
+ return Etracker_Etracker_Helper_Data::getDynamicChildBlockHtml($this, $html, 'etracker_onepage');
25
+ }
26
+ }
app/code/community/Etracker/Etracker/Block/Track.php ADDED
@@ -0,0 +1,695 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * justselling Germany Ltd. EULA
4
+ * http://www.justselling.de/
5
+ * Read the license at http://www.justselling.de/lizenz
6
+ *
7
+ * Do not edit or add to this file, please refer to http://www.justselling.de for more information.
8
+ *
9
+ * @category justselling
10
+ * @package justselling_etracker
11
+ * @copyright Copyright (c) 2013 justselling Germany Ltd. (http://www.justselling.de)
12
+ * @license http://www.justselling.de/lizenz
13
+ * @author Bodo Schulte
14
+ */
15
+ class Etracker_Etracker_Block_Track extends Mage_Core_Block_Template
16
+ {
17
+ /* Local cache */
18
+ private $_cacheOrders = null;
19
+
20
+
21
+ /**
22
+ * Get a specific page name (may be customized via layout)
23
+ *
24
+ * @return string|null
25
+ */
26
+ public function getPageName() {
27
+ $value = '';
28
+ $route = $this->getRequest()->getRouteName();
29
+ /* Try CMS */
30
+ if ($route == 'cms') {
31
+ $value = Mage::getSingleton('cms/page')->getTitle();
32
+ if (empty($value)) {
33
+ $value = Mage::getSingleton('cms/page')->getIdentifier();
34
+ }
35
+ }
36
+ /* Try get from product */
37
+ /** @var $product Mage_Catalog_Model_Product */
38
+ if ($product = Mage::registry('current_product')) {
39
+ $value = $product->getName().'-'.$product->getSku();
40
+ }
41
+ /* Try get from category */
42
+ /** @var $cat Mage_Catalog_Model_Category */
43
+ if (Mage::registry('current_category') && !$product) {
44
+ $value = Mage::registry('current_category')->getName();
45
+ }
46
+ /* Try get from head title */
47
+ if (empty($value)) {
48
+ $headBlock = $this->getLayout()->getBlock('head');
49
+ if ($headBlock) $value = $headBlock->getTitle();
50
+ }
51
+ if (empty($value)) {
52
+ Etracker_Etracker_Helper_Data::log("Unable getting page name for req {$this->getRequest()->getRequestUri()}", Zend_Log::WARN);
53
+ }
54
+ /* Trim 'Searchresult' page title to the first word only */
55
+ if (strpos($route, 'search') !== false) {
56
+ $parts = explode(' ', $value);
57
+ if (count($parts)) $value = $parts[0];
58
+ }
59
+
60
+ if ($prefix = Mage::getStoreConfig('design/head/title_prefix')) {
61
+ if (strncmp($prefix, $value, strlen($prefix))===0) $value = substr($value, strlen($prefix)+1);
62
+ }
63
+ if ($suffix = Mage::getStoreConfig('design/head/title_suffix')) {
64
+ if (preg_match('/.*'.$suffix.'/', $value)) $value = substr($value, 0, strlen($value) - (strlen($suffix)+1));
65
+ }
66
+
67
+ if ($this->isHomePage()) $value = '__INDEX__'.$value;
68
+ return $value;
69
+ }
70
+
71
+ /**
72
+ * @param $eventName string The name of the event
73
+ * @param $putToRegistryAfter In case the flag should still be available even after it has been removed from session,
74
+ * pass true.
75
+ * @return bool|mixed The registered value, false if nothing found
76
+ */
77
+ public function isEventRegistered($eventName, $putToRegistryAfter=false) {
78
+ if ($value = Mage::registry($eventName)) {
79
+ return $value;
80
+ }
81
+ $session = Mage::getSingleton('customer/session');
82
+ if ($value = $session->getData($eventName)) {
83
+ $session->unsetData($eventName);
84
+ if ($putToRegistryAfter) Mage::register($eventName, $value);
85
+ return $value;
86
+ }
87
+ return false;
88
+ }
89
+
90
+ /**
91
+ * @return string
92
+ */
93
+ public function getAreas() {
94
+ $hlp = Mage::helper('etracker');
95
+ $value = Mage::getStoreConfig('etracker/standard/storeviewcode') ? ucfirst($hlp->__(Mage::app()->getStore()->getCode())) : '';
96
+ $value .= strlen($value) ? '/' : '';
97
+ /* In case of product navigation... */
98
+ $product = Mage::registry('current_product');
99
+ if ($product) {
100
+ $value .= $hlp->__('Products').'/';
101
+ }
102
+ /** @var $cat Mage_Catalog_Model_Category */
103
+ /** @var $category Mage_Catalog_Model_Category */
104
+ if ($cat = Mage::registry('current_category')) {
105
+ if (!$product) {
106
+ $value .= $hlp->__('Categories').'/';
107
+ }
108
+ $catPath = $this->getCategoryPath($cat);
109
+ $value .= $catPath;
110
+ Etracker_Etracker_Helper_Data::setToSession(
111
+ Etracker_Etracker_Helper_Data::SESS_KEY_LAST_CAT_VIEW, 'path', $catPath);
112
+ if ($product) {
113
+ Etracker_Etracker_Helper_Data::setToSession(
114
+ Etracker_Etracker_Helper_Data::SESS_KEY_LAST_CAT_PROD_VIEW, $product->getId(), $catPath);
115
+ } else
116
+ Etracker_Etracker_Helper_Data::removeFromSession(Etracker_Etracker_Helper_Data::SESS_KEY_LAST_CAT_PROD_VIEW);
117
+ return $value;
118
+ }
119
+ /* In all other cases... */
120
+ $module = $this->getRequest()->getModuleName();
121
+ if ($module != 'catalog') {
122
+ $value .= $hlp->__(ucfirst($module));
123
+ $controllerName = $this->getRequest()->getControllerName();
124
+ if ($controllerName && $controllerName != 'index' && $controllerName != 'page') {
125
+ $value .= '/'.ucfirst($hlp->__($controllerName));
126
+ }
127
+ }
128
+ return $value;
129
+ }
130
+
131
+ /**
132
+ * Returns the path to the given category (incl.).
133
+ * @param $category Mage_Catalog_Model_Category
134
+ * @return string
135
+ */
136
+ private function getCategoryPath($category) {
137
+ $cats = $category->getParentCategories();
138
+ $catPath = '';
139
+ $i=1; foreach($cats as $category) {
140
+ $catPath .= $category->getName();
141
+ $catPath .= ($i<count($cats)) ? '/' :'';
142
+ $i++;
143
+ }
144
+ return $catPath;
145
+ }
146
+
147
+ /**
148
+ * Checks whether current request returns home page. <br/>
149
+ * <b>Note:</b> As this cannot be identified safely, we simply check for 'home' CMS-Page additionally.
150
+ * @return bool
151
+ */
152
+ public function isHomePage() {
153
+ $isHome = $this->getUrl('') == $this->getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true));
154
+ if (!$isHome) {
155
+ $routeName = Mage::app()->getRequest()->getRouteName();
156
+ $identifier = Mage::getSingleton('cms/page')->getIdentifier();
157
+ $isHome = ($routeName == 'cms' && $identifier == 'home');
158
+ }
159
+ return $isHome;
160
+ }
161
+
162
+ /**
163
+ * @return string the configured Security-Code
164
+ */
165
+ public function getSecurityCode() {
166
+ $code = Mage::helper('etracker')->getSecurityCode();
167
+ if (empty($code)) {
168
+ Etracker_Etracker_Helper_Data::log('No security code configured!', Zend_Log::ERR);
169
+ }
170
+ return $code;
171
+ }
172
+
173
+ /**
174
+ * @return string The configured CC-Key (may be null/empty)
175
+ */
176
+ public function getCcKey() {
177
+ $code = Mage::helper('etracker')->getCcKey();
178
+ return $code;
179
+ }
180
+
181
+ /**
182
+ * @return bool true if tracking code is to be included, false otherwise
183
+ */
184
+ public function isTrackingCodeToBeIncluded() {
185
+ $isStandardActive = (bool) Mage::getStoreConfig('etracker/standard/active');
186
+ return $isStandardActive && $this->isEnabled();
187
+ }
188
+
189
+ /**
190
+ * Returns true in case the tracking code can be delivered, false otherwise.
191
+ * @return bool
192
+ */
193
+ public function isEnabled() {
194
+ $code = $this->getSecurityCode();
195
+ return !empty($code);
196
+ }
197
+
198
+ /**
199
+ * @return bool true if async (and standard) is activated, false otherwise
200
+ */
201
+ public function isAsyncActive() {
202
+ $isAsyncActive = (bool) Mage::getStoreConfig('etracker/standard/async');
203
+ return $isAsyncActive && $this->isEnabled();
204
+ }
205
+
206
+ /**
207
+ * @return bool True if ecommerce (PPR) part is active
208
+ */
209
+ public function isPprActive() {
210
+ $isPprActive = (bool) Mage::getStoreConfig('etracker/ecommerce/active');
211
+ return $isPprActive && $this->isEnabled();
212
+ }
213
+
214
+ /**
215
+ * @return bool True if debug is active
216
+ */
217
+ public function isPprDebugActive() {
218
+ $isPprActive = (bool) Mage::getStoreConfig('etracker/ecommerce/debug');
219
+ return $isPprActive && $this->isPprActive();
220
+ }
221
+
222
+ /**
223
+ * @return string Contains a ';'-separated string of the
224
+ */
225
+ protected function _getOrdersBasketTrackingCode()
226
+ {
227
+ $isTaxInclRequired = Mage::getStoreConfig('etracker/general/tax');
228
+ $orders = $this->getOrders();
229
+ if (is_null($orders)) $orders = array();
230
+ $result = "";
231
+ foreach ($orders as $order) {
232
+ /* @var $item Mage_Sales_Model_Order_Item */
233
+ foreach ($order->getAllVisibleItems() as $item) {
234
+ if (strlen($result)>0) $result .= ";";
235
+ $cat = "";
236
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
237
+ if ($product && $product->getId()) {
238
+ if ($catIds = $product->getCategoryIds()) {
239
+ $category = Mage::getModel("catalog/category")->load(end($catIds));
240
+ if ($category && $category->getId()) {
241
+ $cat = str_replace(array(',', ';'), ' ', $category->getName());
242
+ }
243
+ }
244
+ $name = str_replace(array(',', ';'), ' ', $item->getName());
245
+ $price = $isTaxInclRequired ? $item->getPriceInclTax() : $item->getPrice();
246
+ $result .= sprintf("%s,%s,%s,%s,%s",
247
+ $this->jsQuoteEscape($item->getSku()),
248
+ $this->jsQuoteEscape($name),
249
+ $this->jsQuoteEscape($cat),
250
+ number_format($item->getQtyOrdered(), 4, '.', ''),
251
+ Etracker_Etracker_Helper_Data::priceFormat($price)
252
+ );
253
+ }
254
+ }
255
+ /* Shipment */
256
+ $shipmentData = $this->getShipmentData($order);
257
+ if (!empty($shipmentData)) {
258
+ $result .= ';';
259
+ $result .= sprintf("%s,%s,%s,%s,%s",
260
+ $this->jsQuoteEscape($shipmentData['id']),
261
+ $this->jsQuoteEscape($shipmentData['name']),
262
+ $this->jsQuoteEscape(reset($shipmentData['category'])),
263
+ number_format(1, 4, '.', ''),
264
+ Etracker_Etracker_Helper_Data::priceFormat($shipmentData['price'])
265
+ );
266
+ }
267
+ /* Discounts */
268
+ $discountData = $this->getDiscountData($order);
269
+ if (!empty($discountData)) {
270
+ $result .= ';';
271
+ $result .= sprintf("%s,%s,%s,%s,%s",
272
+ $this->jsQuoteEscape($discountData['id']),
273
+ $this->jsQuoteEscape($discountData['name']),
274
+ $this->jsQuoteEscape(reset($discountData['category'])),
275
+ number_format(1, 4, '.', ''),
276
+ Etracker_Etracker_Helper_Data::priceFormat($discountData['price'])
277
+ );
278
+ }
279
+ }
280
+ return $result;
281
+ }
282
+
283
+ /**
284
+ * 0=>Lead, 1=>Sale, 2=Vollstorno
285
+ * @return string the etracker sale type
286
+ */
287
+ protected function _getOrderTsale() {
288
+ if ($order = $this->getOrder()) {
289
+ return '1';
290
+ }
291
+ return '0';
292
+ }
293
+
294
+ /**
295
+ * @return bool|Mage_Sales_Model_Order
296
+ */
297
+ private function getOrder() {
298
+ $orders = $this->getOrders();
299
+ if (!empty($orders)) {
300
+ return reset($orders);
301
+ }
302
+ return false;
303
+ }
304
+
305
+ /**
306
+ * @return null|array(Mage_Sales_Model_Order)
307
+ */
308
+ private function getOrders() {
309
+ if (!is_null($this->_cacheOrders)) {
310
+ return $this->_cacheOrders;
311
+ }
312
+ $orderIds = Mage::registry('current_order_ids');
313
+ if ($orderIds) {
314
+ $collection = Mage::getResourceModel('sales/order_collection')
315
+ ->addFieldToFilter('entity_id', array('in' => $orderIds));
316
+ if (!$collection->count()) {
317
+ Etracker_Etracker_Helper_Data::log('No valid order found in registry!', Zend_Log::ERR);
318
+ }
319
+ foreach($collection as $order) {
320
+ $this->_cacheOrders[] = $order;
321
+ }
322
+ }
323
+ return $this->_cacheOrders;
324
+ }
325
+
326
+ /**
327
+ * @return bool|Mage_Sales_Model_Order Returns the increment ID of the first found order. Returns false if no order available.
328
+ */
329
+ protected function _getOrdersIdTrackingCode()
330
+ {
331
+ $orders = $this->getOrders();
332
+ if (!empty($orders)) {
333
+ $order = reset($orders);
334
+ return ($order) ? $order->getIncrementId() : false;
335
+ }
336
+ return false;
337
+ }
338
+
339
+ /**
340
+ * @return string
341
+ */
342
+ protected function _getOrdersValueTrackingCode()
343
+ {
344
+ $isTaxInclRequired = Mage::getStoreConfig('etracker/general/tax');
345
+ $orders = $this->getOrders();
346
+ if (is_null($orders)) $orders = array();
347
+ $result = 0;
348
+ foreach ($orders as $order) {
349
+ /* @var $order Mage_Sales_Model_Order */
350
+ $result += $isTaxInclRequired ? $order->getBaseGrandTotal() : $order->getBaseGrandTotal() - $order->getBaseTaxAmount();
351
+ }
352
+ return $result;
353
+ }
354
+
355
+ /**
356
+ * Returns true in case we're in checkout's basket view. Additionally, the view is stored into session for later
357
+ * usage in checkout process.
358
+ * @return bool
359
+ */
360
+ public function isCheckoutCartView() {
361
+ $isCheckout = $this->isCheckout('cart');
362
+ if ($isCheckout) {
363
+ $session = Mage::getSingleton('core/session');
364
+ $session->setData(Etracker_Etracker_Helper_Data::SESS_KEY_LAST_CART_VIEW, 1);
365
+ }
366
+ return $isCheckout;
367
+ }
368
+
369
+ /**
370
+ * @param string The checkout type: 'onepage' or 'multishipping'
371
+ * @return bool True in case the checkout (module) is used
372
+ */
373
+ public function isCheckout($type = null) {
374
+ $moduleName = $this->getRequest()->getModuleName();
375
+ $controllerName = $this->getRequest()->getControllerName();
376
+ if (!is_null($type)) {
377
+ return $moduleName == 'checkout' && $controllerName == $type;
378
+ } else {
379
+ return $moduleName == 'checkout';
380
+ }
381
+ }
382
+
383
+ /**
384
+ * @return bool In case the checkout succeeded and is finished.
385
+ */
386
+ public function isCheckoutSuccess() {
387
+ $orderId = $this->_getOrdersIdTrackingCode();
388
+ return (bool) $orderId;
389
+ }
390
+
391
+ /**
392
+ * @return string
393
+ */
394
+ protected function _getOrdersEtTarget() {
395
+ $hlp = Mage::helper('etracker');
396
+ $pre = $hlp->__('Cart');
397
+ $pathPost = '';
398
+ if ($this->isCheckout('multishipping')) {
399
+ $pathPost .= $pre.'/'.$hlp->__('Multishipping');
400
+ $steps = Mage::getSingleton('checkout/type_multishipping_state')->getSteps();
401
+ $activeStep = $this->getCheckoutMultiShippingActiveStepKey($steps);
402
+ foreach($steps as $step => $data) {
403
+ $pathPost .= '/'. $data['label'];
404
+ if ($step == $activeStep) break;
405
+ }
406
+ } else if ($this->isCheckout('onepage')) {
407
+ $pathPost .= $pre.'/'.$hlp->__('Onepage');
408
+ $steps = Mage::getBlockSingleton('checkout/onepage')->getSteps();
409
+ foreach($steps as $step => $data) {
410
+ $pathPost .= '/'. $data['label'];
411
+ }
412
+ if ($this->isCheckoutSuccess()) {
413
+ $pathPost .= '/'.$hlp->__('Order Success');
414
+ }
415
+ } else if ($this->isCheckout(null)) {
416
+ $pathPost = $pre;
417
+ }
418
+ $path = empty($pathPost) ? '' : $pathPost;
419
+ return $path;
420
+ }
421
+
422
+ /**
423
+ * Returns the key name of the current active step for the multishipping checkout
424
+ * @param $steps
425
+ * @return bool|string
426
+ */
427
+ private function getCheckoutMultiShippingActiveStepKey($steps) {
428
+ foreach($steps as $stepKey => $stepData) {
429
+ if (isset($stepData['is_active']) && $stepData['is_active'] == true) {
430
+ return $stepKey;
431
+ }
432
+ }
433
+ return false;
434
+ }
435
+
436
+ /**
437
+ * @return bool True in case the first step of multishipping checkout is active, false otherwise
438
+ */
439
+ public function isCheckoutMultiShippingFirstStep() {
440
+ $steps = Mage::getSingleton('checkout/type_multishipping_state')->getSteps();
441
+ $stepIdx = 0;
442
+ foreach($steps as $stepKey => $stepData) {
443
+ if ($stepIdx == 0 && isset($stepData['is_active']) && $stepData['is_active'] == true) {
444
+ return true;
445
+ }
446
+ break;
447
+ }
448
+ return false;
449
+ }
450
+
451
+ /**
452
+ * @return string The current quote item ID from the session, maybe empty string
453
+ */
454
+ public function getQuoteId($withLabel=true) {
455
+ $session = Mage::getSingleton('checkout/session');
456
+ /* @var $cart Mage_Sales_Model_Quote */
457
+ $cart = $session->getQuote();
458
+ if ($cart && $cart->getId()) {
459
+ return $withLabel ? Mage::helper('etracker')->__('Cart').'#'.$cart->getId() : $cart->getId();
460
+ }
461
+ if ($order = $this->getOrder()) {
462
+ return $withLabel ? Mage::helper('etracker')->__('Cart').'#'.$order->getQuoteId() : $order->getQuoteId();
463
+ }
464
+ return '-';
465
+ }
466
+
467
+ /**
468
+ * @return array|bool The relevant data as an array:
469
+ * 'data' => array()<product data>
470
+ * 'qty' => product quantity
471
+ * Returns false if no product has been put to basket
472
+ */
473
+ public function getPprInsertToBasketProductData() {
474
+ $session = Mage::getSingleton('customer/session');
475
+ $products = $session->getData('event_sales_quote_add_item_product');
476
+ $items = array();
477
+ if (!empty($products)) {
478
+ $session->unsetData('event_sales_quote_add_item_product');
479
+ foreach($products as $productId => $qty) {
480
+ $product = Mage::getModel('catalog/product')->load($productId);
481
+ if ($product && $product->getId()) {
482
+ $data = array('data' => $this->getProductData($product), 'qty' => $qty);
483
+ $items[] = $data;
484
+ }
485
+ }
486
+ if (!empty($items)) return $items;
487
+ }
488
+ return false;
489
+ }
490
+
491
+ /**
492
+ * @return array|bool The relevant product data as key/value pairs, false if no product has been removed from basket
493
+ */
494
+ public function getPprRemoveFromBasketProductData() {
495
+ $session = Mage::getSingleton('customer/session');
496
+ $products = $session->getData('event_sales_quote_remove_item_product');
497
+ $items = array();
498
+ if (!empty($products)) {
499
+ $session->unsetData('event_sales_quote_remove_item_product');
500
+ foreach($products as $productId => $qty) {
501
+ $product = Mage::getModel('catalog/product')->load($productId);
502
+ $data = array('data' => $this->getProductData($product), 'qty' => $qty);
503
+ $items[] = $data;
504
+ }
505
+ if (!empty($items)) return $items;
506
+ }
507
+ return false;
508
+ }
509
+
510
+ /**
511
+ * @return array|bool The relevant product data as key/value pairs, false if no current product
512
+ */
513
+ public function getPprViewProductData() {
514
+ /* @var $product Mage_Catalog_Model_Product */
515
+ if ($product = Mage::registry('current_product')) {
516
+ $data = $this->getProductData($product);
517
+ return $data;
518
+ }
519
+ return false;
520
+ }
521
+
522
+ /**
523
+ * Translates and escapes given text for usage in javascript context.
524
+ * @param $text
525
+ * @return mixed
526
+ */
527
+ public function jsTranslAndEscape($text) {
528
+ $value = parent::__($text);
529
+ return Etracker_Etracker_Helper_Data::iCharRepl($value);
530
+ }
531
+
532
+ /**
533
+ * Returns the order in etracker required format (ready for json-encoding)
534
+ * @return bool|array
535
+ */
536
+ public function getPprOrderData() {
537
+ $isTaxInclRequired = Mage::getStoreConfig('etracker/general/tax');
538
+ $order = $this->getOrder();
539
+ if ($order && $order->getId()) {
540
+ try {
541
+ $group = Mage::getModel('customer/group')->load($order->getCustomerGroupId());
542
+ $data = array();
543
+ $data['orderNumber'] = $order->getIncrementId();
544
+ $data['status'] = 'sale';
545
+ $total = $isTaxInclRequired ? $order->getBaseGrandTotal() : $order->getBaseGrandTotal() - $order->getBaseTaxAmount();
546
+ $data['orderPrice'] = Etracker_Etracker_Helper_Data::priceFormat($total);
547
+ $data['currency'] = $order->getOrderCurrencyCode();
548
+ $data['customerId'] = $order->getCustomerId() ? $order->getCustomerId() : '-';
549
+ $customerGroup = ($group && $group->getId()) ? $group->getCustomerGroupCode() : '-';
550
+ $data['customerGroup'] = Etracker_Etracker_Helper_Data::iCharRepl($customerGroup);
551
+ $shipmentAddressData = $this->getAddressString($order->getShippingAddress());
552
+ $data['customerAddress'] = $shipmentAddressData;
553
+ $billingAddressData = $this->getAddressString($order->getBillingAddress());
554
+ $data['invoiceAddress'] = $billingAddressData;
555
+ $data['paymentMethod'] = $order->getPayment() ? $order->getPayment()->getMethod() : '-';
556
+ $data['deliveryConditions'] = '-';
557
+ $data['paymentConditions'] = '-';
558
+ $data['shipType'] = $order->getShippingMethod() ? $order->getShippingMethod() : '';
559
+ $costs = $isTaxInclRequired ? $order->getShippingInclTax() : $order->getShippingAmount();
560
+ $data['shipCosts'] = Etracker_Etracker_Helper_Data::priceFormat($costs);
561
+ $data['couponCodes'] = $order->getCouponCode() ? Etracker_Etracker_Helper_Data::iCharRepl($order->getCouponCode()) : '-';
562
+ $data['giftPackage'] = array('-');
563
+ $data['differenceData'] = 0;
564
+ $products = array();
565
+ /* @var $item Mage_Sales_Model_Order_Item */
566
+ foreach($order->getAllVisibleItems() as $item) {
567
+ $dataItem = array();
568
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
569
+ $dataItem['product'] = $this->getProductData($product);
570
+ $dataItem['quantity'] = (int)$item->getQtyOrdered();
571
+ $products[] = $dataItem;
572
+ }
573
+ if ($order->getDiscountAmount() != 0) {
574
+ $dataItem['product'] = $this->getDiscountData($order);
575
+ $dataItem['quantity'] = (int)1;
576
+ $products[] = $dataItem;
577
+ }
578
+ /*$shipmentData = $this->getShipmentData($order);
579
+ if (!empty($shipmentData)) {
580
+ $dataItem['product'] = $shipmentData;
581
+ $dataItem['quantity'] = (int)1;
582
+ $products[] = $dataItem;
583
+ }*/
584
+ $basketId = Etracker_Etracker_Helper_Data::iCharRepl(Mage::helper('etracker')->__('Cart')).'#'.$order->getQuoteId();
585
+ $data['basket'] = (object) array(
586
+ 'id' => $basketId,
587
+ 'products' => $products
588
+ );
589
+ return $data;
590
+ } catch (Exception $e) {
591
+ Etracker_Etracker_Helper_Data::log('Problem extracting data from order: '.$e->getMessage(), Zend_Log::ERR);
592
+ }
593
+ }
594
+ return false;
595
+ }
596
+
597
+ /**
598
+ * @param Mage_Sales_Model_Order_Address $address
599
+ * @return string
600
+ */
601
+ private function getAddressString($address) {
602
+ $value = '';
603
+ if ($address && $address->getId()) {
604
+ $value = $address->getCountryId();
605
+ if ($address->getRegion()) $value .= ','.$address->getRegion();
606
+ if ($address->getCity()) $value .= ','.$address->getCity();
607
+ }
608
+ return $value;
609
+ }
610
+
611
+ /**
612
+ * @param Mage_Catalog_Model_Product $product
613
+ * @return array
614
+ */
615
+ private function getProductData($product) {
616
+ /* @var $categoryCurrent Mage_Catalog_Model_Category */
617
+ $categoryCurrent = Mage::registry('current_category');
618
+ $categoryFromCart = Etracker_Etracker_Helper_Data::getFromSession(
619
+ Etracker_Etracker_Helper_Data::SESS_KEY_CART_PROD_CAT_MAP, $product->getId());
620
+
621
+ $data = array();
622
+ $data['id'] = $product->getSku();
623
+ $data['name'] = Etracker_Etracker_Helper_Data::iCharRepl($product->getName());
624
+ $cat = $categoryCurrent ? $this->pathToArray($this->getCategoryPath($categoryCurrent)) : array();
625
+ if (empty($cat) && $categoryFromCart) {
626
+ $cat = $this->pathToArray($categoryFromCart);
627
+ }
628
+ $data['category'] = $cat;
629
+ $price = Etracker_Etracker_Helper_Data::getProductPrice($product);
630
+ $data['price'] = Etracker_Etracker_Helper_Data::priceFormat($price);
631
+ $data['currency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
632
+ $data['variants'] = (object) array(); //$product->getOptions();
633
+ return $data;
634
+ }
635
+
636
+ /**
637
+ * Generates an array from a given path (separated by '/') and performs a js-escape on each term.
638
+ * @param $path
639
+ * @return array|mixed
640
+ */
641
+ private function pathToArray($path) {
642
+ $path = Etracker_Etracker_Helper_Data::iCharRepl($path);
643
+ if (strpos($path, '/') !== false) {
644
+ return explode('/', $path);
645
+ }
646
+ return array($path);
647
+ }
648
+
649
+ /**
650
+ * @param Mage_Sales_Model_Order $order
651
+ * @return array
652
+ */
653
+ private function getDiscountData($order) {
654
+ $hlp = Mage::helper('etracker');
655
+ $isTaxInclRequired = Mage::getStoreConfig('etracker/general/tax');
656
+ $price = $isTaxInclRequired ? $order->getDiscountAmount() : $order->getDiscountAmount() - $order->getHiddenTaxAmount();
657
+ $data = array();
658
+ if ($price) {
659
+ $id = $order->getIncrementId().($order->getCouponCode()? '-'.$order->getCouponCode() : '');
660
+ $data['id'] = $id;
661
+ $name = $order->getDiscountDescription() ? $order->getDiscountDescription().'('.$order->getCouponCode().')' : $hlp->__('Discount');
662
+ $data['name'] = Etracker_Etracker_Helper_Data::iCharRepl($name);
663
+ $cat = $order->getCouponCode() ? $hlp->__('Coupons') : $hlp->__('Discounts');
664
+ $data['category'] = array(Etracker_Etracker_Helper_Data::iCharRepl($cat));
665
+ $data['price'] = Etracker_Etracker_Helper_Data::priceFormat($price);
666
+ $data['currency'] = $order->getOrderCurrencyCode(); // Mage::app()->getStore()->getCurrentCurrencyCode();
667
+ $data['variants'] = (object) array();
668
+ }
669
+ return $data;
670
+ }
671
+
672
+ /**
673
+ * Returns the shipment data for the given order.
674
+ * @param Mage_Sales_Model_Order $order $order
675
+ * @return array May be empty
676
+ */
677
+ private function getShipmentData($order) {
678
+ $data = array();
679
+ $isTaxInclRequired = Mage::getStoreConfig('etracker/general/tax');
680
+ $amount = $isTaxInclRequired ? $order->getShippingInclTax() : $order->getShippingAmount();
681
+ if ($amount) {
682
+ $id = $order->getIncrementId().'-'.Mage::helper('etracker')->__('Shipment');
683
+ $name = $order->getShippingMethod();
684
+ $cat = Mage::helper('etracker')->__('Shipment');
685
+ $data['id'] = $id;
686
+ $data['name'] = $name;
687
+ $data['category'] = array(Etracker_Etracker_Helper_Data::iCharRepl($cat));
688
+ $data['price'] = $amount;
689
+ $data['currency'] = $order->getOrderCurrencyCode();
690
+ $data['variants'] = (object)array();
691
+ }
692
+ return $data;
693
+ }
694
+ }
695
+ ?>
app/code/community/Etracker/Etracker/Helper/Data.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * justselling Germany Ltd. EULA
4
+ * http://www.justselling.de/
5
+ * Read the license at http://www.justselling.de/lizenz
6
+ *
7
+ * Do not edit or add to this file, please refer to http://www.justselling.de for more information.
8
+ *
9
+ * @category justselling
10
+ * @package justselling_etracker
11
+ * @copyright Copyright (c) 2013 justselling Germany Ltd. (http://www.justselling.de)
12
+ * @license http://www.justselling.de/lizenz
13
+ * @author Bodo Schulte
14
+ */
15
+
16
+ class Etracker_Etracker_Helper_Data extends Mage_Core_Helper_Abstract {
17
+
18
+ const SESS_KEY_LAST_CAT_VIEW = 'last_category_view';
19
+ const SESS_KEY_LAST_CAT_PROD_VIEW = 'last_category_product_view';
20
+ const SESS_KEY_CART_PROD_CAT_MAP = 'cart_category_product';
21
+ const SESS_KEY_LAST_CART_VIEW = 'last_cart_view';
22
+
23
+ /**
24
+ * Returns the configured security code.
25
+ *
26
+ * @return string May be empty/null
27
+ */
28
+ public function getSecurityCode() {
29
+ $accountId = Mage::getStoreConfig('etracker/general/account');
30
+ return $accountId;
31
+ }
32
+
33
+ /**
34
+ * Returns the configured cc code.
35
+ *
36
+ * @return string May be empty/null
37
+ */
38
+ public function getCcKey() {
39
+ $id = Mage::getStoreConfig('etracker/general/cckey');
40
+ return $id;
41
+ }
42
+
43
+ /**
44
+ * Writes the given log message (to a separate log file).
45
+ * @param $msg
46
+ * @param int $level
47
+ */
48
+ public static function log($msg, $level=Zend_Log::DEBUG) {
49
+ $force = (bool) Mage::getStoreConfig('etracker/developer/log');
50
+ if ($level == Zend_Log::ERR || $level == Zend_Log::ALERT || $level == Zend_Log::CRIT) $force = true;
51
+ Mage::log($msg, $level, 'etracker.log', $force);
52
+ }
53
+
54
+ /**
55
+ * @param $value int|float the number to be formatted
56
+ * @return string
57
+ */
58
+ public static function priceFormat($value) {
59
+ return number_format($value, 2, '.', '');
60
+ }
61
+
62
+ /**
63
+ * Calculates the price on base of the configurable tax (incl./excl.).
64
+ * @param Mage_Catalog_Model_Product $product
65
+ */
66
+ public static function getProductPrice($product) {
67
+ /* @var $taxHelper Mage_Tax_Helper_Data */
68
+ $taxHelper = Mage::helper('tax');
69
+ $isTaxInclRequired = (bool) Mage::getStoreConfig('etracker/general/tax');
70
+ $productsInclTax = $taxHelper->priceIncludesTax($product->getStore());
71
+ $finalPrice = $product->getFinalPrice();
72
+ if ($productsInclTax) { // shop
73
+ if (!$isTaxInclRequired) {
74
+ //$price = $taxHelper->getPrice($product, $finalPrice, false);
75
+ if ($product->getTaxClassId()) {
76
+ $taxAmount = self::calculateTax($product, $finalPrice, true);
77
+ return $finalPrice - $taxAmount;
78
+ }
79
+ }
80
+ } else {
81
+ if ($isTaxInclRequired) {
82
+ if ($product->getTaxClassId()) {
83
+ $taxAmount = self::calculateTax($product, $finalPrice, false);
84
+ return $taxAmount + $finalPrice;
85
+ }
86
+ }
87
+ }
88
+ return $finalPrice;
89
+ }
90
+
91
+
92
+ /**
93
+ * Calculates the tax on the give price.
94
+ * @param $product
95
+ * @param $price
96
+ * @param $productInclTax If product price includes tax already
97
+ * @return mixed
98
+ */
99
+ protected static function calculateTax($product, $price, $productInclTax) {
100
+ $request = Mage::getSingleton('tax/calculation')->getRateRequest(null, null, null, $product->getStore());
101
+ $percent = Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($product->getTaxClassId()));
102
+ $calculator = Mage::getSingleton('tax/calculation');
103
+ $taxAmount = $calculator->calcTaxAmount($price, $percent, $productInclTax, false);
104
+ return $taxAmount;
105
+ }
106
+
107
+ /**
108
+ * Sets the given key/value pair to the core/session using the given group as data holder.
109
+ * @param $group The group-key the values is set to session
110
+ * @param $key
111
+ * @param $value
112
+ * @return bool True on success, false otherwise
113
+ */
114
+ public static function setToSession($group, $key, $value) {
115
+ if (empty($group) || empty($key)) return false;
116
+ $session = Mage::getSingleton('core/session');
117
+ $groupValues = $session->getData($group);
118
+ if ($groupValues && is_array($groupValues)) {
119
+ $groupValues[$key] = $value;
120
+ } else {
121
+ $groupValues = array();
122
+ $groupValues[$key] = $value;
123
+ }
124
+ $session->setData($group, $groupValues);
125
+ Etracker_Etracker_Helper_Data::log("Set to core/session [group] {$group}, [key] {$key}, [value] {$value}");
126
+ return true;
127
+ }
128
+
129
+ /**
130
+ * Returns the group values (array) for the give group key.
131
+ * @param $group
132
+ * @param null $key if set, the value for the given key is returned
133
+ * @return bool|mixed
134
+ */
135
+ public static function getFromSession($group, $key=null) {
136
+ if (empty($group)) return false;
137
+ $session = Mage::getSingleton('core/session');
138
+ $groupValues = $session->getData($group);
139
+ if (is_null($key)) {
140
+ return $groupValues;
141
+ } else {
142
+ Etracker_Etracker_Helper_Data::log("Fetch from core/session [group] {$group}, [key] {$key}, [value] {$groupValues[$key]}");
143
+ return (is_array($groupValues) && isset($groupValues[$key])) ? $groupValues[$key] : false;
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Removes the key from the given group in session. If key is null, the group will be removed.
149
+ * @param $group
150
+ * @param null $key
151
+ * @return bool
152
+ */
153
+ public static function removeFromSession($group, $key=null) {
154
+ if (empty($group)) return false;
155
+ $session = Mage::getSingleton('core/session');
156
+ if (is_null($key) && $session->hasData($group)) {
157
+ $session->unsetData($group);
158
+ }
159
+ if (!is_null($key)) {
160
+ $groupValues = $session->getData($group);
161
+ if (isset($groupValues[$key])) {
162
+ Etracker_Etracker_Helper_Data::log("Remove from core/session [group] {$group}, [key] {$key}");
163
+ unset($groupValues[$key]);
164
+ }
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Replaces the characters ',",; for JavaScript escaping (by a space-character) using str_ireplace.
170
+ * @param $value
171
+ */
172
+ public static function iCharRepl($value) {
173
+ $value = Mage::helper('core')->jsQuoteEscape($value);
174
+ return str_ireplace(array('"', ';'), ' ', $value);
175
+ }
176
+
177
+ /**
178
+ * To support version < 1.4.2 we need to disable use of "dynamic block" feature (see Observer) and use overwridden
179
+ * blocks.
180
+ * @return bool
181
+ */
182
+ public static function isDynamicBlockSupported() {
183
+ $version = Mage::getVersionInfo();
184
+ if ($version['minor'] == 4 && $version['revision'] < 2 ) {
185
+ return false;
186
+ } else if ($version['minor'] < 4) {
187
+ return false;
188
+ } else
189
+ return true;
190
+ }
191
+
192
+ /**
193
+ * To support version < 1.4.2 we add child block html on this way as we do not need to overwrite any template file.
194
+ * (This is a better solution and causes less problems together with other modules).
195
+ *
196
+ * @param Mage_Core_Block_Abstract $block
197
+ * @param $html
198
+ * @param $childBlockName
199
+ * @return string
200
+ */
201
+ public static function getDynamicChildBlockHtml($block, $html, $childBlockName) {
202
+ if (!self::isDynamicBlockSupported()) {
203
+ if ($block->getChild($childBlockName)) {
204
+ $html .= "\n".$block->getChildHtml($childBlockName);
205
+ }
206
+ }
207
+ return $html;
208
+ }
209
+ }
app/code/community/Etracker/Etracker/Model/Admin/System/Config/Source/InclTax.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * justselling Germany Ltd. EULA
4
+ * http://www.justselling.de/
5
+ * Read the license at http://www.justselling.de/lizenz
6
+ *
7
+ * Do not edit or add to this file, please refer to http://www.justselling.de for more information.
8
+ *
9
+ * @category justselling
10
+ * @package justselling_etracker
11
+ * @copyright Copyright (c) 2013 justselling Germany Ltd. (http://www.justselling.de)
12
+ * @license http://www.justselling.de/lizenz
13
+ * @author Bodo Schulte
14
+ */
15
+ class Etracker_Etracker_Model_Admin_System_Config_Source_InclTax
16
+ {
17
+ public function toOptionArray()
18
+ {
19
+ return array(
20
+ array('value'=>0, 'label'=>Mage::helper('etracker')->__('Excluding Tax')),
21
+ array('value'=>1, 'label'=>Mage::helper('etracker')->__('Including Tax')),
22
+ );
23
+ }
24
+
25
+ }
app/code/community/Etracker/Etracker/Model/Observer.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * justselling Germany Ltd. EULA
4
+ * http://www.justselling.de/
5
+ * Read the license at http://www.justselling.de/lizenz
6
+ *
7
+ * Do not edit or add to this file, please refer to http://www.justselling.de for more information.
8
+ *
9
+ * @category justselling
10
+ * @package justselling_etracker
11
+ * @copyright Copyright (c) 2013 justselling Germany Ltd. (http://www.justselling.de)
12
+ * @license http://www.justselling.de/lizenz
13
+ * @author Bodo Schulte
14
+ */
15
+ ?>
16
+ <?php
17
+
18
+ class Etracker_Etracker_Model_Observer
19
+ {
20
+
21
+ private $_cacheCartProductCount = array();
22
+
23
+ /**
24
+ * @param Varien_Event_Observer $observer
25
+ */
26
+ public function onOrderSuccess(Varien_Event_Observer $observer) {
27
+ $orderIds = $observer->getEvent()->getOrderIds();
28
+ if (empty($orderIds) || !is_array($orderIds)) {
29
+ /* Backwards-Compatibility to < 1.4.2 */
30
+ $checkoutSingleton = Mage::getSingleton('checkout/type_onepage');
31
+ if ($checkoutSingleton) {
32
+ $process = $checkoutSingleton->getCheckout();
33
+ if ($process) {
34
+ $lastOrderId = $process->getLastOrderId();
35
+ if ($lastOrderId) $orderIds = array($lastOrderId);
36
+ }
37
+ }
38
+ if (empty($orderIds)) return;
39
+ }
40
+ Mage::register('current_order_ids', $orderIds);
41
+ }
42
+
43
+ /**
44
+ * @param Varien_Event_Observer $observer
45
+ */
46
+ public function onCustomerAuthenticated(Varien_Event_Observer $observer) {
47
+ $customer = $observer['model'];
48
+ $session = Mage::getSingleton('customer/session');
49
+ $session->setData('event_customer_login', $customer ? $customer->getId() : '');
50
+ }
51
+
52
+ /**
53
+ * @param Varien_Event_Observer $observer
54
+ */
55
+ public function onSalesQuoteAddItem(Varien_Event_Observer $observer) {
56
+ /* @var $item Mage_Sales_Model_Quote_Item */
57
+ $item = $observer['quote_item'];
58
+ if ($item) {
59
+ Etracker_Etracker_Helper_Data::log('onSalesQuoteAddItem: '.$item->getId());
60
+
61
+ /* To be used in PPR: insertToBasket/removeFromBasket identify product */
62
+ $qty = $item->getTotalQty(); // may be null!
63
+ if (!$qty) {
64
+ $qty = Mage::app()->getRequest()->getParam('qty', 1);
65
+ }
66
+ Mage::getSingleton('customer/session')->setData('event_sales_quote_add_item_product',
67
+ array($item->getProductId() => $qty));
68
+
69
+ /* To be used in PPR: provide relevant category the product has been picked from */
70
+ $categoryPath = Etracker_Etracker_Helper_Data::getFromSession(
71
+ Etracker_Etracker_Helper_Data::SESS_KEY_LAST_CAT_PROD_VIEW, $item->getProductId());
72
+ if (!$categoryPath) {
73
+ $categoryPath = Etracker_Etracker_Helper_Data::getFromSession(Etracker_Etracker_Helper_Data::SESS_KEY_LAST_CAT_VIEW, 'path');
74
+ }
75
+ if ($categoryPath) {
76
+ Etracker_Etracker_Helper_Data::setToSession(
77
+ Etracker_Etracker_Helper_Data::SESS_KEY_CART_PROD_CAT_MAP, $item->getProductId(), $categoryPath);
78
+ }
79
+ }
80
+ }
81
+
82
+ /**
83
+ * @param Varien_Event_Observer $observer
84
+ */
85
+ public function onSalesQuoteRemoveItem(Varien_Event_Observer $observer) {
86
+ /* @var $item Mage_Sales_Model_Quote_Item */
87
+ $item = $observer['quote_item'];
88
+ if ($item) {
89
+ Etracker_Etracker_Helper_Data::log('onSalesQuoteRemoveItem: '.$item->getId());
90
+ Mage::getSingleton('customer/session')->setData('event_sales_quote_remove_item_product',
91
+ array($item->getProductId() => $item->getQty()));
92
+ }
93
+ }
94
+
95
+ /**
96
+ * @param Varien_Event_Observer $observer
97
+ */
98
+ public function onCartUpdateItemsBefore(Varien_Event_Observer $observer) {
99
+ /** @var $cart Mage_Checkout_Model_Cart */
100
+ $cart = $observer['cart'];
101
+ /** @var $item Mage_Sales_Model_Quote_Item */
102
+ foreach ($cart->getItems() as $item) {
103
+ $qty = $item->getQty() ? $item->getQty() : 1;
104
+ $this->_cacheCartProductCount[$item->getProductId()] = $qty;
105
+ }
106
+ }
107
+
108
+ /**
109
+ * @param Varien_Event_Observer $observer
110
+ */
111
+ public function onCartUpdateItemsAfter(Varien_Event_Observer $observer) {
112
+ /** @var $cart Mage_Checkout_Model_Cart */
113
+ $cart = $observer['cart'];
114
+ $session = Mage::getSingleton('customer/session');
115
+ $itemsRemove = array();
116
+ $itemsAdd = array();
117
+ /** @var $item Mage_Sales_Model_Quote_Item */
118
+ foreach ($cart->getItems() as $item) {
119
+ $qty = $item->getQty();
120
+ if (isset($this->_cacheCartProductCount[$item->getProductId()])) {
121
+ $oldQty = $this->_cacheCartProductCount[$item->getProductId()];
122
+ if ($oldQty > $qty) {
123
+ $itemsRemove[$item->getProductId()] = $oldQty - $qty;
124
+ }
125
+ if ($oldQty < $qty) {
126
+ $itemsAdd[$item->getProductId()] = $qty - $oldQty;
127
+ }
128
+ }
129
+ }
130
+ if (!empty($itemsRemove)) $session->setData('event_sales_quote_remove_item_product', $itemsRemove);
131
+ if (!empty($itemsAdd)) $session->setData('event_sales_quote_add_item_product', $itemsAdd);
132
+ }
133
+
134
+
135
+ /**
136
+ * @param Varien_Event_Observer $observer
137
+ */
138
+ public function onWishlistAddProduct(Varien_Event_Observer $observer) {
139
+ $product = $observer['product'];
140
+ $session = Mage::getSingleton('customer/session');
141
+ $session->setData('event_wishlist_add_product', $product);
142
+ }
143
+
144
+
145
+ /**
146
+ * Appends a layout-configured block dynamically to an existing one.
147
+ * @param $observer
148
+ * @return $this
149
+ */
150
+ public function afterBlockOutput($observer) {
151
+ $block = $observer->getEvent()->getBlock();
152
+ $isDynamicBlockSupported = Etracker_Etracker_Helper_Data::isDynamicBlockSupported();
153
+ $transport = $observer->getEvent()->getTransport();
154
+ if(empty($transport) || !$isDynamicBlockSupported) {
155
+ return $this;
156
+ }
157
+ if ($block->getNameInLayout() == 'product.info.media' && $block->getChild('etracker_img')) {
158
+ $this->appendChildToBlock($block, $transport, 'etracker_img');
159
+ } elseif ($block->getNameInLayout() == 'checkout.onepage' && $block->getChild('etracker_onepage')) {
160
+ $this->appendChildToBlock($block, $transport, 'etracker_onepage');
161
+ } elseif ($block->getNameInLayout() == 'checkout.cart' && $block->getChild('etracker_cart')) {
162
+ $this->appendChildToBlock($block, $transport, 'etracker_cart');
163
+ }
164
+ return $this;
165
+ }
166
+
167
+ /**
168
+ * Appends the block html from the given child (childName) to the given block.
169
+ * @param $block Mage_Core_Block_Abstract
170
+ * @param $transport
171
+ * @return $this
172
+ */
173
+ public function appendChildToBlock($block, $transport, $childName) {
174
+ Etracker_Etracker_Helper_Data::log("Appending block '{$childName}'");
175
+ $originalHtml = $transport->getHtml();
176
+ $appendHtml = $block->getChildHtml($childName);
177
+ $newHtml = $originalHtml."\n".$appendHtml;
178
+ $transport->setHtml($newHtml);
179
+ return $this;
180
+ }
181
+ }
182
+ ?>
app/code/community/Etracker/Etracker/etc/adminhtml.xml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * justselling Germany Ltd. EULA
5
+ * http://www.justselling.de/
6
+ * Read the license at http://www.justselling.de/lizenz
7
+ *
8
+ * Do not edit or add to this file, please refer to http://www.justselling.de for more information.
9
+ *
10
+ * @category justselling
11
+ * @package justselling_etracker
12
+ * @copyright Copyright (c) 2013 justselling Germany Ltd. (http://www.justselling.de)
13
+ * @license http://www.justselling.de/lizenz
14
+ * @author Bodo Schulte
15
+ */
16
+ -->
17
+ <config>
18
+ <acl>
19
+ <resources>
20
+ <all>
21
+ <title>Allow Everything</title>
22
+ </all>
23
+ <admin>
24
+ <children>
25
+ <etracker>
26
+ <title>etracker</title>
27
+ <sort_order>0</sort_order>
28
+ </etracker>
29
+ <system>
30
+ <children>
31
+ <config>
32
+ <children>
33
+ <etracker translate="title" module="etracker">
34
+ <title>etracker</title>
35
+ </etracker>
36
+ </children>
37
+ </config>
38
+ </children>
39
+ </system>
40
+ </children>
41
+ </admin>
42
+ </resources>
43
+ </acl>
44
+ </config>
app/code/community/Etracker/Etracker/etc/config.xml ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * justselling Germany Ltd. EULA
5
+ * http://www.justselling.de/
6
+ * Read the license at http://www.justselling.de/lizenz
7
+ *
8
+ * Do not edit or add to this file, please refer to http://www.justselling.de for more information.
9
+ *
10
+ * @category justselling
11
+ * @package justselling_etracker
12
+ * @copyright Copyright (c) 2013 justselling Germany Ltd. (http://www.justselling.de)
13
+ * @license http://www.justselling.de/lizenz
14
+ * @author Bodo Schulte
15
+ */
16
+ -->
17
+ <config>
18
+ <modules>
19
+ <Etracker_Etracker>
20
+ <version>1.0.0</version>
21
+ </Etracker_Etracker>
22
+ </modules>
23
+ <global>
24
+ <models>
25
+ <etracker>
26
+ <class>Etracker_Etracker_Model</class>
27
+ </etracker>
28
+ </models>
29
+ <blocks>
30
+ <etracker>
31
+ <class>Etracker_Etracker_Block</class>
32
+ </etracker>
33
+ <checkout>
34
+ <!-- In case any problem occurs (regarding to other modules) with one or all of these overwritten
35
+ blocks you can simply remove them. Precondition: your Magento Version is >= 1.4.2 -->
36
+ <rewrite>
37
+ <cart>Etracker_Etracker_Block_Checkout_Cart</cart>
38
+ <onepage>Etracker_Etracker_Block_Checkout_Onepage</onepage>
39
+ </rewrite>
40
+ </checkout>
41
+ <catalog>
42
+ <!-- In case any problem occurs (regarding to other moduls) with these overwritten block you can
43
+ simply remove it. Precondition: your Magento Version is >= 1.4.2 -->
44
+ <rewrite>
45
+ <product_view_media>Etracker_Etracker_Block_Catalog_Product_View_Media</product_view_media>
46
+ </rewrite>
47
+ </catalog>
48
+ </blocks>
49
+ <helpers>
50
+ <etracker>
51
+ <class>Etracker_Etracker_Helper</class>
52
+ </etracker>
53
+ </helpers>
54
+ </global>
55
+ <frontend>
56
+ <translate>
57
+ <modules>
58
+ <Etracker_Etracker>
59
+ <files>
60
+ <default>Etracker_Etracker.csv</default>
61
+ </files>
62
+ </Etracker_Etracker>
63
+ </modules>
64
+ </translate>
65
+
66
+ <layout>
67
+ <updates>
68
+ <etracker>
69
+ <file>etracker.xml</file>
70
+ </etracker>
71
+ </updates>
72
+ </layout>
73
+ <events>
74
+ <checkout_onepage_controller_success_action>
75
+ <observers>
76
+ <etracker_order_success>
77
+ <class>etracker/observer</class>
78
+ <method>onOrderSuccess</method>
79
+ </etracker_order_success>
80
+ </observers>
81
+ </checkout_onepage_controller_success_action>
82
+ <checkout_multishipping_controller_success_action>
83
+ <observers>
84
+ <etracker_order_success2>
85
+ <class>etracker/observer</class>
86
+ <method>onOrderSuccess</method>
87
+ </etracker_order_success2>
88
+ </observers>
89
+ </checkout_multishipping_controller_success_action>
90
+ <customer_customer_authenticated>
91
+ <observers>
92
+ <etracker_customer_authenticated>
93
+ <class>etracker/observer</class>
94
+ <method>onCustomerAuthenticated</method>
95
+ </etracker_customer_authenticated>
96
+ </observers>
97
+ </customer_customer_authenticated>
98
+ <sales_quote_add_item>
99
+ <observers>
100
+ <etracker_sales_quote_add_item>
101
+ <class>etracker/observer</class>
102
+ <method>onSalesQuoteAddItem</method>
103
+ </etracker_sales_quote_add_item>
104
+ </observers>
105
+ </sales_quote_add_item>
106
+ <sales_quote_remove_item>
107
+ <observers>
108
+ <etracker_sales_quote_remove_item>
109
+ <class>etracker/observer</class>
110
+ <method>onSalesQuoteRemoveItem</method>
111
+ </etracker_sales_quote_remove_item>
112
+ </observers>
113
+ </sales_quote_remove_item>
114
+ <checkout_cart_update_items_before>
115
+ <observers>
116
+ <etracker_cart_update_items_before>
117
+ <class>etracker/observer</class>
118
+ <method>onCartUpdateItemsBefore</method>
119
+ </etracker_cart_update_items_before>
120
+ </observers>
121
+ </checkout_cart_update_items_before>
122
+ <checkout_cart_update_items_after>
123
+ <observers>
124
+ <etracker_cart_update_items_after>
125
+ <class>etracker/observer</class>
126
+ <method>onCartUpdateItemsAfter</method>
127
+ </etracker_cart_update_items_after>
128
+ </observers>
129
+ </checkout_cart_update_items_after>
130
+ <wishlist_add_product>
131
+ <observers>
132
+ <etracker_wishlist_add_product>
133
+ <class>etracker/observer</class>
134
+ <method>onWishlistAddProduct</method>
135
+ </etracker_wishlist_add_product>
136
+ </observers>
137
+ </wishlist_add_product>
138
+ <core_block_abstract_to_html_after>
139
+ <observers>
140
+ <etracker_model_observer_block_output>
141
+ <type>singleton</type>
142
+ <class>etracker/observer</class>
143
+ <method>afterBlockOutput</method>
144
+ </etracker_model_observer_block_output>
145
+ </observers>
146
+ </core_block_abstract_to_html_after>
147
+ </events>
148
+ </frontend>
149
+
150
+ <adminhtml>
151
+ <translate>
152
+ <modules>
153
+ <Etracker_Etracker>
154
+ <files>
155
+ <default>Etracker_Etracker.csv</default>
156
+ </files>
157
+ </Etracker_Etracker>
158
+ </modules>
159
+ </translate>
160
+ </adminhtml>
161
+ <default>
162
+ <etracker>
163
+ <standard>
164
+ <active>1</active>
165
+ <async>1</async>
166
+ </standard>
167
+ </etracker>
168
+ </default>
169
+ </config>
app/code/community/Etracker/Etracker/etc/system.xml ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * justselling Germany Ltd. EULA
5
+ * http://www.justselling.de/
6
+ * Read the license at http://www.justselling.de/lizenz
7
+ *
8
+ * Do not edit or add to this file, please refer to http://www.justselling.de for more information.
9
+ *
10
+ * @category justselling
11
+ * @package justselling_etracker
12
+ * @copyright Copyright (c) 2013 justselling Germany Ltd. (http://www.justselling.de)
13
+ * @license http://www.justselling.de/lizenz
14
+ * @author Bodo Schulte
15
+ */
16
+ -->
17
+ <config>
18
+ <sections>
19
+ <etracker translate="label" module="etracker">
20
+ <label>etracker</label>
21
+ <tab>general</tab>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>340</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <groups>
28
+ <general translate="label">
29
+ <label>General Settings</label>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>10</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <fields>
36
+ <account translate="label">
37
+ <label>etracker security code</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>20</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ <comment>Please enter the security code here to overall enable tracking. You'll find the code online in Settings > Setup/Tracking code > etracker security code.</comment>
44
+ </account>
45
+ <cckey>
46
+ <label>Campaign Control secure key</label>
47
+ <frontend_type>text</frontend_type>
48
+ <sort_order>20</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ <comment>Please request your Campaign Control secure key from etracker.</comment>
53
+ </cckey>
54
+ <tax translate="label">
55
+ <label>Submit prices/amounts</label>
56
+ <frontend_type>select</frontend_type>
57
+ <source_model>etracker/admin_system_config_source_inclTax</source_model>
58
+ <sort_order>40</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </tax>
63
+ </fields>
64
+ </general>
65
+ <standard translate="label">
66
+ <label>Tracking Settings</label>
67
+ <frontend_type>text</frontend_type>
68
+ <sort_order>20</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ <fields>
73
+ <active translate="label">
74
+ <label>Integrate tracking code?</label>
75
+ <frontend_type>select</frontend_type>
76
+ <source_model>adminhtml/system_config_source_yesno</source_model>
77
+ <sort_order>10</sort_order>
78
+ <show_in_default>1</show_in_default>
79
+ <show_in_website>1</show_in_website>
80
+ <show_in_store>1</show_in_store>
81
+ <comment>In case you already have the standard tracking code integrated you should set 'No' here.</comment>
82
+ </active>
83
+ <async translate="label">
84
+ <label>Activate asynchronous tracking?</label>
85
+ <frontend_type>select</frontend_type>
86
+ <source_model>adminhtml/system_config_source_yesno</source_model>
87
+ <sort_order>20</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
+ </async>
92
+ <storeviewcode translate="label">
93
+ <label>Activate StoreView code as area prefix?</label>
94
+ <frontend_type>select</frontend_type>
95
+ <source_model>adminhtml/system_config_source_yesno</source_model>
96
+ <sort_order>30</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ <comment>Should the StoreView code be set as prefix to the area path? Example: 'UK/products/product_a' instead of 'products/product_a', if your StoreView code is 'UK'.</comment>
101
+ </storeviewcode>
102
+ </fields>
103
+ </standard>
104
+ <ecommerce translate="label">
105
+ <label>Product Performance Reports (PPR)</label>
106
+ <frontend_type>text</frontend_type>
107
+ <sort_order>30</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ <fields>
112
+ <active translate="label">
113
+ <label>Enable PPR?</label>
114
+ <frontend_type>select</frontend_type>
115
+ <source_model>adminhtml/system_config_source_yesno</source_model>
116
+ <sort_order>10</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ <comment>If enabled, please ensure integrated standard tracking (above) OR existing tracking code equal or greater version 3.0.</comment>
121
+ </active>
122
+ <debug translate="label">
123
+ <label>Activate debug?</label>
124
+ <frontend_type>select</frontend_type>
125
+ <source_model>adminhtml/system_config_source_yesno</source_model>
126
+ <sort_order>20</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>1</show_in_store>
130
+ <comment>If activated, debug data is printed to the browser console (instead of submitting it to etracker).</comment>
131
+ </debug>
132
+ </fields>
133
+ </ecommerce>
134
+ <developer translate="label">
135
+ <label>Developer</label>
136
+ <frontend_type>text</frontend_type>
137
+ <sort_order>100</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <fields>
140
+ <log translate="label">
141
+ <label>Activate logging?</label>
142
+ <frontend_type>select</frontend_type>
143
+ <source_model>adminhtml/system_config_source_yesno</source_model>
144
+ <sort_order>10</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <comment>If activated, log will be written to file 'etracker.log'.</comment>
147
+ </log>
148
+ </fields>
149
+ </developer>
150
+ </groups>
151
+ </etracker>
152
+ </sections>
153
+ </config>
app/design/frontend/base/default/layout/etracker.xml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category design
23
+ * @package base_default
24
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+
28
+ -->
29
+ <layout version="0.1.0">
30
+ <default>
31
+ <reference name="after_body_start">
32
+ <block type="etracker/track" name="etracker" template="etracker/track.phtml" />
33
+ <block type="etracker/track" name="etracker_ppr" template="etracker/ppr.phtml" />
34
+ </reference>
35
+ </default>
36
+
37
+ <checkout_cart_index translate="label">
38
+ <reference name="checkout.cart">
39
+ <block type="etracker/track" name="etracker_cart" template="etracker/checkout/cart.phtml"/>
40
+ </reference>
41
+ </checkout_cart_index>
42
+
43
+ <checkout_onepage_index translate="label">
44
+ <reference name="checkout.onepage">
45
+ <!--<action method="setTemplate"><value>etracker/checkout/onepage.phtml</value></action>-->
46
+ <block type="checkout/onepage" name="etracker_onepage" template="etracker/checkout/et_onepage.phtml"/>
47
+ </reference>
48
+ </checkout_onepage_index>
49
+
50
+ <catalog_product_view translate="label">
51
+ <reference name="product.info.media">
52
+ <block type="etracker/track" name="etracker_img" template="etracker/product_media.phtml"/>
53
+ </reference>
54
+ </catalog_product_view>
55
+
56
+ </layout>
app/design/frontend/base/default/template/etracker/checkout/cart.phtml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->isPprActive()): ?>
2
+ <?php /* @var $cart Mage_Sales_Model_Quote */ ?>
3
+ <?php $cart = Mage::getSingleton('checkout/session')->getQuote(); ?>
4
+ <?php if ($cart): ?>
5
+ <?php $products = array(); ?>
6
+ <?php /* @var $item Mage_Sales_Model_Quote_Item */ ?>
7
+ <?php foreach($cart->getAllVisibleItems() as $item): ?>
8
+ <?php $products[$item->getProductId()] = $item->getQty() ? $item->getQty() : 1; ?>
9
+ <?php endforeach; ?>
10
+ <?php Mage::getSingleton('customer/session')->setData('event_sales_quote_remove_item_product', $products); ?>
11
+
12
+ <?php if ($items = $this->getPprRemoveFromBasketProductData()): ?>
13
+ <script type="text/javascript">
14
+ $$('button#empty_cart_button').each(function(element) {
15
+ element.onmouseup = function() {
16
+ <?php $i=0; foreach($items as $data): ?>
17
+ var rem_product_<?php echo $i ?> = <?php echo Mage::helper('core')->jsonEncode($data['data']) ?>;
18
+ etCommerce.sendEvent('removeFromBasket', rem_product_<?php echo $i ?>, <?php echo $data['qty'] ?>, '<?php echo $this->getQuoteId() ?>');
19
+ <?php $i++; ?>
20
+ <?php endforeach; ?>
21
+ }
22
+ });
23
+ </script>
24
+ <?php endif ?>
25
+
26
+ <?php endif; ?>
27
+ <?php endif; ?>
app/design/frontend/base/default/template/etracker/checkout/et_onepage.phtml ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function getIsCheckoutCartViewed() {
3
+ $session = Mage::getSingleton('core/session');
4
+ $isBasketViewed = $session->getData(Etracker_Etracker_Helper_Data::SESS_KEY_LAST_CART_VIEW);
5
+ if ($isBasketViewed) {
6
+ $session->unsetData(Etracker_Etracker_Helper_Data::SESS_KEY_LAST_CART_VIEW);
7
+ return true;
8
+ }
9
+ return false;
10
+ }
11
+ function isCustomerLoginRegistered() {
12
+ $session = Mage::getSingleton('customer/session');
13
+ $isLoginRegistered = $session->getData('event_customer_login');
14
+ if (!$isLoginRegistered) {
15
+ $isLoginRegistered = Mage::registry('event_customer_login');
16
+ }
17
+ return !empty($isLoginRegistered);
18
+ }
19
+
20
+
21
+ ?>
22
+
23
+ <script type="text/javascript">
24
+ var steps = new Array();
25
+ var cart = "<?php echo Mage::helper('etracker')->__('Cart') ?>";
26
+ var areas = "<?php echo Mage::helper('etracker')->__('Checkout') .'/'. Mage::helper('etracker')->__('Onepage') ?>";
27
+ var target = cart + "/<?php echo Mage::helper('etracker')->__('Onepage') ?>";
28
+ <?php foreach($this->getSteps() as $_stepId => $_stepInfo): ?>
29
+ steps["<?php echo $_stepId ?>"] = "<?php echo $_stepInfo['label'] ?>";
30
+ <?php endforeach; ?>
31
+ <?php $steps = $this->getSteps(); ?>
32
+ <?php $activeStep = $steps[$this->getActiveStep()]; ?>
33
+ targetPath = target + "/<?php echo $activeStep['label'] ?>";
34
+ try {
35
+ <?php if (!getIsCheckoutCartViewed() && !isCustomerLoginRegistered()): ?>
36
+ //alert('Wrapper: '+ areas + ' * ' + cart);
37
+ et_eC_Wrapper("<?php echo Mage::helper('etracker')->getSecurityCode() ?>", cart, areas, "", "", cart);
38
+ <?php endif; ?>
39
+
40
+ <?php if (!isCustomerLoginRegistered()): ?>
41
+ //alert('Wrapper: '+ areas + ' * ' + target);
42
+ et_eC_Wrapper("<?php echo Mage::helper('etracker')->getSecurityCode() ?>", areas, areas, "", "", target);
43
+ <?php endif; ?>
44
+
45
+ //alert('Wrapper: '+ areas + ' * ' + targetPath);
46
+ et_eC_Wrapper("<?php echo Mage::helper('etracker')->getSecurityCode() ?>", "<?php echo $activeStep['label'] ?>", areas, "", "", targetPath);
47
+ } catch(err) { }
48
+
49
+ <?php if ($ccKey = Mage::helper('etracker')->getCcKey()): ?>
50
+ try {
51
+ et_cc_wrapper("<?php echo $ccKey ?>", {cc_pagename:"<?php echo $activeStep['label'] ?>"});
52
+ } catch(err) { }
53
+ <?php endif; ?>
54
+
55
+ var stepsDone = new Array("login", "billing");
56
+ Checkout.prototype.gotoSection = function(section) {
57
+ var stepVirtWrap = new Array();
58
+ var targetCurrent = target;
59
+ for (var key in steps) {
60
+ //alert('For section '+ section + ': ' + key + '->' + steps[key]);
61
+ targetCurrent += "/"+steps[key];
62
+ if (key == section) {
63
+ stepsDone.push(key);
64
+ break;
65
+ } else {
66
+ if (stepsDone.indexOf(key) == -1) {
67
+ //alert('setting virt wrap section='+key + ' / target='+targetCurrent);
68
+ stepVirtWrap['section'] = key;
69
+ stepVirtWrap['target'] = targetCurrent;
70
+ stepsDone.push(key);
71
+ }
72
+ }
73
+ }
74
+ if (stepVirtWrap['section']) {
75
+ try {
76
+ //alert('Virtual step: '+stepVirtWrap['target'] + ', pagename = ' + steps[stepVirtWrap['section']]);
77
+ et_eC_Wrapper("<?php echo Mage::helper('etracker')->getSecurityCode() ?>", steps[stepVirtWrap['section']], areas, "", "", stepVirtWrap['target']);
78
+ <?php if ($ccKey = Mage::helper('etracker')->getCcKey()): ?>
79
+ et_cc_wrapper("<?php echo $ccKey ?>", {cc_pagename:steps[stepVirtWrap['section']]});
80
+ <?php endif; ?>
81
+ } catch (err) { }
82
+ }
83
+ try {
84
+ //alert('Usual step: ' + targetCurrent);
85
+ et_eC_Wrapper("<?php echo Mage::helper('etracker')->getSecurityCode() ?>", steps[section], areas, "", "", targetCurrent);
86
+ } catch(err) { }
87
+
88
+ <?php if ($ccKey = Mage::helper('etracker')->getCcKey()): ?>
89
+ try {
90
+ et_cc_wrapper("<?php echo $ccKey ?>", {cc_pagename:steps[section]});
91
+ } catch(err) { }
92
+ <?php endif; ?>
93
+
94
+ section = $('opc-'+section);
95
+ section.addClassName('allow');
96
+ this.accordion.openSection(section);
97
+ };
98
+ </script>
app/design/frontend/base/default/template/etracker/ppr.phtml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * justselling Germany Ltd. EULA
4
+ * http://www.justselling.de/
5
+ * Read the license at http://www.justselling.de/lizenz
6
+ *
7
+ * Do not edit or add to this file, please refer to http://www.justselling.de for more information.
8
+ *
9
+ * @category justselling
10
+ * @package justselling_etracker
11
+ * @copyright Copyright (c) 2013 justselling Germany Ltd. (http://www.justselling.de)
12
+ * @license http://www.justselling.de/lizenz
13
+ * @author Bodo Schulte
14
+ */
15
+
16
+ /* @var $this Etracker_Etracker_Block_Track */
17
+ $helper = Mage::helper('etracker');
18
+ ?>
19
+ <script type="text/javascript">
20
+ if (typeof etCommerce != "object") {
21
+ etCommerce = {
22
+ sendEvent: function() {},
23
+ attachEvent: function() {}
24
+ };
25
+ }
26
+ </script>
27
+
28
+
29
+ <?php if ($this->isPprActive()): ?>
30
+
31
+ <?php if ($this->isPprDebugActive() && !$this->isAsyncActive()): ?>
32
+ <script type="text/javascript">
33
+ etCommerce.debugMode = true;
34
+ </script>
35
+ <?php endif; ?>
36
+
37
+ <script type="text/javascript">
38
+ var etCommercePrepareEvents = [];
39
+ <?php if ($product = $this->getPprViewProductData()): ?>
40
+ var product = <?php echo Mage::helper('core')->jsonEncode($product) ?>;
41
+ <?php if ($this->isAsyncActive()): ?>
42
+ etCommercePrepareEvents.push(['sendEvent', 'viewProduct', product, '<?php echo $this->getQuoteId() ?>']);
43
+ <?php else: ?>
44
+ etCommerce.sendEvent('viewProduct', product, '<?php echo $this->getQuoteId() ?>');
45
+ <?php endif; ?>
46
+ <?php endif ?>
47
+ <?php if ($items = $this->getPprInsertToBasketProductData()): ?>
48
+ <?php $i=0; foreach($items as $data): ?>
49
+ var add_product_<?php echo $i ?> = <?php echo Mage::helper('core')->jsonEncode($data['data']) ?>;
50
+ <?php if ($this->isAsyncActive()): ?>
51
+ etCommercePrepareEvents.push(['sendEvent', 'insertToBasket', add_product_<?php echo $i ?>, <?php echo $data['qty'] ?>, '<?php echo $this->getQuoteId() ?>']);
52
+ <?php else: ?>
53
+ etCommerce.sendEvent('insertToBasket', add_product_<?php echo $i ?>, <?php echo $data['qty'] ?>, '<?php echo $this->getQuoteId() ?>');
54
+ <?php endif; ?>
55
+ <?php $i++; ?>
56
+ <?php endforeach; ?>
57
+ <?php endif ?>
58
+ <?php if ($items = $this->getPprRemoveFromBasketProductData()): ?>
59
+ <?php $i=0; foreach($items as $data): ?>
60
+ var rem_product_<?php echo $i ?> = <?php echo Mage::helper('core')->jsonEncode($data['data']) ?>;
61
+ <?php if ($this->isAsyncActive()): ?>
62
+ etCommercePrepareEvents.push(['sendEvent', 'removeFromBasket', rem_product_<?php echo $i ?>, <?php echo $data['qty'] ?>, '<?php echo $this->getQuoteId() ?>']);
63
+ <?php else: ?>
64
+ etCommerce.sendEvent('removeFromBasket', rem_product_<?php echo $i ?>, <?php echo $data['qty'] ?>, '<?php echo $this->getQuoteId() ?>');
65
+ <?php endif; ?>
66
+ <?php $i++; ?>
67
+ <?php endforeach; ?>
68
+ <?php endif ?>
69
+ <?php if ($data = $this->getPprOrderData()): ?>
70
+ var order = <?php echo Mage::helper('core')->jsonEncode($data) ?>;
71
+ <?php if ($this->isAsyncActive()): ?>
72
+ etCommercePrepareEvents.push(['sendEvent', 'order', order]);
73
+ <?php else: ?>
74
+ etCommerce.sendEvent('order', order);
75
+ <?php endif; ?>
76
+ <?php endif; ?>
77
+ </script>
78
+ <?php endif; ?>
app/design/frontend/base/default/template/etracker/product_media.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * justselling Germany Ltd. EULA
4
+ * http://www.justselling.de/
5
+ * Read the license at http://www.justselling.de/lizenz
6
+ *
7
+ * Do not edit or add to this file, please refer to http://www.justselling.de for more information.
8
+ *
9
+ * @category justselling
10
+ * @package justselling_etracker
11
+ * @copyright Copyright (c) 2013 justselling Germany Ltd. (http://www.justselling.de)
12
+ * @license http://www.justselling.de/lizenz
13
+ * @author Bodo Schulte
14
+ */
15
+ ?>
16
+
17
+ <?php $product = Mage::registry('current_product'); ?>
18
+ <?php if ($product): ?>
19
+ <script>
20
+ $$('div.more-views a').each(function(element){
21
+ element.onmouseup = function() {
22
+ ET_Event.eventStart('<?php echo $this->jsTranslAndEscape('Product Image') ?>', '<?php echo $this->jsTranslAndEscape('Product').'#'.$product->getSku() ?>', '<?php echo $this->jsTranslAndEscape('Zoom') ?>');
23
+ return false;
24
+ }
25
+
26
+ })
27
+ $$('img#image').each(function(element) {
28
+ element.ondblclick = function() {
29
+ ET_Event.eventStart('<?php echo $this->jsTranslAndEscape('Product Main Image') ?>', '<?php echo $this->jsTranslAndEscape('Product').'#'.$product->getSku() ?>', '<?php echo $this->jsTranslAndEscape('Zoom') ?>');
30
+ return false;
31
+ }
32
+ })
33
+ </script>
34
+ <?php endif; ?>
app/design/frontend/base/default/template/etracker/track.phtml ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * justselling Germany Ltd. EULA
4
+ * http://www.justselling.de/
5
+ * Read the license at http://www.justselling.de/lizenz
6
+ *
7
+ * Do not edit or add to this file, please refer to http://www.justselling.de for more information.
8
+ *
9
+ * @category justselling
10
+ * @package justselling_etracker
11
+ * @copyright Copyright (c) 2013 justselling Germany Ltd. (http://www.justselling.de)
12
+ * @license http://www.justselling.de/lizenz
13
+ * @author Bodo Schulte
14
+ */
15
+
16
+ /* @var $this Etracker_Etracker_Block_Track */
17
+ $helper = Mage::helper('etracker');
18
+ ?>
19
+ <?php if ($this->isEnabled()): ?>
20
+
21
+ <?php if ($this->isAsyncActive()): ?>
22
+ <script type="text/javascript">
23
+ var clfuncs = [];
24
+ var funcs = [];
25
+ var ET_Event = {
26
+ loginSuccess: function() { clfuncs.push(['ET_Event', 'loginSuccess', arguments])},
27
+ eventStart: function() { clfuncs.push(['ET_Event', 'eventStart', arguments]) }
28
+ }
29
+ var et_eC_Wrapper = function() { funcs.push(['et_eC_Wrapper', arguments]) };
30
+ var et_cc_wrapper = function() { funcs.push(['et_cc_wrapper', arguments]) };
31
+ </script>
32
+ <?php endif; ?>
33
+
34
+ <?php if ($this->isTrackingCodeToBeIncluded()): ?>
35
+ <?php if ($this->isAsyncActive()): ?>
36
+ <!-- BEGIN etracker Tracklet 3.0 async -->
37
+
38
+ <script type="text/javascript">
39
+ function delayedTrack() {
40
+ try {
41
+ clfuncs.forEach( function (item) {
42
+ var etdf = item[1];
43
+ var obj = window[item[0]];
44
+ switch (item[2].length) {
45
+ case 0: obj[etdf](); break;
46
+ case 1: obj[etdf](item[2][0]); break;
47
+ case 2: obj[etdf](item[2][0], item[2][1]); break;
48
+ default: obj[etdf](item[2][0], item[2][1], item[2][2]); break;
49
+ };
50
+ });
51
+ clfuncs = [];
52
+ funcs.forEach( function(item) {
53
+ var obj = window[item[0]];
54
+ obj.apply(null, item[1]);
55
+ });
56
+ funcs = [];
57
+ } catch (err) { }
58
+ }
59
+ </script>
60
+
61
+ <script type="text/javascript">
62
+ function et_params() {
63
+ delayedTrack();
64
+ et_pagename = "<?php echo rawurlencode($this->getPageName()) ?>";
65
+ et_areas = "<?php echo rawurlencode($this->getAreas()) ?>";
66
+ <?php if ($this->isCheckoutCartView() || $this->isCheckout('multishipping') || $this->isCheckoutSuccess()): ?>
67
+ et_target = "<?php echo rawurlencode($this->_getOrdersEtTarget()) ?>";
68
+ <?php endif; ?>
69
+ <?php if ($this->_getOrdersIdTrackingCode()) : ?>
70
+ et_tsale = "<?php echo rawurlencode($this->_getOrderTsale()) ?>";
71
+ et_tval = "<?php echo rawurlencode($this->_getOrdersValueTrackingCode()) ?>";
72
+ et_tonr = "<?php echo rawurlencode($this->_getOrdersIdTrackingCode()) ?>";
73
+ et_basket = "<?php echo rawurlencode($this->_getOrdersBasketTrackingCode()) ?>";
74
+ <?php endif; ?>
75
+ <?php if ($this->isPprActive() && $this->isPprDebugActive()): ?>
76
+ etCommerce.debugMode = true;
77
+ <?php endif; ?>
78
+ }
79
+ </script>
80
+
81
+ <script type="text/javascript">
82
+ (function(){
83
+ var et_init = function(){
84
+ var et = document.createElement('script');
85
+ et.src = 'http'+('https:'==document.location.protocol?'s':'') +'://code.etracker.com/a.js?et=<?php echo $this->getSecurityCode() ?>';
86
+ var head = document.getElementsByTagName('head')[0]; head.insertBefore(et, head.firstChild);
87
+ };
88
+ window.addEventListener
89
+ ? window.addEventListener('load', et_init, false)
90
+ : window.attachEvent('onload', et_init);
91
+ })();
92
+ </script>
93
+
94
+ <!-- etracker CODE NOSCRIPT 3.0 -->
95
+ <noscript>
96
+ <p style="display:none;"><a href='https://www.etracker.de/app?et=<?php echo $this->getSecurityCode() ?>'>
97
+ <img style='border:0px;' alt='' src='https://www.etracker.de/cnt.php?et=<?php echo $this->getSecurityCode() ?>&amp;v=3.0&amp;java=n&amp;et_easy=0&amp;et_pagename=<?php echo rawurlencode($this->getPageName()) ?>&amp;et_areas=<?php echo rawurlencode($this->getAreas()) ?>&amp;et_target=<?php echo rawurlencode($this->_getOrdersEtTarget()) ?>&amp;et_basket=<?php echo rawurlencode($this->_getOrdersBasketTrackingCode()) ?>&amp;et_tonr=<?php echo rawurlencode($this->_getOrdersIdTrackingCode()) ?>&amp;et_tval=<?php echo rawurlencode($this->_getOrdersValueTrackingCode())?>&amp;et_tsale=<?php echo rawurlencode($this->_getOrderTsale()) ?>' /></a></p>
98
+ </noscript>
99
+ <!-- etracker CODE NOSCRIPT END-->
100
+ <!-- etracker Tracklet END -->
101
+
102
+ <?php else: // is async active? ?>
103
+
104
+ <!-- Copyright (c) 2000-2013 etracker GmbH. All rights reserved. -->
105
+ <!-- This material may not be reproduced, displayed, modified or distributed -->
106
+ <!-- without the express prior written permission of the copyright holder. -->
107
+
108
+ <!-- BEGIN etracker Tracklet 3.0 -->
109
+ <script type="text/javascript">document.write(String.fromCharCode(60)+'script type="text/javascript" src="http'+("https:"==document.location.protocol?"s":"")+'://code.etracker.com/t.js?et=<?php echo $this->getSecurityCode() ?>">'+String.fromCharCode(60)+'/script>');</script>
110
+
111
+ <!-- etracker PARAMETER 3.0 -->
112
+ <script type="text/javascript">
113
+ var et_pagename = "<?php echo rawurlencode($this->getPageName()) ?>";
114
+ var et_areas = "<?php echo rawurlencode($this->getAreas()) ?>";
115
+ <?php if ($this->isCheckoutCartView() || $this->isCheckout('multishipping') || $this->isCheckoutSuccess()): ?>
116
+ var et_target = "<?php echo rawurlencode($this->_getOrdersEtTarget()) ?>";
117
+ <?php endif; ?>
118
+ <?php if ($this->_getOrdersIdTrackingCode()) : ?>
119
+ var et_tsale = "<?php echo rawurlencode($this->_getOrderTsale()); ?>";
120
+ var et_tval = "<?php echo rawurlencode($this->_getOrdersValueTrackingCode()); ?>";
121
+ var et_tonr = "<?php echo rawurlencode($this->_getOrdersIdTrackingCode()); ?>";
122
+ var et_basket = "<?php echo rawurlencode($this->_getOrdersBasketTrackingCode()); ?>";
123
+ <?php endif; ?>
124
+ </script>
125
+ <!-- etracker PARAMETER END -->
126
+
127
+ <script type="text/javascript">_etc();</script>
128
+
129
+ <noscript>
130
+ <p style="display:none;"><a href='https://www.etracker.de/app?et=<?php echo $this->getSecurityCode() ?>'>
131
+ <img style='border:0px;' alt='' src='https://www.etracker.de/cnt.php?et=<?php echo $this->getSecurityCode() ?>&amp;v=3.0&amp;java=n&amp;et_easy=0&amp;et_pagename=<?php echo rawurlencode($this->getPageName()) ?>&amp;et_areas=<?php echo rawurlencode($this->getAreas()) ?>&amp;et_target=<?php echo rawurlencode($this->_getOrdersEtTarget()) ?>&amp;et_basket=<?php echo rawurlencode($this->_getOrdersBasketTrackingCode()) ?>&amp;et_tonr=<?php echo rawurlencode($this->_getOrdersIdTrackingCode()) ?>&amp;et_tval=<?php echo rawurlencode($this->_getOrdersValueTrackingCode())?>&amp;et_tsale=<?php echo rawurlencode($this->_getOrderTsale()) ?>' /></a></p>
132
+ </noscript>
133
+ <!-- etracker CODE NOSCRIPT END-->
134
+ <!-- etracker CODE END -->
135
+
136
+ <?php endif; // end is async active ?>
137
+
138
+
139
+ <?php if ($this->isCheckout('multishipping') && $this->getCcKey()): ?>
140
+ <script type="text/javascript">
141
+ et_cc_wrapper('<?php echo $this->getCcKey() ?>', {cc_pagename:"<?php echo $this->getPageName() ?>"});
142
+ </script>
143
+ <?php endif; ?>
144
+
145
+ <?php if ($this->isCheckout('multishipping') && $this->isCheckoutMultiShippingFirstStep()): ?>
146
+ <script type="text/javascript">
147
+ var pagename = '<?php echo $helper->__('Checkout').'_'.$helper->__('Multishipping') ?>';
148
+ var target = '<?php echo $helper->__('Cart').'/'.$helper->__('Multishipping') ?>';
149
+ et_eC_Wrapper('<?php echo $this->getSecurityCode() ?>', pagename, "<?php echo $this->getAreas() ?>", "", "", target);
150
+ </script>
151
+ <?php endif; ?>
152
+
153
+ <?php /* Even in case the standard-code is deactivated, this Events are triggered */ ?>
154
+ <?php if ($value = $this->isEventRegistered('event_customer_login', true)): ?>
155
+ <script type="text/javascript">
156
+ ET_Event.loginSuccess('<?php echo $this->jsTranslAndEscape('Customer').'#'.$value ?>', '');
157
+ </script>
158
+ <?php endif; ?>
159
+
160
+ <?php if ($product = $this->isEventRegistered('event_wishlist_add_product')): ?>
161
+ <?php $productId = $product ? $product->getSku() : ''; ?>
162
+ <script type="text/javascript">
163
+ ET_Event.eventStart('<?php echo $this->jsTranslAndEscape('Wishlist') ?>', '<?php echo $this->jsTranslAndEscape('Product').' '.$productId ?>', '<?php echo $this->jsTranslAndEscape('Add Product') ?>');
164
+ </script>
165
+ <?php endif; ?>
166
+
167
+ <?php endif; // isTrackingCodeToBeIncluded ?>
168
+
169
+ <?php endif; // isEnabled ?>
app/etc/modules/Etracker_Etracker.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Etracker_Etracker>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Etracker_Etracker>
8
+ </modules>
9
+ </config>
app/locale/de_DE/Etracker_Etracker.csv ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "checkout","Checkout"
2
+ "cart","Warenkorb"
3
+ "cms","CMS-Seite"
4
+ "catalogsearch","Suche"
5
+ "product_compare","Produktvergleich"
6
+ "result","Ergebnis"
7
+ "Order Success","Bestellung"
8
+ "Discount","Rabatt"
9
+ "Discounts","Rabatte"
10
+ "Coupons","Gutscheine"
11
+ "etracker security code","etracker Sicherheitscode"
12
+ "Please enter the security code here to overall enable tracking. You'll find the code online in Settings > Setup/Tracking code > etracker security code.","Bitte geben Sie hier den Sicherheitscode ein, um das Tracking generell zu ermöglichen. Sie finden den Code online unter <b>Einstellungen > Setup/Tracking Code > etracker Sicherheitscode</b>"
13
+ "Campaign Control secure key","Sicherheitsschlüssel für Campaign Control"
14
+ "Please request your Campaign Control secure key from etracker.","Bitte fordern Sie Ihren Sicherheitsschlüssel für Campaign Control bei etracker an."
15
+ "Submit prices/amounts","Übergabe von Preisen/Beträgen"
16
+ "Tracking Settings","Einstellungen zum Tracking"
17
+ "Integrate tracking code?","Tracking Code integrieren?"
18
+ "In case you already have the standard tracking code integrated you should set 'No' here.","Falls Sie den Standard-Tracking-Code schon integriert haben, sollten Sie hier 'Nein' wählen."
19
+ "Activate asynchronous tracking?","Asynchrones Tracking aktivieren?"
20
+ "Activate StoreView code as area prefix?","StoreView Code als Area-Präfix aktivieren?"
21
+ "Should the StoreView code be set as prefix to the area path? Example: 'UK/products/product_a' instead of 'products/product_a', if your StoreView code is 'UK'.","Soll der StoreView Code als Präfix vor den Area-Pfad gesetzt werden? Beispiel: 'UK/products/product_a' statt 'products/product_a', wenn Ihr StoreView Code 'UK' ist."
22
+ "Enable PPR?","PPR aktivieren?"
23
+ "If enabled, please ensure integrated standard tracking (above) OR existing tracking code equal or greater version 3.0.","Bei Aktivierung bitte sicherstellen, dass der Standard-Tracking-Code integriert ist (siehe oben) ODER die existierende Tracking Code Version 3.0 oder höher integriert ist."
24
+ "Activate debug?","Debug aktivieren?"
25
+ "If activated, debug data is printed to the browser console (instead of submitting it to etracker).","Bei Aktivierung werden die Debug-Daten in der Browser-Konsole ausgegeben (anstatt sie an etracker zu senden)."
26
+ "Activate logging?","Protokollierung aktivieren?"
27
+ "If activated, log will be written to file 'etracker.log'.","Bei Aktivierung wird das Protokoll in die Datei 'etracker.log' geschrieben."
28
+
29
+
app/locale/en_US/Etracker_Etracker.csv ADDED
@@ -0,0 +1,2 @@
 
 
1
+ "catalogsearch","Search"
2
+ "cms","CMS-Page"
package.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>etracker_connect</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Gezielte Shop-Analyse mit den etracker Optimisation Suites.</summary>
10
+ <description>&lt;p&gt;&#xD;
11
+ Die etracker GmbH aus Hamburg ist mit mehr als 110.000 Kunden ein in Europa f&#xFC;hrender Anbieter von Produkten und Dienstleistungen zur Optimierung von Online-Shops, Websites und Online-Marketing-Ma&#xDF;nahmen.&#xD;
12
+ &lt;/p&gt;&#xD;
13
+ &lt;p&gt;&#xD;
14
+ Die etracker Optimisation Suites integrieren alle f&#xFC;r die jeweilige Zielgruppe wichtigen Funktionalit&#xE4;ten zur &lt;strong&gt;Marketing-, Usability-, Zufriedenheits-, Web- und Shop-Optimierung&lt;/strong&gt;, und wurden bereits mehrfach mit Innovationspreisen ausgezeichnet. Die L&#xF6;sungen &#xFC;berzeugen zudem durch ihr hervorragendes Preis-Leistungs-Verh&#xE4;ltnis, sind wahlweise im SaaS-Modell oder als Inhouse-L&#xF6;sung erh&#xE4;ltlich &#x2013; und sie sind zu 100 Prozent datenschutzkonform.&#xD;
15
+ &lt;/p&gt;&#xD;
16
+ &lt;h3&gt;1 Extension, 5 Produkte&lt;/h3&gt;&#xD;
17
+ &lt;ul&gt;&#xD;
18
+ &lt;li&gt;Campaign Control (inklusive Product Performance Report)&lt;/li&gt;&#xD;
19
+ &lt;li&gt;Visitor Motion&lt;/li&gt;&#xD;
20
+ &lt;li&gt;Visitor Voice&lt;/li&gt;&#xD;
21
+ &lt;li&gt;Page Feedback&lt;/li&gt;&#xD;
22
+ &lt;li&gt;Web Analytics&lt;/li&gt;&#xD;
23
+ &lt;/ul&gt;&#xD;
24
+ &#xD;
25
+ &lt;h3&gt;Highlight: Product Performance Report&lt;/h3&gt;&#xD;
26
+ &lt;p&gt;&#xD;
27
+ Die etracker Extension erm&#xF6;glicht Ihnen die einfache Integration des neuen Product Performance Reports. Die Extension &#xFC;bernimmt hierf&#xFC;r automatisch die korrekte &#xDC;bergabe der wichtigsten Events des Einkaufs &#x2013; Produkt gesehen, Produkt in den Warenkorb gelegt, Produkt aus dem Warenkorb gel&#xF6;scht, Produkt bestellt und gegebenenfalls Produkt retourniert. So k&#xF6;nnen Sie auf sehr intelligente und einfache Art und Weise die &lt;strong&gt;Sortimentsgestaltung&lt;/strong&gt; mit der &lt;strong&gt;Marketing-Kommunikation&lt;/strong&gt; und &lt;strong&gt;Shop-Optimierung&lt;/strong&gt; verbinden.&#xD;
28
+ &lt;/p&gt;&#xD;
29
+ &lt;p&gt;&#xD;
30
+ Hierbei kommt die innovative High-Performance Technologie etracker &lt;strong&gt;Dynamic Discovery&lt;/strong&gt; zum Einsatz, mit der Sie selbst gro&#xDF;e Datenmengen auf jeder beliebigen Detailebene in Sekundenschnelle analysieren. Sie k&#xF6;nnen die Analyse-Perspektive via &lt;strong&gt;Drag</description>
31
+ <notes>Initial Stable Version</notes>
32
+ <authors><author><name>Justselling Germany Limited</name><user>auto-converted</user><email>info@justselling.de</email></author></authors>
33
+ <date>2013-08-12</date>
34
+ <time>14:50:29</time>
35
+ <contents><target name="magecommunity"><dir name="Etracker"><dir name="Etracker"><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="View"><file name="Media.php" hash="5a13620e6fd24ef3757d7fd33d6a3a89"/></dir></dir></dir><dir name="Checkout"><file name="Cart.php" hash="61c0729778514ab0bcdafb78d2fdb79e"/><file name="Onepage.php" hash="d251df39cec5b917e443cb4b66a5347e"/></dir><file name="Track.php" hash="9260415b17961629c43fd731c9562083"/></dir><dir name="Helper"><file name="Data.php" hash="a8daaab21b10ec346b76a33039a148db"/></dir><dir name="Model"><dir name="Admin"><dir name="System"><dir name="Config"><dir name="Source"><file name="InclTax.php" hash="fa2c5583dbb3d4792f17420bb4b2a83e"/></dir></dir></dir></dir><file name="Observer.php" hash="7b92fe745c4e555ed6ba47dce71f78f6"/></dir><dir name="etc"><file name="adminhtml.xml" hash="4eee22fc1dd9e00ccc2ba17fff2c282e"/><file name="config.xml" hash="43e2e295256b777994f13ef322a7f11d"/><file name="system.xml" hash="e622fe7d2db9633816ad12d17aff2068"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="etracker.xml" hash="03425af629e1b36dc1f4785454955bd8"/></dir><dir name="template"><dir name="etracker"><dir name="checkout"><file name="cart.phtml" hash="495262401610c1129292f98b865974e1"/><file name="et_onepage.phtml" hash="975a80d842858e6daf2311732389122f"/></dir><file name="ppr.phtml" hash="6974161b448b65ca41239a8150da9399"/><file name="product_media.phtml" hash="62685ad4b81c8cdb8d3b34862417b4df"/><file name="track.phtml" hash="332aa2194d0750050de07dab08b35629"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Etracker_Etracker.xml" hash="03cd56f88dbab2daf24ed201d34ddc5b"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Etracker_Etracker.csv" hash="b9d76450a6f6205b13faaa19a027b304"/></dir><dir name="en_US"><file name="Etracker_Etracker.csv" hash="d62acdb902e80a282e13a85e852946b8"/></dir></target></contents>
36
+ <compatible/>
37
+ <dependencies/>
38
+ </package>