Version Notes
Release for econda Web Controlling functions.
Download this release
Release Info
Developer | Magento Core Team |
Extension | Mage_Econda |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.1.0
- app/code/local/Mage/Econda/Block/Econda.php +259 -226
- app/code/local/Mage/Econda/Block/emos.php +430 -245
- app/code/local/Mage/Econda/Model/System/Config/Source/Tracking.php +12 -0
- app/code/local/Mage/Econda/etc/config.xml +1 -2
- app/code/local/Mage/Econda/etc/system.xml +11 -1
- app/design/frontend/default/default/template/econda/tracker.phtml +6 -7
- app/design/frontend/default/default/template/econda/trackerop.phtml +100 -71
- app/locale/de_AT/Mage_Econda.csv +2 -1
- app/locale/de_CH/Mage_Econda.csv +2 -1
- app/locale/de_DE/Mage_Econda.csv +2 -1
- app/locale/en_US/Mage_Econda.csv +2 -1
- js/tracker/emosop.js +7 -8
- package.xml +4 -4
app/code/local/Mage/Econda/Block/Econda.php
CHANGED
@@ -47,16 +47,19 @@ Mage::app ();
|
|
47 |
|
48 |
class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
49 |
{
|
50 |
-
|
51 |
public function __construct()
|
52 |
{
|
53 |
parent::__construct();
|
54 |
$this->setTemplate('econda/tracker.phtml');
|
55 |
}
|
56 |
|
57 |
-
public function getEmos()
|
58 |
-
|
59 |
require Mage::getModuleDir('', 'Mage_Econda').DS.'Block'.DS.'emos.php';
|
|
|
|
|
|
|
|
|
60 |
$storeId = $this->getStore();
|
61 |
$langValue = 'econda/econda/tracking_language';
|
62 |
$langPath = Mage::getStoreConfig($langValue, $storeId);
|
@@ -67,11 +70,27 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
67 |
else if($langPath == '1') {
|
68 |
$langFile = 'english';
|
69 |
}
|
70 |
-
else
|
71 |
$langFile = 'german';
|
72 |
}
|
73 |
require Mage::getModuleDir('', 'Mage_Econda').DS.'Language'.DS.$langFile.'.php';
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
/*
|
76 |
* path to emos2.js
|
77 |
*/
|
@@ -81,10 +100,16 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
81 |
/*
|
82 |
* start of emos string
|
83 |
*/
|
84 |
-
$emosString = "\n\n<!-- Start Econda-Monitor
|
85 |
|
86 |
$emos = new EMOS($pathToFile);
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
Mage::getSingleton('core/session', array('name'=>'frontend'));
|
89 |
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
|
90 |
$session = Mage::getSingleton('checkout/session');
|
@@ -97,12 +122,11 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
97 |
$storeNameLoad = Mage::getModel('core/store_group')->load($storeId);
|
98 |
$storeName = $storeNameLoad->getName();
|
99 |
$tablePrefix = Mage::getConfig()->getTablePrefix();
|
100 |
-
|
101 |
$getPath = Mage::helper('catalog')->getBreadcrumbPath($this->getCategory());
|
102 |
if(sizeof($getPath) > 0) {
|
103 |
$contentPath = "Start";
|
104 |
}
|
105 |
-
else
|
106 |
$contentPath = "";
|
107 |
}
|
108 |
|
@@ -193,7 +217,7 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
193 |
if(trim($getTagName) == ''){
|
194 |
$contentPath .= '/'.$eLang[36];
|
195 |
}
|
196 |
-
else
|
197 |
$contentPath .= '/'.$getTagName;
|
198 |
}
|
199 |
}
|
@@ -202,34 +226,33 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
202 |
* check if get current url match
|
203 |
*/
|
204 |
if(trim($contentPath) == '') {
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
}
|
233 |
}
|
234 |
|
235 |
//then if php self match
|
@@ -253,7 +276,7 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
253 |
}
|
254 |
$urlExtExp = explode("/",$urlExt);
|
255 |
$urlExtO = '';
|
256 |
-
for
|
257 |
$urlExtO .= ucfirst($urlExtExp[$i]).'/';
|
258 |
}
|
259 |
$urlExtO = substr($urlExtO,0,-1);
|
@@ -262,7 +285,6 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
262 |
$contentPath = 'Start';
|
263 |
}
|
264 |
}
|
265 |
-
|
266 |
|
267 |
// if not onePage checkout steps
|
268 |
if(stristr($realUrl,'checkout/onepage/') == false) {
|
@@ -309,7 +331,7 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
309 |
if(stristr($realUrl,'/catalogsearch/advanced/result/?') != false) {
|
310 |
$searchQuery = '';
|
311 |
$searchCriterias = Mage::getSingleton('catalogsearch/advanced')->getSearchCriterias();
|
312 |
-
foreach
|
313 |
$searchQuery .= $val['value'];
|
314 |
}
|
315 |
$productCollection = Mage::getSingleton('catalogsearch/advanced')->getProductCollection();
|
@@ -326,123 +348,115 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
326 |
$isAddBasket = false;
|
327 |
|
328 |
//bugfix for basket after customer re-login
|
329 |
-
if
|
330 |
if($session->getData('econda_logged') != 1) {
|
331 |
$oldBasket = true;
|
332 |
}
|
333 |
-
else
|
334 |
$oldBasket = false;
|
335 |
}
|
336 |
}
|
337 |
-
else
|
338 |
$oldBasket = false;
|
339 |
}
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
$eStarter = 0;
|
368 |
-
}
|
369 |
|
370 |
-
|
371 |
if($eStarter == 1) {
|
372 |
-
foreach
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
}
|
387 |
}
|
388 |
else {
|
389 |
-
foreach
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
if($oQtyArray[$idKey] < $item->getQty() && $oNmeArray[$idKey] == $item->getItemId()) {
|
407 |
-
$emosAction = 'addBasket';
|
408 |
-
$basketQty = $item->getQty() - $oQtyArray[$idKey];
|
409 |
-
}
|
410 |
}
|
411 |
}
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
}
|
430 |
-
}
|
431 |
-
if($emosAction == 'rmvBasket' && stristr($this->getMessagesBlock()->getGroupedHtml(),'error-msg') == false && $eItem->price != '0.00') {
|
432 |
-
if(!$addRmv) {
|
433 |
-
$emos->removeFromBasket($eItem);
|
434 |
-
}
|
435 |
-
$isAddBasket = true;
|
436 |
-
}
|
437 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
}
|
439 |
-
|
440 |
}
|
441 |
}
|
442 |
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
|
447 |
/*
|
448 |
* emos addDetailView
|
@@ -453,11 +467,11 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
453 |
if($getGroup) $prodGroup = $getGroup;
|
454 |
else $prodGroup = $eLang[39];
|
455 |
$eItem = new EMOS_Item();
|
456 |
-
$eItem->productName = $item->getName();
|
457 |
$eItem->productID = $item->getId();
|
458 |
$eItem->price = $this->convertPrice($item->getPrice());
|
459 |
$eItem->quantity = '1';
|
460 |
-
$eItem->productGroup = $prodGroup.'/'
|
461 |
$emos->addDetailView($eItem);
|
462 |
}
|
463 |
|
@@ -481,31 +495,29 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
481 |
/*
|
482 |
* emos addLogin
|
483 |
*/
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
}
|
495 |
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
case 'LOGIN':
|
510 |
$emos->addOrderProcess("2_".$eLang[0]);
|
511 |
break;
|
@@ -556,13 +568,12 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
556 |
$custId = $row['customer_id'];
|
557 |
$ordId = $lastOrderId;
|
558 |
$priceTotal = $this->convertPrice($row['grand_total']);
|
559 |
-
|
560 |
$custAdress = $custCountry.'/'.substr($custPostCode,0,1).'/'.substr($custPostCode,0,2).'/'.$custCity.'/'.$custPostCode;
|
561 |
$emos->addEmosBillingPageArray($ordId,$custId,$priceTotal,$custCountry,$custPostCode,$custCity);
|
562 |
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
$basket = array();
|
567 |
$bCounter = 0;
|
568 |
$tableSfqi = $tablePrefix.'sales_flat_quote_item';
|
@@ -574,87 +585,109 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
574 |
if($getGroup) $prodGroup = $getGroup;
|
575 |
else $prodGroup = $eLang[39];
|
576 |
$eItem = new EMOS_Item();
|
577 |
-
$eItem->productName = $row['name'];
|
578 |
$eItem->productID = $row['product_id'];
|
579 |
$eItem->price = $this->convertPrice($row['price']);
|
580 |
$eItem->quantity = number_format($row['qty'],0);
|
581 |
-
$eItem->productGroup = $prodGroup.'/'
|
582 |
$basket[$bCounter] = $eItem;
|
583 |
$bCounter += 1;
|
584 |
}
|
585 |
}
|
586 |
-
|
587 |
-
$emos->addEmosBasketPageArray($basket);
|
588 |
}
|
589 |
|
590 |
$emosString .= $emos->toString();
|
591 |
$emosString .= "\n<!-- End Econda-Monitor -->\n\n";
|
592 |
-
|
593 |
return $emosString;
|
594 |
}
|
595 |
|
596 |
/*
|
597 |
* get highest level category path for a product
|
598 |
*/
|
599 |
-
private function getProductCategory($productId)
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
}
|
647 |
-
else {
|
648 |
-
return false;
|
649 |
-
}
|
650 |
}
|
651 |
|
652 |
-
private function convertPrice($price)
|
653 |
-
|
654 |
-
|
655 |
$corPrice = substr($price,0,-3);
|
656 |
$corPrice = str_replace(',','',$corPrice);
|
657 |
$corPrice = str_replace('.','',$corPrice);
|
658 |
return $corPrice.'.'.substr($price,-2);
|
659 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
660 |
}
|
|
47 |
|
48 |
class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
49 |
{
|
|
|
50 |
public function __construct()
|
51 |
{
|
52 |
parent::__construct();
|
53 |
$this->setTemplate('econda/tracker.phtml');
|
54 |
}
|
55 |
|
56 |
+
public function getEmos()
|
57 |
+
{
|
58 |
require Mage::getModuleDir('', 'Mage_Econda').DS.'Block'.DS.'emos.php';
|
59 |
+
|
60 |
+
/*
|
61 |
+
* config get language
|
62 |
+
*/
|
63 |
$storeId = $this->getStore();
|
64 |
$langValue = 'econda/econda/tracking_language';
|
65 |
$langPath = Mage::getStoreConfig($langValue, $storeId);
|
70 |
else if($langPath == '1') {
|
71 |
$langFile = 'english';
|
72 |
}
|
73 |
+
else{
|
74 |
$langFile = 'german';
|
75 |
}
|
76 |
require Mage::getModuleDir('', 'Mage_Econda').DS.'Language'.DS.$langFile.'.php';
|
77 |
+
|
78 |
+
/*
|
79 |
+
* config get emos version
|
80 |
+
*/
|
81 |
+
|
82 |
+
$trackValue = 'econda/econda/tracking_version';
|
83 |
+
if(Mage::getStoreConfig($trackValue, $storeId) == '' || Mage::getStoreConfig($trackValue, $storeId) == '0') {
|
84 |
+
$checkVersion = $this->emosVersion();
|
85 |
+
if(Mage::getStoreConfig($trackValue, $storeId) == '' || $checkVersion != '0') {
|
86 |
+
Mage::getModel('core/config')->saveConfig($trackValue,$checkVersion);
|
87 |
+
Mage::getModel('core/config')->cleanCache();
|
88 |
+
}
|
89 |
+
}
|
90 |
+
else{
|
91 |
+
$checkVersion = Mage::getStoreConfig($trackValue, $storeId);
|
92 |
+
}
|
93 |
+
|
94 |
/*
|
95 |
* path to emos2.js
|
96 |
*/
|
100 |
/*
|
101 |
* start of emos string
|
102 |
*/
|
103 |
+
$emosString = "\n\n<!-- Start Econda-Monitor M110 -->\n\n";
|
104 |
|
105 |
$emos = new EMOS($pathToFile);
|
106 |
+
|
107 |
+
if($checkVersion == '2') {
|
108 |
+
$emos->trackMode(intval($checkVersion));
|
109 |
+
}
|
110 |
+
|
111 |
+
$emos->addCdata();
|
112 |
+
|
113 |
Mage::getSingleton('core/session', array('name'=>'frontend'));
|
114 |
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
|
115 |
$session = Mage::getSingleton('checkout/session');
|
122 |
$storeNameLoad = Mage::getModel('core/store_group')->load($storeId);
|
123 |
$storeName = $storeNameLoad->getName();
|
124 |
$tablePrefix = Mage::getConfig()->getTablePrefix();
|
|
|
125 |
$getPath = Mage::helper('catalog')->getBreadcrumbPath($this->getCategory());
|
126 |
if(sizeof($getPath) > 0) {
|
127 |
$contentPath = "Start";
|
128 |
}
|
129 |
+
else{
|
130 |
$contentPath = "";
|
131 |
}
|
132 |
|
217 |
if(trim($getTagName) == ''){
|
218 |
$contentPath .= '/'.$eLang[36];
|
219 |
}
|
220 |
+
else{
|
221 |
$contentPath .= '/'.$getTagName;
|
222 |
}
|
223 |
}
|
226 |
* check if get current url match
|
227 |
*/
|
228 |
if(trim($contentPath) == '') {
|
229 |
+
$checkPath = str_replace($_SERVER['SERVER_NAME'],"",$realUrl);
|
230 |
+
$checkPath = str_replace("https://","",$checkPath);
|
231 |
+
$checkPath = str_replace("http://","",$checkPath);
|
232 |
+
if(strpos($checkPath,"?") != false) {
|
233 |
+
$reqPos = strPos($checkPath,"?");
|
234 |
+
$checkPath = substr($checkPath,0,$reqPos);
|
235 |
+
}
|
236 |
+
if(substr($checkPath,-1) == "/") {
|
237 |
+
$checkPath = substr($checkPath,0,-1);
|
238 |
+
}
|
239 |
+
$checkPath = str_replace("/index.php/".$storeCode,"",$checkPath);
|
240 |
+
$checkPath = str_replace("/index.php","",$checkPath);
|
241 |
+
$codeLen = strlen($storeCode);
|
242 |
+
if(substr($checkPath,0,$codeLen+1) == '/'.$storeCode) {
|
243 |
+
$checkPath = substr($checkPath,$codeLen+1);
|
244 |
+
}
|
245 |
+
if(trim($checkPath) != '') {
|
246 |
+
$urlExtExp = explode("/",$checkPath);
|
247 |
+
$urlExtO = '';
|
248 |
+
for($i = 0; $i < sizeof($urlExtExp); $i++) {
|
249 |
+
if(trim($urlExtExp[$i]) != ''){
|
250 |
+
$urlExtO .= ucfirst($urlExtExp[$i]).'/';
|
251 |
+
}
|
252 |
+
}
|
253 |
+
$contentPath = 'Start/'.$eLang[38].'/'.substr($urlExtO,0,-1);
|
254 |
+
$contentPath = str_replace("//","/",$contentPath);
|
255 |
+
}
|
|
|
256 |
}
|
257 |
|
258 |
//then if php self match
|
276 |
}
|
277 |
$urlExtExp = explode("/",$urlExt);
|
278 |
$urlExtO = '';
|
279 |
+
for($i = 0; $i < sizeof($urlExtExp); $i++) {
|
280 |
$urlExtO .= ucfirst($urlExtExp[$i]).'/';
|
281 |
}
|
282 |
$urlExtO = substr($urlExtO,0,-1);
|
285 |
$contentPath = 'Start';
|
286 |
}
|
287 |
}
|
|
|
288 |
|
289 |
// if not onePage checkout steps
|
290 |
if(stristr($realUrl,'checkout/onepage/') == false) {
|
331 |
if(stristr($realUrl,'/catalogsearch/advanced/result/?') != false) {
|
332 |
$searchQuery = '';
|
333 |
$searchCriterias = Mage::getSingleton('catalogsearch/advanced')->getSearchCriterias();
|
334 |
+
foreach($searchCriterias as $val) {
|
335 |
$searchQuery .= $val['value'];
|
336 |
}
|
337 |
$productCollection = Mage::getSingleton('catalogsearch/advanced')->getProductCollection();
|
348 |
$isAddBasket = false;
|
349 |
|
350 |
//bugfix for basket after customer re-login
|
351 |
+
if(Mage::getSingleton('customer/session')->isLoggedIn() == 1) {
|
352 |
if($session->getData('econda_logged') != 1) {
|
353 |
$oldBasket = true;
|
354 |
}
|
355 |
+
else{
|
356 |
$oldBasket = false;
|
357 |
}
|
358 |
}
|
359 |
+
else{
|
360 |
$oldBasket = false;
|
361 |
}
|
362 |
+
$nIdArray = array();
|
363 |
+
$nQtyArray = array();
|
364 |
+
$nNmeArray = array();
|
365 |
+
$counter = 1;
|
366 |
+
|
367 |
+
foreach($session->getQuote()->getAllItems() as $item) {
|
368 |
+
$nIdArray[$counter] = $item->getproductId();
|
369 |
+
$nQtyArray[$counter] = $item->getQty();
|
370 |
+
$nNmeArray[$counter] = $item->getItemId();
|
371 |
+
$counter += 1;
|
372 |
+
}
|
373 |
+
if(!$session->getData('econda_card_id')){
|
374 |
+
$session->setData('econda_card_id',$nIdArray);
|
375 |
+
$session->setData('econda_card_qty',$nQtyArray);
|
376 |
+
$session->setData('econda_card_nme',$nNmeArray);
|
377 |
+
$oIdArray = $nIdArray;
|
378 |
+
$oQtyArray = $nQtyArray;
|
379 |
+
$oNmeArray = $nNmeArray;
|
380 |
+
$eStarter = 1;
|
381 |
+
}
|
382 |
+
else {
|
383 |
+
$oIdArray = $session->getData('econda_card_id');
|
384 |
+
$oQtyArray = $session->getData('econda_card_qty');
|
385 |
+
$oPrcArray = $session->getData('econda_card_prc');
|
386 |
+
$oNmeArray = $session->getData('econda_card_nme');
|
387 |
+
$eStarter = 0;
|
388 |
+
}
|
|
|
|
|
389 |
|
390 |
+
if(!$oldBasket) {
|
391 |
if($eStarter == 1) {
|
392 |
+
foreach($session->getQuote()->getAllItems() as $item) {
|
393 |
+
$getGroup = $this->getProductCategory($item->getproductId());
|
394 |
+
if($getGroup) $prodGroup = $getGroup;
|
395 |
+
else $prodGroup = $eLang[39];
|
396 |
+
$eItem = new EMOS_Item();
|
397 |
+
$eItem->productName = trim($item->getName());
|
398 |
+
$eItem->productID = $item->getproductId();
|
399 |
+
$eItem->price = $this->convertPrice($item->getPrice());
|
400 |
+
$eItem->quantity = $item->getQty();
|
401 |
+
$eItem->productGroup = $prodGroup.'/'.trim($item->getName());
|
402 |
+
if($eItem->price != '0.00') {
|
403 |
+
$emos->addToBasket($eItem);
|
404 |
+
}
|
405 |
+
$isAddBasket = true;
|
406 |
}
|
407 |
}
|
408 |
else {
|
409 |
+
foreach($session->getQuote()->getAllItems() as $item) {
|
410 |
+
$emosAction = false;
|
411 |
+
$addRmv = false;
|
412 |
+
$idKey = array_search($item->getItemId(),$oNmeArray);
|
413 |
+
if($idKey == false) {
|
414 |
+
$emosAction = 'addBasket';
|
415 |
+
$basketQty = $item->getQty();
|
416 |
+
}
|
417 |
+
if($idKey != false) {
|
418 |
+
if($oQtyArray[$idKey] != $item->getQty()) {
|
419 |
+
if($oQtyArray[$idKey] > $item->getQty() && $oNmeArray[$idKey] == $item->getItemId()) {
|
420 |
+
$emosAction = 'rmvBasket';
|
421 |
+
$basketQty = $oQtyArray[$idKey] - $item->getQty();
|
422 |
+
}
|
423 |
+
if($oQtyArray[$idKey] < $item->getQty() && $oNmeArray[$idKey] == $item->getItemId()) {
|
424 |
+
$emosAction = 'addBasket';
|
425 |
+
$basketQty = $item->getQty() - $oQtyArray[$idKey];
|
|
|
|
|
|
|
|
|
426 |
}
|
427 |
}
|
428 |
+
}
|
429 |
+
if($emosAction != false) {
|
430 |
+
$getGroup = $this->getProductCategory($item->getproductId());
|
431 |
+
if($getGroup) $prodGroup = $getGroup;
|
432 |
+
else $prodGroup = $eLang[39];
|
433 |
+
$eItem = new EMOS_Item();
|
434 |
+
$eItem->productName = trim($item->getName());
|
435 |
+
$eItem->productID = $item->getproductId();
|
436 |
+
$eItem->price = $this->convertPrice($item->getPrice());
|
437 |
+
$eItem->quantity = $basketQty;
|
438 |
+
$eItem->productGroup = $prodGroup.'/'.trim($item->getName());
|
439 |
+
if($emosAction == 'addBasket' && stristr($this->getMessagesBlock()->getGroupedHtml(),'error-msg') == false && $eItem->price != '0.00') {
|
440 |
+
$emos->addToBasket($eItem);
|
441 |
+
$isAddBasket = true;
|
442 |
+
if(stristr($realUrl,'checkout/cart') == false) {
|
443 |
+
$addRmv = true;
|
444 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
445 |
}
|
446 |
+
if($emosAction == 'rmvBasket' && stristr($this->getMessagesBlock()->getGroupedHtml(),'error-msg') == false && $eItem->price != '0.00') {
|
447 |
+
if(!$addRmv) {
|
448 |
+
$emos->removeFromBasket($eItem);
|
449 |
+
}
|
450 |
+
$isAddBasket = true;
|
451 |
+
}
|
452 |
+
}
|
453 |
}
|
|
|
454 |
}
|
455 |
}
|
456 |
|
457 |
+
$session->setData('econda_card_qty',$nQtyArray);
|
458 |
+
$session->setData('econda_card_id',$nIdArray);
|
459 |
+
$session->setData('econda_card_nme',$nNmeArray);
|
460 |
|
461 |
/*
|
462 |
* emos addDetailView
|
467 |
if($getGroup) $prodGroup = $getGroup;
|
468 |
else $prodGroup = $eLang[39];
|
469 |
$eItem = new EMOS_Item();
|
470 |
+
$eItem->productName = trim($item->getName());
|
471 |
$eItem->productID = $item->getId();
|
472 |
$eItem->price = $this->convertPrice($item->getPrice());
|
473 |
$eItem->quantity = '1';
|
474 |
+
$eItem->productGroup = $prodGroup.'/'.trim($item->getName());
|
475 |
$emos->addDetailView($eItem);
|
476 |
}
|
477 |
|
495 |
/*
|
496 |
* emos addLogin
|
497 |
*/
|
498 |
+
//login success
|
499 |
+
$isLoggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
|
500 |
+
if($isLoggedIn == 1 && $session->getData('econda_logged') != 2) {
|
501 |
+
$session->setData('econda_logged','1');
|
502 |
+
}
|
503 |
+
if($session->getData('econda_logged') == 1) {
|
504 |
+
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
|
505 |
+
$emos->addLogin($customerId,0);
|
506 |
+
$session->setData('econda_logged','2');
|
507 |
+
}
|
|
|
508 |
|
509 |
+
//login failed
|
510 |
+
if(stristr($realUrl,'customer/account/login/') != false || stristr($realUrl,'checkout/multishipping/login/') != false){
|
511 |
+
if(stristr($this->getMessagesBlock()->getGroupedHtml(),'error-msg') != false) {
|
512 |
+
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
|
513 |
+
$emos->addLogin($customerId,1);
|
514 |
+
}
|
515 |
+
}
|
516 |
|
517 |
+
/*
|
518 |
+
* emos orderProcess multishipping checkout
|
519 |
+
*/
|
520 |
+
switch ($stepCheckout) {
|
|
|
521 |
case 'LOGIN':
|
522 |
$emos->addOrderProcess("2_".$eLang[0]);
|
523 |
break;
|
568 |
$custId = $row['customer_id'];
|
569 |
$ordId = $lastOrderId;
|
570 |
$priceTotal = $this->convertPrice($row['grand_total']);
|
|
|
571 |
$custAdress = $custCountry.'/'.substr($custPostCode,0,1).'/'.substr($custPostCode,0,2).'/'.$custCity.'/'.$custPostCode;
|
572 |
$emos->addEmosBillingPageArray($ordId,$custId,$priceTotal,$custCountry,$custPostCode,$custCity);
|
573 |
|
574 |
+
/*
|
575 |
+
* addEmosBasketPageArray checkout
|
576 |
+
*/
|
577 |
$basket = array();
|
578 |
$bCounter = 0;
|
579 |
$tableSfqi = $tablePrefix.'sales_flat_quote_item';
|
585 |
if($getGroup) $prodGroup = $getGroup;
|
586 |
else $prodGroup = $eLang[39];
|
587 |
$eItem = new EMOS_Item();
|
588 |
+
$eItem->productName = trim($row['name']);
|
589 |
$eItem->productID = $row['product_id'];
|
590 |
$eItem->price = $this->convertPrice($row['price']);
|
591 |
$eItem->quantity = number_format($row['qty'],0);
|
592 |
+
$eItem->productGroup = $prodGroup.'/'.trim($row['name']);
|
593 |
$basket[$bCounter] = $eItem;
|
594 |
$bCounter += 1;
|
595 |
}
|
596 |
}
|
597 |
+
$emos->addEmosBasketPageArray($basket);
|
|
|
598 |
}
|
599 |
|
600 |
$emosString .= $emos->toString();
|
601 |
$emosString .= "\n<!-- End Econda-Monitor -->\n\n";
|
|
|
602 |
return $emosString;
|
603 |
}
|
604 |
|
605 |
/*
|
606 |
* get highest level category path for a product
|
607 |
*/
|
608 |
+
private function getProductCategory($productId)
|
609 |
+
{
|
610 |
+
Mage::getSingleton('core/session', array('name'=>'frontend'));
|
611 |
+
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
|
612 |
+
$tablePrefix = Mage::getConfig()->getTablePrefix();
|
613 |
+
$tableCcp = $tablePrefix.'catalog_category_product';
|
614 |
+
$result = $db->query("SELECT category_id FROM $tableCcp WHERE product_id = $productId");
|
615 |
+
$getCatId = array();
|
616 |
+
$count = 0;
|
617 |
+
$isCategory = false;
|
618 |
+
|
619 |
+
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
620 |
+
$getCatId[$count] = $row['category_id'];
|
621 |
+
$count += 1;
|
622 |
+
$isCategory = true;
|
623 |
+
}
|
624 |
+
if($isCategory) {
|
625 |
+
$catLevel = 0;
|
626 |
+
for($i=0;$i<sizeof($getCatId);$i++) {
|
627 |
+
$getCat = $getCatId[$i];
|
628 |
+
$tableCce = $tablePrefix.'catalog_category_entity';
|
629 |
+
$result = $db->query("SELECT level,path FROM $tableCce WHERE entity_id = $getCat");
|
630 |
+
$row = $result->fetch(PDO::FETCH_ASSOC);
|
631 |
+
if($catLevel < intval($row['level'])) {
|
632 |
+
$catLevel = intval($row['level']);
|
633 |
+
$categoryId = $getCat;
|
634 |
+
$catPath = explode('/',$row['path']);
|
635 |
+
}
|
636 |
+
}
|
637 |
+
$tableCcev = $tablePrefix.'catalog_category_entity_varchar';
|
638 |
+
$result = $db->query("SELECT attribute_id FROM $tableCcev WHERE value_id = 1");
|
639 |
+
$row = $result->fetch(PDO::FETCH_ASSOC);
|
640 |
+
$getEntidyId = $row['attribute_id'];
|
641 |
+
|
642 |
+
$category = "";
|
643 |
+
for($i=1;$i<sizeof($catPath);$i++) {
|
644 |
+
$catId = intval($catPath[$i]);
|
645 |
+
$result = $db->query("SELECT value FROM $tableCcev WHERE entity_id = $catId AND attribute_id = $getEntidyId");
|
646 |
+
$row = $result->fetch(PDO::FETCH_ASSOC);
|
647 |
+
$category .= $row['value']."/";
|
648 |
+
}
|
649 |
+
$category = substr($category,0,-1);
|
650 |
+
return $category;
|
651 |
+
}
|
652 |
+
else {
|
653 |
+
return false;
|
654 |
+
}
|
|
|
|
|
|
|
|
|
655 |
}
|
656 |
|
657 |
+
private function convertPrice($price)
|
658 |
+
{
|
659 |
+
$price = number_format($price,2);
|
660 |
$corPrice = substr($price,0,-3);
|
661 |
$corPrice = str_replace(',','',$corPrice);
|
662 |
$corPrice = str_replace('.','',$corPrice);
|
663 |
return $corPrice.'.'.substr($price,-2);
|
664 |
}
|
665 |
+
|
666 |
+
private function emosVersion()
|
667 |
+
{
|
668 |
+
$emFile = $_SERVER{'DOCUMENT_ROOT'}."/js/tracker/emos2.js";
|
669 |
+
if(file_exists($emFile)) {
|
670 |
+
$fp = @fopen($emFile,'r');
|
671 |
+
if($fp) {
|
672 |
+
$rl = fgets($fp,60);
|
673 |
+
fclose($fp);
|
674 |
+
if(stristr($rl,'EMOS_VERSION') != false) {
|
675 |
+
$evp = strpos($rl,'EMOS_VERSION') ;
|
676 |
+
$evsb = substr($rl,$evp+12,8);
|
677 |
+
$evsb = str_replace('=','',$evsb);
|
678 |
+
$evsb = str_replace('\'','',$evsb);
|
679 |
+
$evsb = str_replace(',','',$evsb);
|
680 |
+
$evsb = str_replace('pt','',$evsb);
|
681 |
+
$evsb = str_replace('cm','',$evsb);
|
682 |
+
$evbiv = intval($evsb);
|
683 |
+
if($evbiv > 40) {
|
684 |
+
return '2';
|
685 |
+
}
|
686 |
+
}
|
687 |
+
}
|
688 |
+
return '1';
|
689 |
+
}
|
690 |
+
return '0';
|
691 |
+
}
|
692 |
}
|
693 |
+
?>
|
app/code/local/Mage/Econda/Block/emos.php
CHANGED
@@ -1,19 +1,17 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
/*******************************************************************************
|
5 |
* EMOS PHP Bib 2
|
6 |
-
* $Id: emos.php,v 1.
|
7 |
********************************************************************************
|
8 |
|
9 |
-
Copyright (c) 2004 -
|
10 |
All rights reserved.
|
11 |
|
12 |
ECONDA GmbH
|
13 |
-
|
14 |
-
|
15 |
-
Tel
|
16 |
-
Fax
|
17 |
info@econda.de
|
18 |
www.econda.de
|
19 |
|
@@ -43,6 +41,21 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
43 |
Changes:
|
44 |
|
45 |
$Log: emos.php,v $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
Revision 1.13 2007/08/17 08:40:33 unaegele
|
47 |
added function addEMOSCustomPageArray
|
48 |
added function getEMOSCustomPageArray
|
@@ -79,68 +92,100 @@ Revision 1.2 added URL Encoding, Dataformat
|
|
79 |
|
80 |
Revision 1.1 added 1st party session tracking
|
81 |
|
82 |
-
|
83 |
*/
|
84 |
|
85 |
-
|
86 |
* inclusion in a HTML/PHP Page.
|
87 |
*/
|
88 |
class EMOS {
|
89 |
|
90 |
-
|
91 |
-
* the EMOS statement consists of 3 parts
|
92 |
-
* 1. the inScript :<code><script type="text/javascript" src="emos2.js"></script>
|
93 |
-
* 2,3. a part before and after this inScript (preScript/postScript)</code>
|
94 |
-
*/
|
95 |
var $preScript = "";
|
96 |
|
97 |
-
|
98 |
-
* Here we store the call to the js bib
|
99 |
-
*/
|
100 |
var $inScript = "";
|
101 |
|
102 |
-
|
103 |
-
* if we must put something behind the call to the js bin we put it here
|
104 |
-
*/
|
105 |
var $postScript = "";
|
106 |
|
107 |
-
|
108 |
var $pathToFile = "";
|
109 |
|
110 |
-
|
111 |
var $scriptFileName = "emos2.js";
|
112 |
|
113 |
-
/** if we use pretty print, we will set the lineseparator or tab here */
|
114 |
-
var $br = "\n";
|
115 |
-
var $tab = "\t";
|
116 |
-
|
117 |
/* session id for 1st party sessions*/
|
118 |
var $emsid = "";
|
119 |
|
120 |
/* visitor id for 1st partyx visitors */
|
121 |
var $emvid = "";
|
|
|
|
|
|
|
122 |
|
123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
* add compatibility function for php < 5.1
|
125 |
*/
|
126 |
function htmlspecialchars_decode_php4($str) {
|
127 |
return strtr($str, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));
|
128 |
}
|
129 |
|
130 |
-
|
131 |
* Sets the path to the emos2.js js-bib and prepares the later calls
|
132 |
*
|
133 |
-
* @param $pathToFile The path to the js-bib (/
|
134 |
* @param $scriptFileName If we want to have annother Filename than
|
135 |
-
*
|
136 |
*/
|
137 |
function EMOS($pathToFile , $scriptFileName = "emos2.js") {
|
138 |
$this->pathToFile = $pathToFile;
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
$this->prepareInScript();
|
141 |
-
|
142 |
}
|
143 |
-
|
144 |
/* formats data/values/params by eliminating named entities and xml-entities */
|
145 |
function emos_ItemFormat($item) {
|
146 |
$item->productID = $this->emos_DataFormat($item->productID);
|
@@ -154,46 +199,53 @@ class EMOS {
|
|
154 |
|
155 |
/* formats data/values/params by eliminating named entities and xml-entities */
|
156 |
function emos_DataFormat($str) {
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
182 |
break;
|
183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
}
|
185 |
-
$str = str_replace(" / ", "/", $str);
|
186 |
-
$str = str_replace(" /", "/", $str);
|
187 |
-
$str = str_replace("/ ", "/", $str);
|
188 |
-
|
189 |
-
$str = substr($str, 0, 254);
|
190 |
-
$str = rawurlencode($str);
|
191 |
return $str;
|
192 |
}
|
193 |
|
194 |
-
|
195 |
-
* sets the 1st party session id
|
196 |
-
*/
|
197 |
function setSid($sid = "") {
|
198 |
if ($sid) {
|
199 |
$this->emsid = $sid;
|
@@ -201,9 +253,7 @@ class EMOS {
|
|
201 |
}
|
202 |
}
|
203 |
|
204 |
-
|
205 |
-
* set 1st party visitor id
|
206 |
-
*/
|
207 |
function setVid($vid = "") {
|
208 |
if ($vid) {
|
209 |
$this->emvid = $vid;
|
@@ -211,176 +261,315 @@ class EMOS {
|
|
211 |
}
|
212 |
}
|
213 |
|
214 |
-
|
215 |
-
* will be in one line of html.
|
216 |
-
*/
|
217 |
function prettyPrint() {
|
218 |
-
$this->br .= "\n";
|
219 |
-
$this->tab .= "\t";
|
220 |
}
|
221 |
|
222 |
-
|
223 |
function appendInScript($stringToAppend) {
|
224 |
$this->inScript .= $stringToAppend;
|
225 |
}
|
226 |
|
227 |
-
|
228 |
function appendPreScript($stringToAppend) {
|
229 |
$this->preScript .= $stringToAppend;
|
230 |
}
|
231 |
|
232 |
-
|
233 |
function appendPostScript($stringToAppend) {
|
234 |
$this->postScript .= $stringToAppend;
|
235 |
}
|
236 |
|
237 |
-
|
238 |
function prepareInScript() {
|
239 |
-
$this->
|
240 |
-
"src=\"" . $this->pathToFile . $this->scriptFileName . "\">" .
|
241 |
-
"</script>" . $this->br;
|
242 |
}
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
-
|
245 |
function toString() {
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
function getAnchorTag($title = "", $rel = "", $rev = "") {
|
251 |
-
|
252 |
$rel = $this->emos_DataFormat($rel);
|
253 |
$rev = $this->emos_DataFormat($rev);
|
254 |
-
$anchor = "<a name=\"emos_name\" " .
|
255 |
-
"title=\"$title\" " .
|
256 |
-
"rel=\"$rel\" " .
|
257 |
-
"rev=\"$rev\"></a>$this->br";
|
258 |
return $anchor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
}
|
260 |
|
261 |
-
|
262 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
*/
|
264 |
function addContent($content) {
|
265 |
-
$this->appendPreScript($this->
|
266 |
}
|
267 |
|
268 |
-
|
269 |
-
*
|
270 |
*/
|
271 |
function addOrderProcess($processStep) {
|
272 |
-
$this->appendPreScript($this->
|
273 |
}
|
274 |
|
275 |
-
|
276 |
-
*
|
277 |
*/
|
278 |
function addSiteID($siteid) {
|
279 |
-
$this->appendPreScript($this->
|
280 |
}
|
281 |
|
282 |
-
|
283 |
-
*
|
284 |
*/
|
285 |
function addLangID($langid) {
|
286 |
-
$this->appendPreScript($this->
|
287 |
}
|
288 |
|
289 |
-
|
290 |
-
*
|
291 |
*/
|
292 |
function addCountryID($countryid) {
|
293 |
-
$this->appendPreScript($this->
|
294 |
}
|
295 |
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
function addPageID($pageID) {
|
300 |
-
|
|
|
|
|
|
|
|
|
|
|
301 |
}
|
302 |
|
303 |
-
|
304 |
-
*
|
305 |
*/
|
306 |
function addSearch($queryString, $numberOfHits) {
|
307 |
-
$this->appendPreScript($this->
|
308 |
}
|
309 |
|
310 |
-
|
311 |
-
*
|
312 |
-
*
|
313 |
*/
|
314 |
function addRegister($userID, $result) {
|
315 |
-
$this->appendPreScript($this->
|
316 |
}
|
317 |
|
318 |
-
|
319 |
-
*The userid gets a md5() to fullfilll german datenschutzgesetz
|
320 |
-
*
|
321 |
*/
|
322 |
function addLogin($userID, $result) {
|
323 |
-
$this->appendPreScript($this->
|
324 |
}
|
325 |
|
326 |
-
|
327 |
-
*
|
328 |
*/
|
329 |
function addContact($contactType) {
|
330 |
-
$this->appendPreScript($this->
|
331 |
}
|
332 |
|
333 |
-
|
334 |
-
*
|
335 |
*/
|
336 |
function addDownload($downloadLabel) {
|
337 |
-
$this->appendPreScript($this->
|
338 |
}
|
339 |
|
340 |
-
|
341 |
-
*
|
342 |
-
*
|
343 |
*/
|
344 |
function getEmosECPageArray($item, $event) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
|
346 |
-
|
347 |
-
|
348 |
-
$
|
349 |
-
$out .= "<script type=\"text/javascript\">$this->br" .
|
350 |
-
"<!--$this->br" .
|
351 |
-
"$this->tab var emosECPageArray = new Array();$this->br" .
|
352 |
-
"$this->tab emosECPageArray['event'] = '$event';$this->br" .
|
353 |
-
"$this->tab emosECPageArray['id'] = '$item->productID';$this->br" .
|
354 |
-
"$this->tab emosECPageArray['name'] = '$item->productName';$this->br" .
|
355 |
-
"$this->tab emosECPageArray['preis'] = '$item->price';$this->br" .
|
356 |
-
"$this->tab emosECPageArray['group'] = '$item->productGroup';$this->br" .
|
357 |
-
"$this->tab emosECPageArray['anzahl'] = '$item->quantity';$this->br" .
|
358 |
-
"$this->tab emosECPageArray['var1'] = '$item->variant1';$this->br" .
|
359 |
-
"$this->tab emosECPageArray['var2'] = '$item->variant2';$this->br" .
|
360 |
-
"$this->tab emosECPageArray['var3'] = '$item->variant3';$this->br" .
|
361 |
-
"// -->$this->br" .
|
362 |
-
"</script>$this->br";
|
363 |
-
return $out;
|
364 |
}
|
365 |
|
366 |
-
|
|
|
|
|
|
|
|
|
|
|
367 |
function addEmosBillingPageArray($billingID = "", $customerNumber = "", $total = 0, $country = "", $cip = "", $city = "") {
|
368 |
$out = $this->getEmosBillingArray($billingID, $customerNumber, $total, $country, $cip, $city, "emosBillingPageArray");
|
369 |
$this->appendPreScript($out);
|
370 |
}
|
371 |
|
372 |
-
|
|
|
|
|
373 |
function getEmosBillingArray($billingID = "", $customerNumber = "", $total = 0, $country = "", $cip = "", $city = "", $arrayName = "") {
|
374 |
-
|
375 |
-
/******************* prepare data *************************************/
|
376 |
-
/* md5 the customer id to fullfill requirements of german datenschutzgeesetz */
|
377 |
$customerNumber = md5($customerNumber);
|
378 |
-
|
379 |
$country = $this->emos_DataFormat($country);
|
380 |
$cip = $this->emos_DataFormat($cip);
|
381 |
$city = $this->emos_DataFormat($city);
|
382 |
|
383 |
-
/* get a / separated location
|
384 |
$ort = "";
|
385 |
if ($country) {
|
386 |
$ort .= "$country/";
|
@@ -394,98 +583,99 @@ class EMOS {
|
|
394 |
if ($cip) {
|
395 |
$ort .= $cip;
|
396 |
}
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
"</script>$this->br";
|
410 |
return $out;
|
411 |
}
|
412 |
|
413 |
-
|
414 |
function addEmosBasketPageArray($basket) {
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
function getEmosBasketPageArray($basket, $arrayName) {
|
421 |
-
$out = "";
|
422 |
-
$out .= "<script type=\"text/javascript\">$this->br" .
|
423 |
-
"<!--$this->br" .
|
424 |
-
"var $arrayName = new Array();$this->br";
|
425 |
-
$count = 0;
|
426 |
-
foreach ($basket as $item) {
|
427 |
-
|
428 |
-
$item = $this->emos_ItemFormat($item);
|
429 |
-
|
430 |
-
$out .= $this->br;
|
431 |
-
$out .= "$this->tab $arrayName" . "[$count]=new Array();$this->br";
|
432 |
-
$out .= "$this->tab $arrayName" . "[$count][0]='$item->productID';$this->br";
|
433 |
-
$out .= "$this->tab $arrayName" . "[$count][1]='$item->productName';$this->br";
|
434 |
-
$out .= "$this->tab $arrayName" . "[$count][2]='$item->price';$this->br";
|
435 |
-
$out .= "$this->tab $arrayName" . "[$count][3]='$item->productGroup';$this->br";
|
436 |
-
$out .= "$this->tab $arrayName" . "[$count][4]='$item->quantity';$this->br";
|
437 |
-
$out .= "$this->tab $arrayName" . "[$count][5]='$item->variant1';$this->br";
|
438 |
-
$out .= "$this->tab $arrayName" . "[$count][6]='$item->variant2';$this->br";
|
439 |
-
$out .= "$this->tab $arrayName" . "[$count][7]='$item->variant3';$this->br";
|
440 |
-
$count++;
|
441 |
}
|
442 |
-
$out .= "// -->$this->br" .
|
443 |
-
"</script>$this->br";
|
444 |
-
|
445 |
-
return $out;
|
446 |
-
}
|
447 |
-
|
448 |
-
/** adds a detailView to the preScript */
|
449 |
-
function addDetailView($item) {
|
450 |
-
$this->appendPreScript($this->getEmosECPageArray($item, "view"));
|
451 |
}
|
452 |
|
453 |
-
|
454 |
-
function
|
455 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
}
|
457 |
|
458 |
-
|
459 |
-
function addToBasket($item) {
|
460 |
-
$this->appendPreScript($this->getEmosECPageArray($item, "c_add"));
|
461 |
-
}
|
462 |
-
|
463 |
-
/**
|
464 |
* constructs a generic EmosCustomPageArray from a PHP Array
|
465 |
*/
|
466 |
function getEmosCustomPageArray($listOfValues){
|
467 |
-
|
468 |
$out = "";
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
|
|
|
|
|
|
|
|
479 |
}
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
}
|
486 |
-
|
487 |
-
|
488 |
-
/** constructs a emosCustomPageArray with 8 Variables and shortcut
|
489 |
* @param $cType Type of this event - shortcut in config
|
490 |
* @param $cVar1 first variable of this custom event (optional)
|
491 |
* @param $cVar2 second variable of this custom event (optional)
|
@@ -501,10 +691,7 @@ class EMOS {
|
|
501 |
* @param $cVar12 twelveth variable of this custom event (optional)
|
502 |
* @param $cVar13 thirteenth variable of this custom event (optional)
|
503 |
*/
|
504 |
-
function addEmosCustomPageArray($cType=0, $cVar1=0, $cVar2=0, $cVar3=0, $cVar4=0,
|
505 |
-
$cVar5=0, $cVar6=0, $cVar7=0, $cVar8=0, $cVar9=0,
|
506 |
-
$cVar10=0, $cVar11=0, $cVar12=0, $cVar13=0) {
|
507 |
-
|
508 |
$values[0] = $cType;
|
509 |
if($cVar1) $values[1] = $cVar1;
|
510 |
if($cVar2) $values[2] = $cVar2;
|
@@ -519,14 +706,12 @@ class EMOS {
|
|
519 |
if($cVar11) $values[11] = $cVar11;
|
520 |
if($cVar12) $values[12] = $cVar12;
|
521 |
if($cVar13) $values[13] = $cVar13;
|
522 |
-
|
523 |
-
$this->appendPreScript($this->getEmosCustomPageArray($values));
|
524 |
}
|
525 |
-
|
526 |
}
|
|
|
527 |
|
528 |
-
|
529 |
-
|
530 |
function getEmosECEvent($item, $event) {
|
531 |
$item = $this->emos_ItemFormat($item);
|
532 |
$out = "";
|
@@ -564,7 +749,7 @@ function getEMOSBasketEventArray($basket) {
|
|
564 |
return $b->getEmosBasketArray($basket, "emosBasketArray");
|
565 |
}
|
566 |
|
567 |
-
|
568 |
* If you want to track a product view, set the quantity to 1.
|
569 |
* For "real" basket items, the quantity should be given in your
|
570 |
* shopping systems basket/shopping cart.
|
1 |
<?php
|
|
|
|
|
2 |
/*******************************************************************************
|
3 |
* EMOS PHP Bib 2
|
4 |
+
* $Id: emos.php,v 1.15 2009/11/17 13:24:00 egaiser Exp $
|
5 |
********************************************************************************
|
6 |
|
7 |
+
Copyright (c) 2004 - 2009 ECONDA GmbH Karlsruhe
|
8 |
All rights reserved.
|
9 |
|
10 |
ECONDA GmbH
|
11 |
+
Eisenlohrstr. 43
|
12 |
+
76135 Karlsruhe
|
13 |
+
Tel.: 0721/663035-0
|
14 |
+
Fax.: 0721 663035-10
|
15 |
info@econda.de
|
16 |
www.econda.de
|
17 |
|
41 |
Changes:
|
42 |
|
43 |
$Log: emos.php,v $
|
44 |
+
Revision 1.15 2009/11/17 13:24:00 egaiser
|
45 |
+
update to handle anchor tags and properties array
|
46 |
+
added function trackMode to switch between anchor tags and properties array
|
47 |
+
added function debugMode to show debug information
|
48 |
+
added function rmvCdata to remove CDATA tag for properties array
|
49 |
+
added function addMarker
|
50 |
+
added function addTarget
|
51 |
+
added function addGoal to set target conversion
|
52 |
+
added function trackOnLoad to set automatic request on site load
|
53 |
+
added function addScript for additional external Javascript integration
|
54 |
+
several changes in structural output and string encoding
|
55 |
+
|
56 |
+
Revision 1.14 2009/02/19 09:52:56 unaegele
|
57 |
+
if function not exists fix (Removed in Revision 1.15)
|
58 |
+
|
59 |
Revision 1.13 2007/08/17 08:40:33 unaegele
|
60 |
added function addEMOSCustomPageArray
|
61 |
added function getEMOSCustomPageArray
|
92 |
|
93 |
Revision 1.1 added 1st party session tracking
|
94 |
|
|
|
95 |
*/
|
96 |
|
97 |
+
/* PHP Helper Class to construct a ECONDA Monitor statement for the later
|
98 |
* inclusion in a HTML/PHP Page.
|
99 |
*/
|
100 |
class EMOS {
|
101 |
|
102 |
+
/* Here we store the predefined parameter list */
|
|
|
|
|
|
|
|
|
103 |
var $preScript = "";
|
104 |
|
105 |
+
/* Here we store the additional script-files */
|
|
|
|
|
106 |
var $inScript = "";
|
107 |
|
108 |
+
/* Here we store additional parameters */
|
|
|
|
|
109 |
var $postScript = "";
|
110 |
|
111 |
+
/* path to the emos2.js script-file */
|
112 |
var $pathToFile = "";
|
113 |
|
114 |
+
/* Name of the script-file */
|
115 |
var $scriptFileName = "emos2.js";
|
116 |
|
|
|
|
|
|
|
|
|
117 |
/* session id for 1st party sessions*/
|
118 |
var $emsid = "";
|
119 |
|
120 |
/* visitor id for 1st partyx visitors */
|
121 |
var $emvid = "";
|
122 |
+
|
123 |
+
/* start js and init properties */
|
124 |
+
var $jsStart = "<script type=\"text/javascript\">\n//<![CDATA[\n var emospro = {};\n";
|
125 |
|
126 |
+
/* end js and fire properties */
|
127 |
+
var $jsEnd = " window.emosPropertiesEvent(emospro);\n//]]>\n</script>\n";
|
128 |
+
|
129 |
+
/* emos2 inclusion */
|
130 |
+
var $emosBib = "";
|
131 |
+
|
132 |
+
/* ec_event */
|
133 |
+
var $ecString = "";
|
134 |
+
|
135 |
+
/* remove cdata */
|
136 |
+
var $rmvCdata = true;
|
137 |
+
|
138 |
+
/* old style anchor tags*/
|
139 |
+
var $anchorTags = true;
|
140 |
+
|
141 |
+
/* count basket items */
|
142 |
+
var $ecCounter = 0;
|
143 |
+
|
144 |
+
/* send request on site load */
|
145 |
+
var $emosFire = true;
|
146 |
+
|
147 |
+
/* main out */
|
148 |
+
var $retString = "";
|
149 |
+
|
150 |
+
/* script to stopp request on site load */
|
151 |
+
var $emosStopRequest = "<script type=\"text/javascript\">\n//<![CDATA[\n window.emosTrackVersion = 2;\n//]]>\n</script>\n";
|
152 |
+
|
153 |
+
/* Debug Mode */
|
154 |
+
var $emosDebug = 0;
|
155 |
+
|
156 |
+
/* CSS Style and Div for Debug */
|
157 |
+
var $debugOut = "\n<script type=\"text/javascript\">\n function hideEcondaDebug(){\n document.getElementById(\"econdaDebugTxt\").style.visibility = \"hidden\";\n document.getElementById(\"econdaDebugStat\").style.visibility = \"hidden\";\n document.getElementById(\"econdaDebug\").style.width = \"35px\";\n document.getElementById(\"econdaDebug\").style.height = \"15px\";\n document.getElementById(\"econdaDebugShow\").style.visibility = \"visible\";\n }\n function showEcondaDebug(){\n document.getElementById(\"econdaDebugTxt\").style.visibility = \"visible\";\n document.getElementById(\"econdaDebugStat\").style.visibility = \"visible\";\n document.getElementById(\"econdaDebug\").style.width = \"auto\";\n document.getElementById(\"econdaDebug\").style.height = \"auto\";\n document.getElementById(\"econdaDebugShow\").style.visibility = \"hidden\";\n }\n function econdaDebug(dbtxt){\n document.getElementById(\"econdaDebugTxt\").innerHTML = dbtxt;\n }\n</script>\n<div name=\"econdaDebug\" id=\"econdaDebug\" style=\"position:absolute; visibility: visible; font-family: sans-serif; font-size: 12px; color: #FFFFFF; background-color: #0088B2; left: 0px; top: 0px; width: auto; height: auto; padding: 3px; z-index: 1000;\">\n<textarea style=\"min-width: 760px; font-family: sans-serif; font-size: 13px; background-color: #FFFFFF;\" name=\"econdaDebugTxt\" id=\"econdaDebugTxt\" wrap=\"off\" cols=\"120\" rows=\"22\">\n";
|
158 |
+
var $debugEnd = "</textarea>\n<div name=\"econdaDebugStat\" id=\"econdaDebugStat\" style=\"cursor: pointer; padding: 1px;\" align=\"right\" onClick=\"javascript:hideEcondaDebug();\">[econda debug mode] HIDE</div>\n<div name=\"econdaDebugShow\" id=\"econdaDebugShow\" style=\"position: absolute; visibility: hidden; top: 0px; left: 0px; cursor: pointer; z-index: 1001;\" onClick=\"javascript:showEcondaDebug();\">SHOW</div>\n</div>\n\n";
|
159 |
+
|
160 |
+
/*
|
161 |
* add compatibility function for php < 5.1
|
162 |
*/
|
163 |
function htmlspecialchars_decode_php4($str) {
|
164 |
return strtr($str, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));
|
165 |
}
|
166 |
|
167 |
+
/* Constructor
|
168 |
* Sets the path to the emos2.js js-bib and prepares the later calls
|
169 |
*
|
170 |
+
* @param $pathToFile The path to the js-bib (/js)
|
171 |
* @param $scriptFileName If we want to have annother Filename than
|
172 |
+
* emos2.js you can set it here
|
173 |
*/
|
174 |
function EMOS($pathToFile , $scriptFileName = "emos2.js") {
|
175 |
$this->pathToFile = $pathToFile;
|
176 |
+
if(substr($this->pathToFile,-8) == 'emos2.js') {
|
177 |
+
$this->pathToFile = substr($this->pathToFile,0,strlen($this->pathToFile)-8);
|
178 |
+
}
|
179 |
+
if(substr($this->pathToFile,-1) != '/') {
|
180 |
+
$this->pathToFile .= '/';
|
181 |
+
}
|
182 |
+
$this->scriptFileName = $scriptFileName;
|
183 |
+
if($this->scriptFileName == '' || $this->scriptFileName == null) {
|
184 |
+
$this->scriptFileName = 'emos2.js';
|
185 |
+
}
|
186 |
$this->prepareInScript();
|
|
|
187 |
}
|
188 |
+
|
189 |
/* formats data/values/params by eliminating named entities and xml-entities */
|
190 |
function emos_ItemFormat($item) {
|
191 |
$item->productID = $this->emos_DataFormat($item->productID);
|
199 |
|
200 |
/* formats data/values/params by eliminating named entities and xml-entities */
|
201 |
function emos_DataFormat($str) {
|
202 |
+
if($this->anchorTags) {
|
203 |
+
$str = urldecode($str);
|
204 |
+
//2007-05-10 Fix incompatibility with php4
|
205 |
+
if (function_exists('htmlspecialchars_decode')) {
|
206 |
+
$str = htmlspecialchars_decode($str, ENT_QUOTES);
|
207 |
+
} else {
|
208 |
+
$str = $this->htmlspecialchars_decode_php4($str);
|
209 |
+
}
|
210 |
+
$str = html_entity_decode($str);
|
211 |
+
$str = strip_tags($str);
|
212 |
+
$str = trim($str);
|
213 |
+
|
214 |
+
//2007-05-10 replace translated with spaces
|
215 |
+
$nbsp = chr(0xa0);
|
216 |
+
$str = str_replace($nbsp, " ", $str);
|
217 |
+
$str = str_replace("\"", "", $str);
|
218 |
+
$str = str_replace("'", "", $str);
|
219 |
+
$str = str_replace("%", "", $str);
|
220 |
+
$str = str_replace(",", "", $str);
|
221 |
+
$str = str_replace(";", "", $str);
|
222 |
+
/* remove unnecessary white spaces */
|
223 |
+
while (true) {
|
224 |
+
$str_temp = $str;
|
225 |
+
$str = str_replace(" ", " ", $str);
|
226 |
+
|
227 |
+
if ($str == $str_temp) {
|
228 |
break;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
$str = str_replace(" / ", "/", $str);
|
232 |
+
$str = str_replace(" /", "/", $str);
|
233 |
+
$str = str_replace("/ ", "/", $str);
|
234 |
+
$str = substr($str, 0, 254);
|
235 |
+
$str = rawurlencode($str);
|
236 |
+
}
|
237 |
+
else {
|
238 |
+
$str = utf8_decode($str);
|
239 |
+
$str = html_entity_decode($str);
|
240 |
+
$str = strip_tags($str);
|
241 |
+
$str = utf8_encode($str);
|
242 |
+
$str = addcslashes($str, "\\\"'&<>]");
|
243 |
+
$str = trim($str);
|
244 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
return $str;
|
246 |
}
|
247 |
|
248 |
+
/* set the 1st party session id */
|
|
|
|
|
249 |
function setSid($sid = "") {
|
250 |
if ($sid) {
|
251 |
$this->emsid = $sid;
|
253 |
}
|
254 |
}
|
255 |
|
256 |
+
/* set the 1st party visitor id */
|
|
|
|
|
257 |
function setVid($vid = "") {
|
258 |
if ($vid) {
|
259 |
$this->emvid = $vid;
|
261 |
}
|
262 |
}
|
263 |
|
264 |
+
/* nothing to do. */
|
|
|
|
|
265 |
function prettyPrint() {
|
|
|
|
|
266 |
}
|
267 |
|
268 |
+
/* Concatenates the current command and the $inScript */
|
269 |
function appendInScript($stringToAppend) {
|
270 |
$this->inScript .= $stringToAppend;
|
271 |
}
|
272 |
|
273 |
+
/* Concatenates the current command and the $proScript */
|
274 |
function appendPreScript($stringToAppend) {
|
275 |
$this->preScript .= $stringToAppend;
|
276 |
}
|
277 |
|
278 |
+
/* Concatenates the current command and the $postScript */
|
279 |
function appendPostScript($stringToAppend) {
|
280 |
$this->postScript .= $stringToAppend;
|
281 |
}
|
282 |
|
283 |
+
/* returns the emos2.js inclusion */
|
284 |
function prepareInScript() {
|
285 |
+
$this->emosBib .= "<script type=\"text/javascript\" src=\"".$this->pathToFile.$this->scriptFileName."\"></script>\n";
|
|
|
|
|
286 |
}
|
287 |
+
|
288 |
+
/* returns a javascript extra inclusion at defined position */
|
289 |
+
function addScript($script) {
|
290 |
+
$this->emosBib .= "<script type=\"text/javascript\" src=\"".$script."\"></script>\n";
|
291 |
+
}
|
292 |
|
293 |
+
/* returns the whole statement */
|
294 |
function toString() {
|
295 |
+
if(!$this->anchorTags){
|
296 |
+
if($this->ecString != ""){
|
297 |
+
$this->ecString = substr($this->ecString,0,-2)."\n";
|
298 |
+
$this->ecString .= " ];\n";
|
299 |
+
}
|
300 |
+
else {
|
301 |
+
$this->ecString = "";
|
302 |
+
}
|
303 |
+
if(!$this->emosFire) {
|
304 |
+
$this->jsEnd = str_replace(" window.emosPropertiesEvent(emospro);\n","",$this->jsEnd);
|
305 |
+
}
|
306 |
+
if($this->rmvCdata) {
|
307 |
+
$this->jsStart = str_replace("\n//<![CDATA[","",$this->jsStart);
|
308 |
+
$this->jsEnd = str_replace("//]]>\n","",$this->jsEnd);
|
309 |
+
$this->emosStopRequest = str_replace("\n//<![CDATA[","",$this->emosStopRequest);
|
310 |
+
$this->emosStopRequest = str_replace("\n//]]>","",$this->emosStopRequest);
|
311 |
+
}
|
312 |
+
}
|
313 |
+
if($this->anchorTags) { //anchor tags
|
314 |
+
if($this->ecString != "") {
|
315 |
+
$this->ecString .= "//]]>\n</script>\n";
|
316 |
+
}
|
317 |
+
if($this->rmvCdata) {
|
318 |
+
$this->preScript = str_replace("\n//<![CDATA[","",$this->preScript);
|
319 |
+
$this->preScript = str_replace("\n//]]>","",$this->preScript);
|
320 |
+
$this->ecString = str_replace("\n//<![CDATA[","",$this->ecString);
|
321 |
+
$this->ecString = str_replace("\n//]]>","",$this->ecString);
|
322 |
+
}
|
323 |
+
if($this->emosDebug > 0) {
|
324 |
+
$this->retString .= $this->debugOut . $this->preScript . $this->postScript . $this->ecString . $this->emosBib . $this->inScript . $this->debugEnd;
|
325 |
+
}
|
326 |
+
if($this->emosDebug == 0 || $this->emosDebug == 2){
|
327 |
+
$this->retString .= $this->preScript . $this->postScript . $this->ecString . $this->emosBib . $this->inScript;
|
328 |
+
}
|
329 |
+
}
|
330 |
+
else {
|
331 |
+
if($this->emosDebug > 0) {
|
332 |
+
$this->retString .= $this->debugOut . $this->emosStopRequest . $this->emosBib . $this->jsStart . $this->preScript . $this->ecString . $this->postScript . $this->jsEnd . $this->inScript . $this->debugEnd;
|
333 |
+
}
|
334 |
+
if($this->emosDebug == 0 || $this->emosDebug == 2){
|
335 |
+
$this->retString .= $this->emosStopRequest . $this->emosBib . $this->jsStart . $this->preScript . $this->ecString . $this->postScript . $this->jsEnd . $this->inScript;
|
336 |
+
}
|
337 |
+
}
|
338 |
+
return $this->retString;
|
339 |
+
}
|
340 |
+
|
341 |
+
/* constructs anchor tags */
|
342 |
function getAnchorTag($title = "", $rel = "", $rev = "") {
|
|
|
343 |
$rel = $this->emos_DataFormat($rel);
|
344 |
$rev = $this->emos_DataFormat($rev);
|
345 |
+
$anchor = "<a name=\"emos_name\" title=\"".$title."\" rel=\"".$rel."\" rev=\"".$rev."\"></a>\n";
|
|
|
|
|
|
|
346 |
return $anchor;
|
347 |
+
}
|
348 |
+
|
349 |
+
/* constructs a js property event */
|
350 |
+
function getProperty($title = "", $rel = "", $rev = "", $brck = false) {
|
351 |
+
if($this->anchorTags) {
|
352 |
+
return $this->getAnchorTag($title, $rel, $rev);
|
353 |
+
}
|
354 |
+
$rel = $this->emos_DataFormat($rel);
|
355 |
+
$rev = $this->emos_DataFormat($rev);
|
356 |
+
$setRev = false;
|
357 |
+
if(trim($rev) != "") {
|
358 |
+
$setRev = true;
|
359 |
+
}
|
360 |
+
$out = " emospro.".$title." = ";
|
361 |
+
if($setRev) {
|
362 |
+
$out .= "[[";
|
363 |
+
}
|
364 |
+
$out .= "'".$rel."'";
|
365 |
+
if($setRev) {
|
366 |
+
if($brck) {
|
367 |
+
$out .= "]]";
|
368 |
+
}
|
369 |
+
else {
|
370 |
+
$out .= ",'".$rev."']]";
|
371 |
+
}
|
372 |
+
}
|
373 |
+
$out .= ";\n";
|
374 |
+
return $out;
|
375 |
}
|
376 |
|
377 |
+
/* adds a property event for marker tracking
|
378 |
+
* emospro.marker = content
|
379 |
+
*/
|
380 |
+
function addMarker($content) {
|
381 |
+
$this->appendPreScript($this->getProperty("marker", $content, "", true));
|
382 |
+
}
|
383 |
+
|
384 |
+
/* adds a property event for target tracking
|
385 |
+
* emospro.Target = [[group,name]]
|
386 |
+
*/
|
387 |
+
function addTarget($group, $name) {
|
388 |
+
$this->appendPreScript($this->getProperty("Target", $group, $name));
|
389 |
+
}
|
390 |
+
|
391 |
+
/* adds a property event for target conversion
|
392 |
+
* emospro.cGoal = 0 or 1
|
393 |
+
*/
|
394 |
+
function addGoal($goal) {
|
395 |
+
$this->appendPreScript($this->getProperty("cGoal", $goal));
|
396 |
+
}
|
397 |
+
|
398 |
+
/* remove CDATA from script */
|
399 |
+
function addCdata() {
|
400 |
+
$this->rmvCdata = false;
|
401 |
+
}
|
402 |
+
|
403 |
+
/* set tracking mode
|
404 |
+
* 2 = js properties, everything else = anchor tags
|
405 |
+
*/
|
406 |
+
function trackMode($mode) {
|
407 |
+
if($mode == 2) {
|
408 |
+
$this->anchorTags = false;
|
409 |
+
}
|
410 |
+
}
|
411 |
+
|
412 |
+
/* send request on site load
|
413 |
+
* true or false
|
414 |
+
*/
|
415 |
+
function trackOnLoad($send) {
|
416 |
+
$this->emosFire = $send;
|
417 |
+
}
|
418 |
+
|
419 |
+
/* show debug informations inside a container
|
420 |
+
* 1 = debug only, 2 = debug and send request
|
421 |
+
*/
|
422 |
+
function debugMode($send) {
|
423 |
+
$this->emosDebug = $send;
|
424 |
+
}
|
425 |
+
|
426 |
+
/* adds a property event for content tracking
|
427 |
+
* emospro.content = content
|
428 |
*/
|
429 |
function addContent($content) {
|
430 |
+
$this->appendPreScript($this->getProperty("content", $content));
|
431 |
}
|
432 |
|
433 |
+
/* adds a property event for orderprocess tracking
|
434 |
+
* emospro.orderProcess = processStep
|
435 |
*/
|
436 |
function addOrderProcess($processStep) {
|
437 |
+
$this->appendPreScript($this->getProperty("orderProcess", $processStep));
|
438 |
}
|
439 |
|
440 |
+
/* adds a property event for siteid tracking
|
441 |
+
* emospro.siteid = siteid
|
442 |
*/
|
443 |
function addSiteID($siteid) {
|
444 |
+
$this->appendPreScript($this->getProperty("siteid", $siteid));
|
445 |
}
|
446 |
|
447 |
+
/* adds a property event for language tracking
|
448 |
+
* emospro.langid = langid
|
449 |
*/
|
450 |
function addLangID($langid) {
|
451 |
+
$this->appendPreScript($this->getProperty("langid", $langid));
|
452 |
}
|
453 |
|
454 |
+
/* adds a property event for country tracking
|
455 |
+
* emospro.countryid = countryid
|
456 |
*/
|
457 |
function addCountryID($countryid) {
|
458 |
+
$this->appendPreScript($this->getProperty("countryid", $countryid));
|
459 |
}
|
460 |
|
461 |
+
/* adds a property event for pageid tracking
|
462 |
+
* emospro.pageid = pageID
|
463 |
+
*/
|
464 |
function addPageID($pageID) {
|
465 |
+
if(!$this->anchorTags) {
|
466 |
+
$this->appendPreScript($this->getProperty("pageId", $pageID));
|
467 |
+
}
|
468 |
+
else {
|
469 |
+
$this->appendPreScript("<script type=\"text/javascript\">\n//<![CDATA[\n window.emosPageId = '$pageID';\n//]]>\n</script>\n");
|
470 |
+
}
|
471 |
}
|
472 |
|
473 |
+
/* adds a property event for search tracking
|
474 |
+
* emospro.search = [[queryString,numberOfHits]]
|
475 |
*/
|
476 |
function addSearch($queryString, $numberOfHits) {
|
477 |
+
$this->appendPreScript($this->getProperty("search", $queryString, $numberOfHits));
|
478 |
}
|
479 |
|
480 |
+
/* adds a property event for registration tracking
|
481 |
+
* The userid gets a md5() to fullfilll german datenschutzgesetz
|
482 |
+
* emospro.register = [[userID,result]] //(result: 0=true,1=false)
|
483 |
*/
|
484 |
function addRegister($userID, $result) {
|
485 |
+
$this->appendPreScript($this->getProperty("register", md5($userID), $result));
|
486 |
}
|
487 |
|
488 |
+
/* adds a property event for login tracking
|
489 |
+
* The userid gets a md5() to fullfilll german datenschutzgesetz
|
490 |
+
* emospro.login = [[userID,result]] //(result: 0=true,1=false)
|
491 |
*/
|
492 |
function addLogin($userID, $result) {
|
493 |
+
$this->appendPreScript($this->getProperty("login", md5($userID), $result));
|
494 |
}
|
495 |
|
496 |
+
/* adds a property event for contact tracking
|
497 |
+
* emospro.scontact = contactType
|
498 |
*/
|
499 |
function addContact($contactType) {
|
500 |
+
$this->appendPreScript($this->getProperty("scontact", $contactType));
|
501 |
}
|
502 |
|
503 |
+
/* adds a property event for download tracking
|
504 |
+
* emospro.download = downloadLabel
|
505 |
*/
|
506 |
function addDownload($downloadLabel) {
|
507 |
+
$this->appendPreScript($this->getProperty("download", $downloadLabel));
|
508 |
}
|
509 |
|
510 |
+
/* constructs a emosECPageArray of given $event type
|
511 |
+
* @param $item a instance of class EMOS_Item
|
512 |
+
* @param $event Type of this event ("add","c_rmv","c_add")
|
513 |
*/
|
514 |
function getEmosECPageArray($item, $event) {
|
515 |
+
if(!$this->anchorTags){
|
516 |
+
$item = $this->emos_ItemFormat($item);
|
517 |
+
if($this->ecString == "") {
|
518 |
+
$this->ecString .= " emospro.ec_Event = [\n";
|
519 |
+
}
|
520 |
+
$this->ecString .= " ['".$event."','".$item->productID."','".$item->productName."','".$item->price."','".$item->productGroup."','".$item->quantity."','".$item->variant1."','".$item->variant2."','".$item->variant2."'],\n";
|
521 |
+
}
|
522 |
+
else { //anchor tags
|
523 |
+
$item = $this->emos_ItemFormat($item);
|
524 |
+
if($this->ecCounter == 0) {
|
525 |
+
$this->ecString .= "<script type=\"text/javascript\">\n//<![CDATA[\n";
|
526 |
+
$this->ecString .= " var emosECPageArray = new Array();\n";
|
527 |
+
}
|
528 |
+
$this->ecString .=" emosECPageArray[".$this->ecCounter."] = new Array();\n" .
|
529 |
+
" emosECPageArray[".$this->ecCounter."]['event'] = '".$event."';\n" .
|
530 |
+
" emosECPageArray[".$this->ecCounter."]['id'] = '".$item->productID."';\n" .
|
531 |
+
" emosECPageArray[".$this->ecCounter."]['name'] = '".$item->productName."';\n" .
|
532 |
+
" emosECPageArray[".$this->ecCounter."]['preis'] = '".$item->price."';\n" .
|
533 |
+
" emosECPageArray[".$this->ecCounter."]['group'] = '".$item->productGroup."';\n" .
|
534 |
+
" emosECPageArray[".$this->ecCounter."]['anzahl'] = '".$item->quantity."';\n" .
|
535 |
+
" emosECPageArray[".$this->ecCounter."]['var1'] = '".$item->variant1."';\n" .
|
536 |
+
" emosECPageArray[".$this->ecCounter."]['var2'] = '".$item->variant2."';\n" .
|
537 |
+
" emosECPageArray[".$this->ecCounter."]['var3'] = '".$item->variant3."';\n" ;
|
538 |
+
$this->ecCounter += 1;
|
539 |
+
}
|
540 |
+
}
|
541 |
+
|
542 |
+
/* adds a detailView to the preScript */
|
543 |
+
function addDetailView($item) {
|
544 |
+
$this->getEmosECPageArray($item, "view");
|
545 |
+
}
|
546 |
|
547 |
+
/* adds a removeFromBasket to the preScript */
|
548 |
+
function removeFromBasket($item) {
|
549 |
+
$this->getEmosECPageArray($item, "c_rmv");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
550 |
}
|
551 |
|
552 |
+
/* adds a addToBasket to the preScript */
|
553 |
+
function addToBasket($item) {
|
554 |
+
$this->getEmosECPageArray($item, "c_add");
|
555 |
+
}
|
556 |
+
|
557 |
+
/* constructs a emosBillingPageArray of given $event type */
|
558 |
function addEmosBillingPageArray($billingID = "", $customerNumber = "", $total = 0, $country = "", $cip = "", $city = "") {
|
559 |
$out = $this->getEmosBillingArray($billingID, $customerNumber, $total, $country, $cip, $city, "emosBillingPageArray");
|
560 |
$this->appendPreScript($out);
|
561 |
}
|
562 |
|
563 |
+
/* gets a emosBillingArray for a given ArrayName
|
564 |
+
* md5 the customer id to to fullfilll german datenschutzgesetz
|
565 |
+
*/
|
566 |
function getEmosBillingArray($billingID = "", $customerNumber = "", $total = 0, $country = "", $cip = "", $city = "", $arrayName = "") {
|
|
|
|
|
|
|
567 |
$customerNumber = md5($customerNumber);
|
|
|
568 |
$country = $this->emos_DataFormat($country);
|
569 |
$cip = $this->emos_DataFormat($cip);
|
570 |
$city = $this->emos_DataFormat($city);
|
571 |
|
572 |
+
/* get a / separated location string for later drilldown */
|
573 |
$ort = "";
|
574 |
if ($country) {
|
575 |
$ort .= "$country/";
|
583 |
if ($cip) {
|
584 |
$ort .= $cip;
|
585 |
}
|
586 |
+
if(!$this->anchorTags){
|
587 |
+
$out = " emospro.billing = [['".$billingID."','".$customerNumber."','".$ort."','".$total."']];\n";
|
588 |
+
}
|
589 |
+
else { //anchor tags
|
590 |
+
$out = "<script type=\"text/javascript\">\n//<![CDATA[\n" .
|
591 |
+
" var ".$arrayName." = new Array();\n" .
|
592 |
+
" ".$arrayName."[0] = '".$billingID."';\n" .
|
593 |
+
" ".$arrayName."[1] = '".$customerNumber."';\n" .
|
594 |
+
" ".$arrayName."[2] = '".$ort."';\n" .
|
595 |
+
" ".$arrayName."[3] = '".$total."';\n" .
|
596 |
+
"//]]>\n</script>\n";
|
597 |
+
}
|
|
|
598 |
return $out;
|
599 |
}
|
600 |
|
601 |
+
/* adds a emosBasket Page Array*/
|
602 |
function addEmosBasketPageArray($basket) {
|
603 |
+
if(!$this->anchorTags){
|
604 |
+
$this->getEmosBasketPageArray($basket, "buy");
|
605 |
+
}
|
606 |
+
else {
|
607 |
+
$this->getEmosBasketPageArray($basket, "emosBasketPageArray");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
608 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
609 |
}
|
610 |
|
611 |
+
/* returns a emosBasketArray of given Name */
|
612 |
+
function getEmosBasketPageArray($basket, $event) {
|
613 |
+
if(!$this->anchorTags){
|
614 |
+
if($this->ecString == "") {
|
615 |
+
$this->ecString .= " emospro.ec_Event = [\n";
|
616 |
+
}
|
617 |
+
foreach ($basket as $item) {
|
618 |
+
$item = $this->emos_ItemFormat($item);
|
619 |
+
$this->ecString .= " ['".$event."','".$item->productID."','".$item->productName."','".$item->price."','".$item->productGroup."','".$item->quantity."','".$item->variant1."','".$item->variant2."','".$item->variant2."'],\n";
|
620 |
+
}
|
621 |
+
}
|
622 |
+
else {
|
623 |
+
$out = "<script type=\"text/javascript\">\n//<![CDATA[\n" .
|
624 |
+
" var ".$event." = new Array();\n";
|
625 |
+
$count = 0;
|
626 |
+
foreach ($basket as $item) {
|
627 |
+
$item = $this->emos_ItemFormat($item);
|
628 |
+
$out .= " ".$event."[".$count."]=new Array();\n";
|
629 |
+
$out .= " ".$event."[".$count."][0]='".$item->productID."';\n";
|
630 |
+
$out .= " ".$event."[".$count."][1]='".$item->productName."';\n";
|
631 |
+
$out .= " ".$event."[".$count."][2]='".$item->price."';\n";
|
632 |
+
$out .= " ".$event."[".$count."][3]='".$item->productGroup."';\n";
|
633 |
+
$out .= " ".$event."[".$count."][4]='".$item->quantity."';\n";
|
634 |
+
$out .= " ".$event."[".$count."][5]='".$item->variant1."';\n";
|
635 |
+
$out .= " ".$event."[".$count."][6]='".$item->variant2."';\n";
|
636 |
+
$out .= " ".$event."[".$count."][7]='".$item->variant3."';\n";
|
637 |
+
$count++;
|
638 |
+
}
|
639 |
+
$out .= "//]]>\n</script>\n";
|
640 |
+
$this->appendPreScript($out);
|
641 |
+
}
|
642 |
}
|
643 |
|
644 |
+
/*
|
|
|
|
|
|
|
|
|
|
|
645 |
* constructs a generic EmosCustomPageArray from a PHP Array
|
646 |
*/
|
647 |
function getEmosCustomPageArray($listOfValues){
|
|
|
648 |
$out = "";
|
649 |
+
if(!$this->anchorTags){
|
650 |
+
$counter = 0;
|
651 |
+
foreach ($listOfValues as $value) {
|
652 |
+
$value = $this->emos_DataFormat($value);
|
653 |
+
if($counter == 0) {
|
654 |
+
$out .= " emospro.".$value." = [[";
|
655 |
+
}
|
656 |
+
else {
|
657 |
+
$out .= "'".$value."',";
|
658 |
+
}
|
659 |
+
$counter += 1;
|
660 |
+
}
|
661 |
+
$out = substr($out,0,-1);
|
662 |
+
$out .= "]];\n";
|
663 |
}
|
664 |
+
else {
|
665 |
+
$out .= "<script type=\"text/javascript\">\n";
|
666 |
+
$out .= " window.emosCustomPageArray = [";
|
667 |
+
foreach ($listOfValues as $value) {
|
668 |
+
$value = $this->emos_DataFormat($value);
|
669 |
+
$out .= "'".$value."',";
|
670 |
+
}
|
671 |
+
$out = substr($out,0,-1);
|
672 |
+
$out .= "];\n";
|
673 |
+
$out .= "</script>\n";
|
674 |
+
}
|
675 |
+
$this->appendPreScript($out);
|
676 |
}
|
677 |
+
|
678 |
+
/* constructs a emosCustomPageArray with 8 Variables and shortcut
|
|
|
679 |
* @param $cType Type of this event - shortcut in config
|
680 |
* @param $cVar1 first variable of this custom event (optional)
|
681 |
* @param $cVar2 second variable of this custom event (optional)
|
691 |
* @param $cVar12 twelveth variable of this custom event (optional)
|
692 |
* @param $cVar13 thirteenth variable of this custom event (optional)
|
693 |
*/
|
694 |
+
function addEmosCustomPageArray($cType=0, $cVar1=0, $cVar2=0, $cVar3=0, $cVar4=0, $cVar5=0, $cVar6=0, $cVar7=0, $cVar8=0, $cVar9=0, $cVar10=0, $cVar11=0, $cVar12=0, $cVar13=0) {
|
|
|
|
|
|
|
695 |
$values[0] = $cType;
|
696 |
if($cVar1) $values[1] = $cVar1;
|
697 |
if($cVar2) $values[2] = $cVar2;
|
706 |
if($cVar11) $values[11] = $cVar11;
|
707 |
if($cVar12) $values[12] = $cVar12;
|
708 |
if($cVar13) $values[13] = $cVar13;
|
709 |
+
$this->getEmosCustomPageArray($values);
|
|
|
710 |
}
|
|
|
711 |
}
|
712 |
+
/* EMOS class end */
|
713 |
|
714 |
+
/* global Functions */
|
|
|
715 |
function getEmosECEvent($item, $event) {
|
716 |
$item = $this->emos_ItemFormat($item);
|
717 |
$out = "";
|
749 |
return $b->getEmosBasketArray($basket, "emosBasketArray");
|
750 |
}
|
751 |
|
752 |
+
/* A Class to hold products as well a basket items
|
753 |
* If you want to track a product view, set the quantity to 1.
|
754 |
* For "real" basket items, the quantity should be given in your
|
755 |
* shopping systems basket/shopping cart.
|
app/code/local/Mage/Econda/Model/System/Config/Source/Tracking.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mage_Econda_Model_System_Config_Source_Tracking
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value'=>'1', 'label'=>Mage::helper('econda')->__('Version 1 - html')),
|
9 |
+
array('value'=>'2', 'label'=>Mage::helper('econda')->__('Version 2 - javascript'))
|
10 |
+
);
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Mage/Econda/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Mage_Econda>
|
5 |
-
<version>1.0
|
6 |
</Mage_Econda>
|
7 |
</modules>
|
8 |
<frontend>
|
@@ -72,7 +72,6 @@
|
|
72 |
</layout>
|
73 |
</adminhtml>
|
74 |
<global>
|
75 |
-
|
76 |
<resources>
|
77 |
<econda_setup>
|
78 |
<setup>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Mage_Econda>
|
5 |
+
<version>1.1.0</version>
|
6 |
</Mage_Econda>
|
7 |
</modules>
|
8 |
<frontend>
|
72 |
</layout>
|
73 |
</adminhtml>
|
74 |
<global>
|
|
|
75 |
<resources>
|
76 |
<econda_setup>
|
77 |
<setup>
|
app/code/local/Mage/Econda/etc/system.xml
CHANGED
@@ -53,7 +53,17 @@
|
|
53 |
<show_in_website>1</show_in_website>
|
54 |
<show_in_store>0</show_in_store>
|
55 |
</tracking_language>
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
</econda>
|
58 |
</groups>
|
59 |
</econda>
|
53 |
<show_in_website>1</show_in_website>
|
54 |
<show_in_store>0</show_in_store>
|
55 |
</tracking_language>
|
56 |
+
<tracking_version>
|
57 |
+
<label>Tracking Version</label>
|
58 |
+
<comment>Only newer versions of the emos2.js file (received after September 2009) can handle Version 2. Copy your personal emos2.js file into the direcotory /js/tracker/.</comment>
|
59 |
+
<frontend_type>select</frontend_type>
|
60 |
+
<source_model>econda/system_config_source_tracking</source_model>
|
61 |
+
<sort_order>2</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>0</show_in_store>
|
65 |
+
</tracking_version>
|
66 |
+
</fields>
|
67 |
</econda>
|
68 |
</groups>
|
69 |
</econda>
|
app/design/frontend/default/default/template/econda/tracker.phtml
CHANGED
@@ -1,9 +1,8 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
?>
|
8 |
|
9 |
|
1 |
+
<?php
|
2 |
+
$realUrlNoOp = Mage::helper('core/url')->getCurrentUrl();
|
3 |
+
if(stristr($realUrlNoOp,'checkout/onepage/index/') == false) {
|
4 |
+
echo $this->getEmos();
|
5 |
+
}
|
6 |
+
?>
|
|
|
7 |
|
8 |
|
app/design/frontend/default/default/template/econda/trackerop.phtml
CHANGED
@@ -1,11 +1,13 @@
|
|
1 |
-
|
2 |
<?php
|
3 |
|
4 |
$realUrlOp = Mage::helper('core/url')->getCurrentUrl();
|
5 |
$opsession = Mage::getSingleton('checkout/session');
|
6 |
|
7 |
if(stristr($realUrlOp,'checkout/onepage/') != false) {
|
8 |
-
|
|
|
|
|
|
|
9 |
$pathToEmos = $this->getJsUrl().'tracker/emos2.js';
|
10 |
$pathToOpJs = $this->getJsUrl().'tracker/emosop.js';
|
11 |
|
@@ -17,87 +19,114 @@ if(stristr($realUrlOp,'checkout/onepage/') != false) {
|
|
17 |
$customerId = md5(Mage::getSingleton('customer/session')->getCustomerId());
|
18 |
|
19 |
$setPageId = md5($splitSessionData[0]);
|
20 |
-
$setSiteID = dataFormat($splitSessionData[1]);
|
21 |
$setLangID = $splitSessionData[2];
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
$langPathOp = Mage::getStoreConfig($langValueOP, $storeIdOp);
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
|
38 |
$langStep[0] = $eLang[0]; $langStep[1] = $eLang[43]; $langStep[2] = $eLang[2].'/'.$eLang[3];
|
39 |
$langStep[3] = $eLang[2].'/'.$eLang[4]; $langStep[4] = $eLang[5]; $langStep[5] = $eLang[42];
|
40 |
$langStep[6] = $eLang[43]; $langStep[7] = $eLang[32];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
-
|
43 |
-
$emosOut = "\n<!-- Start Econda-Monitor -->\n";
|
44 |
-
$emosOut .= "\n<a name=\"emos_name\" title=\"content\" rel=\"Start/".$eLang[38]."\" rev=\"\"></a>\n";
|
45 |
-
$emosOut .= "\n<script type=\"text/javascript\">\n";
|
46 |
-
$emosOut .= " window.emosPageId = '".$setPageId."'; \n";
|
47 |
-
$emosOut .= " ecStep = new Array('".$langStep[0]."','".$langStep[1]."','".$langStep[2]."','".$langStep[3]."','".$langStep[4]."','".$langStep[5]."','".$langStep[6]."','".$langStep[7]."');\n";
|
48 |
-
$emosOut .= "</script>\n";
|
49 |
-
$emosOut .= "\n<a name=\"emos_name\" title=\"siteid\" rel=\"".$setSiteID."\" rev=\"\"></a>";
|
50 |
-
$emosOut .= "\n<a name=\"emos_name\" title=\"langid\" rel=\"".$setLangID."\" rev=\"\"></a>\n";
|
51 |
-
|
52 |
-
if(stristr($this->getMessagesBlock()->getGroupedHtml(),'error-msg') != false) {
|
53 |
-
$emosOut .= "<a name=\"emos_name\" title=\"login\" rel=\"".$customerId."\" rev=\"1\"></a>\n";
|
54 |
-
}
|
55 |
-
$isLoggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
|
56 |
-
|
57 |
-
if($isLoggedIn == 1 && $opsession->getData('econda_logged') != 2) {
|
58 |
-
$emosOut .= "<a name=\"emos_name\" title=\"login\" rel=\"".$customerId."\" rev=\"0\"></a>\n";
|
59 |
-
$opsession->setData('econda_logged','2');
|
60 |
-
}
|
61 |
-
|
62 |
echo $emosOut;
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
65 |
echo "\n<!-- End Econda-Monitor -->\n";
|
66 |
}
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
|
|
|
|
101 |
return $str;
|
102 |
}
|
103 |
?>
|
|
|
1 |
<?php
|
2 |
|
3 |
$realUrlOp = Mage::helper('core/url')->getCurrentUrl();
|
4 |
$opsession = Mage::getSingleton('checkout/session');
|
5 |
|
6 |
if(stristr($realUrlOp,'checkout/onepage/') != false) {
|
7 |
+
|
8 |
+
$storeIdOp = $this->getStore();
|
9 |
+
$emVersion = Mage::getStoreConfig('econda/econda/tracking_version', $storeIdOp);
|
10 |
+
|
11 |
$pathToEmos = $this->getJsUrl().'tracker/emos2.js';
|
12 |
$pathToOpJs = $this->getJsUrl().'tracker/emosop.js';
|
13 |
|
19 |
$customerId = md5(Mage::getSingleton('customer/session')->getCustomerId());
|
20 |
|
21 |
$setPageId = md5($splitSessionData[0]);
|
22 |
+
$setSiteID = dataFormat($splitSessionData[1],$emVersion);
|
23 |
$setLangID = $splitSessionData[2];
|
24 |
|
25 |
+
$langValueOP = 'econda/econda/tracking_language';
|
26 |
+
$langPathOp = Mage::getStoreConfig($langValueOP, $storeIdOp);
|
|
|
27 |
|
28 |
+
if($langPathOp == '0') {
|
29 |
+
$langFileOp = 'german';
|
30 |
+
}
|
31 |
+
else if($langPathOp == '1') {
|
32 |
+
$langFileOp = 'english';
|
33 |
+
}
|
34 |
+
else {
|
35 |
+
$langFileOp = 'german';
|
36 |
+
}
|
37 |
+
require_once ('app/code/local/Mage/Econda/Language/'.$langFileOp.'.php');
|
38 |
|
39 |
$langStep[0] = $eLang[0]; $langStep[1] = $eLang[43]; $langStep[2] = $eLang[2].'/'.$eLang[3];
|
40 |
$langStep[3] = $eLang[2].'/'.$eLang[4]; $langStep[4] = $eLang[5]; $langStep[5] = $eLang[42];
|
41 |
$langStep[6] = $eLang[43]; $langStep[7] = $eLang[32];
|
42 |
+
|
43 |
+
$emosLogin = "";
|
44 |
+
if(stristr($this->getMessagesBlock()->getGroupedHtml(),'error-msg') != false) {
|
45 |
+
$emosLogin .= " emospro.login = [['".$customerId."','1']];\n";
|
46 |
+
}
|
47 |
+
$isLoggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
|
48 |
+
|
49 |
+
if($isLoggedIn == 1 && $opsession->getData('econda_logged') != 2) {
|
50 |
+
$emosLogin .= " emospro.login = [['".$customerId."','0']];\n";
|
51 |
+
$opsession->setData('econda_logged','2');
|
52 |
+
}
|
53 |
+
|
54 |
+
if($emVersion == '2') {
|
55 |
+
$emosOut = "\n<!-- Start Econda-Monitor -->\n";
|
56 |
+
$emosOut .= "\n<script type=\"text/javascript\">\n//<![CDATA[\n";
|
57 |
+
$emosOut .= " window.emosTrackVersion = 2;\n";
|
58 |
+
$emosOut .= "//]]>\n</script>";
|
59 |
+
$emosOut .= $emosInclude;
|
60 |
+
$emosOut .= "<script type=\"text/javascript\">\n//<![CDATA[\n";
|
61 |
+
$emosOut .= " ecStep = new Array('".$langStep[0]."','".$langStep[1]."','".$langStep[2]."','".$langStep[3]."','".$langStep[4]."','".$langStep[5]."','".$langStep[6]."','".$langStep[7]."');\n";
|
62 |
+
$emosOut .= " var emospro = {};\n";
|
63 |
+
$emosOut .= " emospro.content = 'Start/".$eLang[38]."';\n";
|
64 |
+
$emosOut .= " emospro.pageId = '".$setPageId."';\n";
|
65 |
+
$emosOut .= " emospro.siteid = '".$setSiteID."';\n";
|
66 |
+
$emosOut .= " emospro.langid = '".$setLangID."';\n";
|
67 |
+
$emosOut .= $emosLogin;
|
68 |
+
}
|
69 |
+
else {
|
70 |
+
$emosOut = "\n<!-- Start Econda-Monitor -->\n";
|
71 |
+
$emosOut .= "\n<a name=\"emos_name\" title=\"content\" rel=\"Start/".$eLang[38]."\" rev=\"\"></a>\n";
|
72 |
+
$emosOut .= "<script type=\"text/javascript\">\n//<![CDATA[\n";
|
73 |
+
$emosOut .= " window.emosPageId = '".$setPageId."'; \n";
|
74 |
+
$emosOut .= " ecStep = new Array('".$langStep[0]."','".$langStep[1]."','".$langStep[2]."','".$langStep[3]."','".$langStep[4]."','".$langStep[5]."','".$langStep[6]."','".$langStep[7]."');\n";
|
75 |
+
$emosOut .= " var emospro = {};\n";
|
76 |
+
$emosOut .= $emosLogin;
|
77 |
+
$emosOut .= "//]]>\n</script>";
|
78 |
+
$emosOut .= "\n<a name=\"emos_name\" title=\"siteid\" rel=\"".$setSiteID."\" rev=\"\"></a>";
|
79 |
+
$emosOut .= "\n<a name=\"emos_name\" title=\"langid\" rel=\"".$setLangID."\" rev=\"\"></a>";
|
80 |
+
}
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
echo $emosOut;
|
83 |
+
if($emVersion == '2') {
|
84 |
+
echo "//]]>\n</script>\n".$opInclude;
|
85 |
+
}
|
86 |
+
else {
|
87 |
+
echo $emosInclude;
|
88 |
+
echo $opInclude;
|
89 |
+
}
|
90 |
echo "\n<!-- End Econda-Monitor -->\n";
|
91 |
}
|
92 |
|
93 |
+
function dataFormat($str,$emVersion) {
|
94 |
+
if($emVersion == '2') {
|
95 |
+
$str = utf8_decode($str);
|
96 |
+
$str = html_entity_decode($str);
|
97 |
+
$str = utf8_encode($str);
|
98 |
+
$str = addcslashes($str, "\\\"'&<>]");
|
99 |
+
}
|
100 |
+
else {
|
101 |
+
$str = urldecode($str);
|
102 |
+
if (function_exists('htmlspecialchars_decode')) {
|
103 |
+
$str = htmlspecialchars_decode($str, ENT_QUOTES);
|
104 |
+
} else {
|
105 |
+
$str = $this->htmlspecialchars_decode_php4($str);
|
106 |
+
}
|
107 |
+
$str = html_entity_decode($str);
|
108 |
+
$str = strip_tags($str);
|
109 |
+
$str = trim($str);
|
110 |
+
$nbsp = chr(0xa0);
|
111 |
+
$str = str_replace($nbsp, " ", $str);
|
112 |
+
$str = str_replace("\"", "", $str);
|
113 |
+
$str = str_replace("'", "", $str);
|
114 |
+
$str = str_replace("%", "", $str);
|
115 |
+
$str = str_replace(",", "", $str);
|
116 |
+
$str = str_replace(";", "", $str);
|
117 |
+
while (true) {
|
118 |
+
$str_temp = $str;
|
119 |
+
$str = str_replace(" ", " ", $str);
|
120 |
+
if ($str == $str_temp) {
|
121 |
+
break;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
$str = str_replace(" / ", "/", $str);
|
125 |
+
$str = str_replace(" /", "/", $str);
|
126 |
+
$str = str_replace("/ ", "/", $str);
|
127 |
+
$str = substr($str, 0, 254);
|
128 |
+
$str = rawurlencode($str);
|
129 |
+
}
|
130 |
return $str;
|
131 |
}
|
132 |
?>
|
app/locale/de_AT/Mage_Econda.csv
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
"Used Language","Verwendete Sprache"
|
2 |
"Settings","Einstellungen"
|
3 |
-
"Select only the language, which at the time of initial activation of your econda product has been selected.","Nur die Sprache verwenden, welche bei der ersten Aktivierung Ihres econda Produktes ausgewählt wurde."
|
|
1 |
"Used Language","Verwendete Sprache"
|
2 |
"Settings","Einstellungen"
|
3 |
+
"Select only the language, which at the time of initial activation of your econda product has been selected.","Nur die Sprache verwenden, welche bei der ersten Aktivierung Ihres econda Produktes ausgewählt wurde."
|
4 |
+
"Only newer versions of the emos2.js file (received after September 2009) can handle Version 2. Copy your personal emos2.js file into the direcotory /js/tracker/.","Nur neuere Versionen der emos2.js Datei (Erhalten ab September 2009) können mit Version 2 umgehen. Kopieren Sie Ihre personalisierte emos2.js Datei in das Verzeichnis /js/tracker/."
|
app/locale/de_CH/Mage_Econda.csv
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
"Used Language","Verwendete Sprache"
|
2 |
"Settings","Einstellungen"
|
3 |
-
"Select only the language, which at the time of initial activation of your econda product has been selected.","Nur die Sprache verwenden, welche bei der ersten Aktivierung Ihres econda Produktes ausgewählt wurde."
|
|
1 |
"Used Language","Verwendete Sprache"
|
2 |
"Settings","Einstellungen"
|
3 |
+
"Select only the language, which at the time of initial activation of your econda product has been selected.","Nur die Sprache verwenden, welche bei der ersten Aktivierung Ihres econda Produktes ausgewählt wurde."
|
4 |
+
"Only newer versions of the emos2.js file (received after September 2009) can handle Version 2. Copy your personal emos2.js file into the direcotory /js/tracker/.","Nur neuere Versionen der emos2.js Datei (Erhalten ab September 2009) können mit Version 2 umgehen. Kopieren Sie Ihre personalisierte emos2.js Datei in das Verzeichnis /js/tracker/."
|
app/locale/de_DE/Mage_Econda.csv
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
"Used Language","Verwendete Sprache"
|
2 |
"Settings","Einstellungen"
|
3 |
-
"Select only the language, which at the time of initial activation of your econda product has been selected.","Nur die Sprache verwenden, welche bei der ersten Aktivierung Ihres econda Produktes ausgewählt wurde."
|
|
1 |
"Used Language","Verwendete Sprache"
|
2 |
"Settings","Einstellungen"
|
3 |
+
"Select only the language, which at the time of initial activation of your econda product has been selected.","Nur die Sprache verwenden, welche bei der ersten Aktivierung Ihres econda Produktes ausgewählt wurde."
|
4 |
+
"Only newer versions of the emos2.js file (received after September 2009) can handle Version 2. Copy your personal emos2.js file into the direcotory /js/tracker/.","Nur neuere Versionen der emos2.js Datei (Erhalten ab September 2009) können mit Version 2 umgehen. Kopieren Sie Ihre personalisierte emos2.js Datei in das Verzeichnis /js/tracker/."
|
app/locale/en_US/Mage_Econda.csv
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
"Used Language","Used Language"
|
2 |
"Settings","Settings"
|
3 |
-
"Select only the language, which at the time of initial activation of your econda product has been selected.","Select only the language, which at the time of initial activation of your econda product has been selected."
|
|
1 |
"Used Language","Used Language"
|
2 |
"Settings","Settings"
|
3 |
+
"Select only the language, which at the time of initial activation of your econda product has been selected.","Select only the language, which at the time of initial activation of your econda product has been selected."
|
4 |
+
"Only newer versions of the emos2.js file (received after September 2009) can handle Version 2. Copy your personal emos2.js file into the direcotory /js/tracker/.","Only newer versions of the emos2.js file (received after September 2009) can handle Version 2. Copy your personal emos2.js file into the direcotory /js/tracker/."
|
js/tracker/emosop.js
CHANGED
@@ -25,6 +25,9 @@ function onePageTracker() {
|
|
25 |
if(stristr(document.getElementById('opc-billing').className,'active') != false && (sendOne == 1 || sendOne == 2)) {
|
26 |
orderProcess = '3_' + ecStep[1];
|
27 |
contentLabel = ecStep[6];
|
|
|
|
|
|
|
28 |
if(sendOne == 1) {
|
29 |
sendOne += 1;
|
30 |
}
|
@@ -59,10 +62,9 @@ function onePageTracker() {
|
|
59 |
}
|
60 |
|
61 |
if (orderProcess != '') {
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
window.emosPropertiesEvent(properties);
|
66 |
}
|
67 |
}
|
68 |
|
@@ -79,7 +81,4 @@ function stristr(haystack,needle,bool) {
|
|
79 |
return haystack.slice(pos);
|
80 |
}
|
81 |
}
|
82 |
-
}
|
83 |
-
|
84 |
-
|
85 |
-
|
25 |
if(stristr(document.getElementById('opc-billing').className,'active') != false && (sendOne == 1 || sendOne == 2)) {
|
26 |
orderProcess = '3_' + ecStep[1];
|
27 |
contentLabel = ecStep[6];
|
28 |
+
if(typeof(emospro.login) != 'undefined') {
|
29 |
+
delete emospro.login;
|
30 |
+
}
|
31 |
if(sendOne == 1) {
|
32 |
sendOne += 1;
|
33 |
}
|
62 |
}
|
63 |
|
64 |
if (orderProcess != '') {
|
65 |
+
emospro.orderProcess=orderProcess;
|
66 |
+
emospro.content='Start/' + ecStep[7] + '/' + contentLabel;
|
67 |
+
window.emosPropertiesEvent(emospro);
|
|
|
68 |
}
|
69 |
}
|
70 |
|
81 |
return haystack.slice(pos);
|
82 |
}
|
83 |
}
|
84 |
+
}
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mage_Econda</name>
|
4 |
-
<version>1.0
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/bsd-license.php">BSD</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Bindet econda Web Controlling in Magento ein. Weitere Informationen unter http://www.econda.de. Inserts econda Web Contolling into Magento. For further information visit http://www.econda.de/</description>
|
11 |
<notes>Release for econda Web Controlling functions.</notes>
|
12 |
<authors><author><name>ecdev</name><user>auto-converted</user><email>bebop30@gmx.net</email></author></authors>
|
13 |
-
<date>2009-11-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="econda.xml" hash="cbb5b0bc56602498ea5fc0af88a847ab"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="econda.xml" hash="7997011c0987fd24178f27f2c9a89fc4"/></dir><dir name="template"><dir name="econda"><file name="tracker.phtml" hash="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mage_Econda</name>
|
4 |
+
<version>1.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/bsd-license.php">BSD</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Bindet econda Web Controlling in Magento ein. Weitere Informationen unter http://www.econda.de. Inserts econda Web Contolling into Magento. For further information visit http://www.econda.de/</description>
|
11 |
<notes>Release for econda Web Controlling functions.</notes>
|
12 |
<authors><author><name>ecdev</name><user>auto-converted</user><email>bebop30@gmx.net</email></author></authors>
|
13 |
+
<date>2009-11-17</date>
|
14 |
+
<time>14:14:27</time>
|
15 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="econda.xml" hash="cbb5b0bc56602498ea5fc0af88a847ab"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="econda.xml" hash="7997011c0987fd24178f27f2c9a89fc4"/></dir><dir name="template"><dir name="econda"><file name="tracker.phtml" hash="5515312a89fa5529c22b76bfe0396fa8"/><file name="trackerop.phtml" hash="25ae04fa6590dabcf5f8b96792c31915"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_AT"><file name="Mage_Econda.csv" hash="5d2f04acb1e1c8b87672194e4c6f3d8e"/></dir><dir name="de_CH"><file name="Mage_Econda.csv" hash="5d2f04acb1e1c8b87672194e4c6f3d8e"/></dir><dir name="de_DE"><file name="Mage_Econda.csv" hash="5d2f04acb1e1c8b87672194e4c6f3d8e"/></dir><dir name="en_US"><file name="Mage_Econda.csv" hash="0b2e990b5a76701a0c89817e0c69968f"/></dir></target><target name="mageweb"><dir name="js"><dir name="tracker"><file name="emosop.js" hash="ffedf0cf5e271d4e984ac6135cbfe2b8"/></dir></dir></target><target name="magelocal"><dir name="Mage"><dir name="Econda"><dir name="Block"><file name="Econda.php" hash="f6feab4459c8772b6e06d0ee962e6ad8"/><file name="emos.php" hash="ce0028bd1b9230ab7e10df24e957a07a"/><dir name="Adminhtml"><file name="Econda.php" hash="dfe2f3270e832a0f9952e262a26a12ee"/><file name="Tracker.php" hash="9a8820c2f5d1b105dfeb023926e0d368"/><dir name="Econda"><file name="Edit.php" hash="43a19bcffd20b3e4c4b497503f7adf2a"/><file name="Grid.php" hash="d92771738a4e196a9ebb255e94e5c8eb"/><dir name="Edit"><file name="Form.php" hash="8e765540fc4aaaf487cbc976b74147bc"/><file name="Tabs.php" hash="86e7ac45dfaa6ac89e30c709f5311538"/><dir name="Tab"><file name="Form.php" hash="eb9530cada5105bf190b927b970744b7"/></dir></dir></dir><dir name="Tracker"><file name="Edit.php" hash="c0496415a5f1d0021b1d2d2313ed0eff"/><file name="Grid.php" hash="3318d472ac71cce739696b287cb81557"/><dir name="Edit"><file name="Form.php" hash="f292fa68f4782eadcac34d757fdce073"/><file name="Tabs.php" hash="c02f68b55b22d77158b841c89af5b230"/><dir name="Tab"><file name="Form.php" hash="3f463742e5f9c61e88c929c70502bf22"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="253cbb1316220834b9c6222792e59fc4"/><dir name="Adminhtml"><file name="EcondaController.php" hash="8dad3d7cb5ec59fadc5bb1ba5aafae14"/><file name="TrackerController.php" hash="12fdf5c3b1c9ca04cc899faf3272a3e0"/></dir></dir><dir name="etc"><file name="config.xml" hash="e15bba8aa9d28f447f925182d74f7360"/><file name="system.xml" hash="785b847c8cb86e0aefa6f3af87789cab"/></dir><dir name="Helper"><file name="Data.php" hash="a2e8e8cc0b42886d8e7fdf6239ac5180"/></dir><dir name="Language"><file name="english.php" hash="d0fa9b08a9cfb9e7c5e8003a5839a22f"/><file name="german.php" hash="d181289a8024e2b4d9f69150fad54ddc"/></dir><dir name="Model"><file name="Econda.php" hash="2129423b43edaa5ad86ca1ce2925f4d5"/><file name="Status.php" hash="8c73ee6feba08a3a9c9cf73105751cbd"/><dir name="Mysql4"><file name="Econda.php" hash="9e3244467bdb6bef7519e90c7b8b9dd8"/><file name="Tracker.php" hash="d0493cdc60d3b3fd7d3e548480641823"/><dir name="Econda"><file name="Collection.php" hash="78207d4301d2d3b6a63121f8b57ae989"/></dir><dir name="Tracker"><file name="Collection.php" hash="411183409afca6ec33aff08fa4884d0f"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Language.php" hash="47d570575b7251fb0f022add31210de1"/><file name="Tracking.php" hash="0040d7a07d501751b8d589d25d98c99d"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Econda.xml" hash="4857a6367896368610cda11f31de2822"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|