Version Notes
Release for econda Web Controlling functions.
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Mage_Econda |
| Version | 1.1.3 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.0 to 1.1.3
- app/code/local/Mage/Econda/Block/Econda.php +119 -26
- app/code/local/Mage/Econda/Block/emos_org.php +792 -0
- app/code/local/Mage/Econda/Model/System/Config/Source/Billing.php +13 -0
- app/code/local/Mage/Econda/etc/config.xml +1 -1
- app/code/local/Mage/Econda/etc/system.xml +11 -1
- app/design/frontend/default/default/template/econda/trackerop.phtml +3 -4
- app/locale/de_AT/Mage_Econda.csv +7 -2
- app/locale/de_CH/Mage_Econda.csv +7 -2
- app/locale/de_DE/Mage_Econda.csv +7 -2
- app/locale/en_US/Mage_Econda.csv +7 -2
- package.xml +4 -4
app/code/local/Mage/Econda/Block/Econda.php
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
/*
|
| 4 |
-
Copyright (c) 2004 -
|
| 5 |
All rights reserved.
|
| 6 |
|
| 7 |
ECONDA GmbH
|
|
@@ -42,7 +42,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
| 42 |
* ECONDA Tracking into Magento Shop-Systems.
|
| 43 |
*/
|
| 44 |
|
| 45 |
-
require_once("app/Mage.php");
|
|
|
|
| 46 |
Mage::app ();
|
| 47 |
|
| 48 |
class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
@@ -60,7 +61,7 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
| 60 |
/*
|
| 61 |
* config get language
|
| 62 |
*/
|
| 63 |
-
$storeId =
|
| 64 |
$langValue = 'econda/econda/tracking_language';
|
| 65 |
$langPath = Mage::getStoreConfig($langValue, $storeId);
|
| 66 |
|
|
@@ -100,7 +101,7 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
| 100 |
/*
|
| 101 |
* start of emos string
|
| 102 |
*/
|
| 103 |
-
$emosString = "\n\n<!-- Start Econda-Monitor
|
| 104 |
|
| 105 |
$emos = new EMOS($pathToFile);
|
| 106 |
|
|
@@ -117,7 +118,6 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
| 117 |
/*
|
| 118 |
* emos addContent
|
| 119 |
*/
|
| 120 |
-
$storeId = Mage::app()->getStore()->getStoreId();
|
| 121 |
$storeCode = Mage::app()->getStore()->getCode();
|
| 122 |
$storeNameLoad = Mage::getModel('core/store_group')->load($storeId);
|
| 123 |
$storeName = $storeNameLoad->getName();
|
|
@@ -301,6 +301,9 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
| 301 |
*/
|
| 302 |
$emos->addPageID(md5($contentPath)); //same as $contentPath
|
| 303 |
|
|
|
|
|
|
|
|
|
|
| 304 |
$siteName = $_SERVER['SERVER_NAME'];
|
| 305 |
$emos->addSiteID($siteName);
|
| 306 |
|
|
@@ -346,6 +349,7 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
| 346 |
}
|
| 347 |
|
| 348 |
$isAddBasket = false;
|
|
|
|
| 349 |
|
| 350 |
//bugfix for basket after customer re-login
|
| 351 |
if(Mage::getSingleton('customer/session')->isLoggedIn() == 1) {
|
|
@@ -396,7 +400,23 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
| 396 |
$eItem = new EMOS_Item();
|
| 397 |
$eItem->productName = trim($item->getName());
|
| 398 |
$eItem->productID = $item->getproductId();
|
| 399 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 400 |
$eItem->quantity = $item->getQty();
|
| 401 |
$eItem->productGroup = $prodGroup.'/'.trim($item->getName());
|
| 402 |
if($eItem->price != '0.00') {
|
|
@@ -433,7 +453,23 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
| 433 |
$eItem = new EMOS_Item();
|
| 434 |
$eItem->productName = trim($item->getName());
|
| 435 |
$eItem->productID = $item->getproductId();
|
| 436 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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') {
|
|
@@ -469,7 +505,23 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
| 469 |
$eItem = new EMOS_Item();
|
| 470 |
$eItem->productName = trim($item->getName());
|
| 471 |
$eItem->productID = $item->getId();
|
| 472 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 473 |
$eItem->quantity = '1';
|
| 474 |
$eItem->productGroup = $prodGroup.'/'.trim($item->getName());
|
| 475 |
$emos->addDetailView($eItem);
|
|
@@ -560,14 +612,23 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
| 560 |
$lastOrderId = $row['reserved_order_id'];
|
| 561 |
}
|
| 562 |
$tableSfqa = $tablePrefix.'sales_flat_quote_address';
|
| 563 |
-
$result = $db->query("SELECT customer_id,city,postcode,country_id,grand_total FROM $tableSfqa WHERE quote_id = $entityId and address_type = 'shipping'");
|
| 564 |
$row = $result->fetch(PDO::FETCH_ASSOC);
|
| 565 |
$custCountry = $row['country_id'];
|
| 566 |
$custPostCode = $row['postcode'];
|
| 567 |
$custCity = $row['city'];
|
| 568 |
$custId = $row['customer_id'];
|
| 569 |
$ordId = $lastOrderId;
|
| 570 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 571 |
$custAdress = $custCountry.'/'.substr($custPostCode,0,1).'/'.substr($custPostCode,0,2).'/'.$custCity.'/'.$custPostCode;
|
| 572 |
$emos->addEmosBillingPageArray($ordId,$custId,$priceTotal,$custCountry,$custPostCode,$custCity);
|
| 573 |
|
|
@@ -584,11 +645,44 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
| 584 |
$getGroup = $this->getProductCategory($row['product_id']);
|
| 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 |
-
|
| 591 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 592 |
$eItem->productGroup = $prodGroup.'/'.trim($row['name']);
|
| 593 |
$basket[$bCounter] = $eItem;
|
| 594 |
$bCounter += 1;
|
|
@@ -613,8 +707,10 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
| 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'];
|
|
@@ -628,27 +724,24 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
| 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 |
-
|
|
|
|
| 632 |
$catLevel = intval($row['level']);
|
| 633 |
-
$
|
| 634 |
-
$catPath = explode('/',$row['path']);
|
| 635 |
}
|
| 636 |
}
|
| 637 |
-
|
| 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=
|
| 644 |
$catId = intval($catPath[$i]);
|
| 645 |
-
|
| 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 |
}
|
|
@@ -690,4 +783,4 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
|
| 690 |
return '0';
|
| 691 |
}
|
| 692 |
}
|
| 693 |
-
?>
|
| 1 |
<?php
|
| 2 |
|
| 3 |
/*
|
| 4 |
+
Copyright (c) 2004 - 2010 ECONDA GmbH Karlsruhe
|
| 5 |
All rights reserved.
|
| 6 |
|
| 7 |
ECONDA GmbH
|
| 42 |
* ECONDA Tracking into Magento Shop-Systems.
|
| 43 |
*/
|
| 44 |
|
| 45 |
+
//require_once("app/Mage.php");
|
| 46 |
+
require_once Mage::getBaseDir().DS.'/app/Mage.php';
|
| 47 |
Mage::app ();
|
| 48 |
|
| 49 |
class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
|
| 61 |
/*
|
| 62 |
* config get language
|
| 63 |
*/
|
| 64 |
+
$storeId = Mage::app()->getStore()->getId();
|
| 65 |
$langValue = 'econda/econda/tracking_language';
|
| 66 |
$langPath = Mage::getStoreConfig($langValue, $storeId);
|
| 67 |
|
| 101 |
/*
|
| 102 |
* start of emos string
|
| 103 |
*/
|
| 104 |
+
$emosString = "\n\n<!-- Start Econda-Monitor M113 -->\n\n";
|
| 105 |
|
| 106 |
$emos = new EMOS($pathToFile);
|
| 107 |
|
| 118 |
/*
|
| 119 |
* emos addContent
|
| 120 |
*/
|
|
|
|
| 121 |
$storeCode = Mage::app()->getStore()->getCode();
|
| 122 |
$storeNameLoad = Mage::getModel('core/store_group')->load($storeId);
|
| 123 |
$storeName = $storeNameLoad->getName();
|
| 301 |
*/
|
| 302 |
$emos->addPageID(md5($contentPath)); //same as $contentPath
|
| 303 |
|
| 304 |
+
/*
|
| 305 |
+
* emos addSiteID
|
| 306 |
+
*/
|
| 307 |
$siteName = $_SERVER['SERVER_NAME'];
|
| 308 |
$emos->addSiteID($siteName);
|
| 309 |
|
| 349 |
}
|
| 350 |
|
| 351 |
$isAddBasket = false;
|
| 352 |
+
$billingOption = 'econda/econda/billing_total';
|
| 353 |
|
| 354 |
//bugfix for basket after customer re-login
|
| 355 |
if(Mage::getSingleton('customer/session')->isLoggedIn() == 1) {
|
| 400 |
$eItem = new EMOS_Item();
|
| 401 |
$eItem->productName = trim($item->getName());
|
| 402 |
$eItem->productID = $item->getproductId();
|
| 403 |
+
if(Mage::getStoreConfig($billingOption, $storeId) == '1') {
|
| 404 |
+
if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, true) != 0) {
|
| 405 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, true);
|
| 406 |
+
}
|
| 407 |
+
else {
|
| 408 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true, null, null, $item->getTaxClassId(), $storeId, true);
|
| 409 |
+
}
|
| 410 |
+
}
|
| 411 |
+
else {
|
| 412 |
+
if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, false) != 0) {
|
| 413 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, false);
|
| 414 |
+
}
|
| 415 |
+
else {
|
| 416 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true, null, null, $item->getTaxClassId(), $storeId, false);
|
| 417 |
+
}
|
| 418 |
+
}
|
| 419 |
+
$eItem->price = $this->convertPrice($priceTax);
|
| 420 |
$eItem->quantity = $item->getQty();
|
| 421 |
$eItem->productGroup = $prodGroup.'/'.trim($item->getName());
|
| 422 |
if($eItem->price != '0.00') {
|
| 453 |
$eItem = new EMOS_Item();
|
| 454 |
$eItem->productName = trim($item->getName());
|
| 455 |
$eItem->productID = $item->getproductId();
|
| 456 |
+
if(Mage::getStoreConfig($billingOption, $storeId) == '1') {
|
| 457 |
+
if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, true) != 0) {
|
| 458 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, true); // with tax
|
| 459 |
+
}
|
| 460 |
+
else {
|
| 461 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true, null, null, $item->getTaxClassId(), $storeId, true); // with tax
|
| 462 |
+
}
|
| 463 |
+
}
|
| 464 |
+
else {
|
| 465 |
+
if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, false) != 0) {
|
| 466 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), true, null, null, $item->getTaxClassId(), $storeId, false); // with tax
|
| 467 |
+
}
|
| 468 |
+
else {
|
| 469 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true, null, null, $item->getTaxClassId(), $storeId, false); // with tax
|
| 470 |
+
}
|
| 471 |
+
}
|
| 472 |
+
$eItem->price = $this->convertPrice($priceTax);
|
| 473 |
$eItem->quantity = $basketQty;
|
| 474 |
$eItem->productGroup = $prodGroup.'/'.trim($item->getName());
|
| 475 |
if($emosAction == 'addBasket' && stristr($this->getMessagesBlock()->getGroupedHtml(),'error-msg') == false && $eItem->price != '0.00') {
|
| 505 |
$eItem = new EMOS_Item();
|
| 506 |
$eItem->productName = trim($item->getName());
|
| 507 |
$eItem->productID = $item->getId();
|
| 508 |
+
if(Mage::getStoreConfig($billingOption, $storeId) == '1') {
|
| 509 |
+
if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false, null, null, $item->getTaxClassId(), $storeId, true) != 0) {
|
| 510 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false, null, null, $item->getTaxClassId(), $storeId, true); // with tax
|
| 511 |
+
}
|
| 512 |
+
else {
|
| 513 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), false, null, null, $item->getTaxClassId(), $storeId, true); // with tax
|
| 514 |
+
}
|
| 515 |
+
}
|
| 516 |
+
else {
|
| 517 |
+
if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false, null, null, $item->getTaxClassId(), $storeId, false) != 0) {
|
| 518 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false, null, null, $item->getTaxClassId(), $storeId, false); // with tax
|
| 519 |
+
}
|
| 520 |
+
else {
|
| 521 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), false, null, null, $item->getTaxClassId(), $storeId, false); // with tax
|
| 522 |
+
}
|
| 523 |
+
}
|
| 524 |
+
$eItem->price = $this->convertPrice($priceTax);
|
| 525 |
$eItem->quantity = '1';
|
| 526 |
$eItem->productGroup = $prodGroup.'/'.trim($item->getName());
|
| 527 |
$emos->addDetailView($eItem);
|
| 612 |
$lastOrderId = $row['reserved_order_id'];
|
| 613 |
}
|
| 614 |
$tableSfqa = $tablePrefix.'sales_flat_quote_address';
|
| 615 |
+
$result = $db->query("SELECT customer_id,city,postcode,country_id,grand_total,subtotal,tax_amount,shipping_tax_amount FROM $tableSfqa WHERE quote_id = $entityId and address_type = 'shipping'");
|
| 616 |
$row = $result->fetch(PDO::FETCH_ASSOC);
|
| 617 |
$custCountry = $row['country_id'];
|
| 618 |
$custPostCode = $row['postcode'];
|
| 619 |
$custCity = $row['city'];
|
| 620 |
$custId = $row['customer_id'];
|
| 621 |
$ordId = $lastOrderId;
|
| 622 |
+
if(Mage::getStoreConfig($billingOption, $storeId) == '1') {
|
| 623 |
+
$priceTotal = $row['subtotal'];
|
| 624 |
+
}
|
| 625 |
+
else if(Mage::getStoreConfig($billingOption, $storeId) == '2') {
|
| 626 |
+
$priceTotal = $row['subtotal'] + $row['tax_amount'] - $row['shipping_tax_amount'];
|
| 627 |
+
}
|
| 628 |
+
else {
|
| 629 |
+
$priceTotal = $row['grand_total'];
|
| 630 |
+
}
|
| 631 |
+
$priceTotal = $this->convertPrice($priceTotal);
|
| 632 |
$custAdress = $custCountry.'/'.substr($custPostCode,0,1).'/'.substr($custPostCode,0,2).'/'.$custCity.'/'.$custPostCode;
|
| 633 |
$emos->addEmosBillingPageArray($ordId,$custId,$priceTotal,$custCountry,$custPostCode,$custCity);
|
| 634 |
|
| 645 |
$getGroup = $this->getProductCategory($row['product_id']);
|
| 646 |
if($getGroup) $prodGroup = $getGroup;
|
| 647 |
else $prodGroup = $eLang[39];
|
| 648 |
+
$item = Mage::getModel('catalog/product')->load($row['product_id']);
|
| 649 |
$eItem = new EMOS_Item();
|
| 650 |
$eItem->productName = trim($row['name']);
|
| 651 |
$eItem->productID = $row['product_id'];
|
| 652 |
+
$eItem->quantity = number_format($row['qty'],0);
|
| 653 |
+
$discount = $row['product_id'];
|
| 654 |
+
$tablePrpr = $tablePrefix.'catalog_product_entity_tier_price';
|
| 655 |
+
$resultp = $db->query("SELECT qty,value FROM $tablePrpr WHERE entity_id = $discount");
|
| 656 |
+
$rowp = $resultp->fetch(PDO::FETCH_ASSOC);
|
| 657 |
+
$discountcheck = 0;
|
| 658 |
+
if($rowp) {
|
| 659 |
+
if($eItem->quantity >= $rowp['qty']) {
|
| 660 |
+
$discountcheck = $rowp['value'];
|
| 661 |
+
}
|
| 662 |
+
}
|
| 663 |
+
if(Mage::getStoreConfig($billingOption, $storeId) == '1') {
|
| 664 |
+
if($discountcheck > 0) {
|
| 665 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $discountcheck, false, null, null, $item->getTaxClassId(), $storeId, true);
|
| 666 |
+
}
|
| 667 |
+
else if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false, null, null, $item->getTaxClassId(), $storeId, true) != 0) {
|
| 668 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false, null, null, $item->getTaxClassId(), $storeId, true);
|
| 669 |
+
}
|
| 670 |
+
else {
|
| 671 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), false, null, null, $item->getTaxClassId(), $storeId, true);
|
| 672 |
+
}
|
| 673 |
+
}
|
| 674 |
+
else {
|
| 675 |
+
if($discountcheck > 0) {
|
| 676 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $discountcheck, false, null, null, $item->getTaxClassId(), $storeId, false);
|
| 677 |
+
}
|
| 678 |
+
else if(Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false, null, null, $item->getTaxClassId(), $storeId, false) != 0) {
|
| 679 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getFinalPrice(), false, null, null, $item->getTaxClassId(), $storeId, false);
|
| 680 |
+
}
|
| 681 |
+
else {
|
| 682 |
+
$priceTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), false, null, null, $item->getTaxClassId(), $storeId, false);
|
| 683 |
+
}
|
| 684 |
+
}
|
| 685 |
+
$eItem->price = $this->convertPrice($priceTax);
|
| 686 |
$eItem->productGroup = $prodGroup.'/'.trim($row['name']);
|
| 687 |
$basket[$bCounter] = $eItem;
|
| 688 |
$bCounter += 1;
|
| 707 |
$tableCcp = $tablePrefix.'catalog_category_product';
|
| 708 |
$result = $db->query("SELECT category_id FROM $tableCcp WHERE product_id = $productId");
|
| 709 |
$getCatId = array();
|
| 710 |
+
$catPath = array();
|
| 711 |
$count = 0;
|
| 712 |
$isCategory = false;
|
| 713 |
+
$rootCat = Mage::app()->getStore()->getRootCategoryId();
|
| 714 |
|
| 715 |
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
| 716 |
$getCatId[$count] = $row['category_id'];
|
| 724 |
$tableCce = $tablePrefix.'catalog_category_entity';
|
| 725 |
$result = $db->query("SELECT level,path FROM $tableCce WHERE entity_id = $getCat");
|
| 726 |
$row = $result->fetch(PDO::FETCH_ASSOC);
|
| 727 |
+
$catPathPa = explode('/',$row['path']);
|
| 728 |
+
if($catLevel < intval($row['level']) && intval($catPathPa[1]) == $rootCat) {
|
| 729 |
$catLevel = intval($row['level']);
|
| 730 |
+
$catPath = $catPathPa;
|
|
|
|
| 731 |
}
|
| 732 |
}
|
| 733 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 734 |
$category = "";
|
| 735 |
+
for($i=0;$i<sizeof($catPath);$i++) {
|
| 736 |
$catId = intval($catPath[$i]);
|
| 737 |
+
$category .= Mage::getModel('catalog/category')->load($catId)->getName()."/";
|
|
|
|
|
|
|
| 738 |
}
|
| 739 |
$category = substr($category,0,-1);
|
| 740 |
+
if(substr($category, 0, 1) == '/') {
|
| 741 |
+
$category = substr($category, 1);
|
| 742 |
+
}
|
| 743 |
return $category;
|
| 744 |
+
}
|
| 745 |
else {
|
| 746 |
return false;
|
| 747 |
}
|
| 783 |
return '0';
|
| 784 |
}
|
| 785 |
}
|
| 786 |
+
?>
|
app/code/local/Mage/Econda/Block/emos_org.php
ADDED
|
@@ -0,0 +1,792 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 18 |
+
Redistribution and use in source and binary forms, with or without modification,
|
| 19 |
+
are permitted provided that the following conditions are met:
|
| 20 |
+
|
| 21 |
+
* Redistributions of source code must retain the above copyright notice,
|
| 22 |
+
this list of conditions and the following disclaimer.
|
| 23 |
+
* Redistributions in binary form must reproduce the above copyright notice,
|
| 24 |
+
this list of conditions and the following disclaimer in the documentation
|
| 25 |
+
and/or other materials provided with the distribution.
|
| 26 |
+
* Neither the name of the ECONDA GmbH nor the names of its contributors may
|
| 27 |
+
be used to endorse or promote products derived from this software without
|
| 28 |
+
specific prior written permission.
|
| 29 |
+
|
| 30 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
| 31 |
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
| 32 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
| 33 |
+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
| 34 |
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
| 35 |
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 36 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
| 37 |
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 38 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| 39 |
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 40 |
+
|
| 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
|
| 62 |
+
|
| 63 |
+
Revision 1.12 2007/05/16 08:24:09 unaegele
|
| 64 |
+
fix wrong reference to htmlspecialchars_decodephp4()
|
| 65 |
+
|
| 66 |
+
Revision 1.11 2007/05/11 07:52:42 unaegele
|
| 67 |
+
Update ECONDA Tel Number, prepare Release 20070510
|
| 68 |
+
|
| 69 |
+
Revision 1.10 2007/05/11 07:45:53 unaegele
|
| 70 |
+
added \n to addSid
|
| 71 |
+
|
| 72 |
+
Revision 1.9 2007/05/10 12:19:04 unaegele
|
| 73 |
+
Fix php 4 compatibility for the call to htmlspecialchars_decode()
|
| 74 |
+
Replace traslated =chr(0xa0) with real spaces
|
| 75 |
+
|
| 76 |
+
Revision 1.8 2007/05/04 10:17:31 unaegele
|
| 77 |
+
several bugfixes
|
| 78 |
+
|
| 79 |
+
Revision 1.7 2007/05/04 09:59:01 unaegele
|
| 80 |
+
source code formating
|
| 81 |
+
|
| 82 |
+
Revision 1.6 2007/05/04 09:55:12 unaegele
|
| 83 |
+
*** empty log message ***
|
| 84 |
+
|
| 85 |
+
Revision 1.5 2007/05/04 09:49:08 unaegele
|
| 86 |
+
*** empty log message ***
|
| 87 |
+
|
| 88 |
+
Revision 1.4 2007/05/04 09:43:48 unaegele
|
| 89 |
+
Added methods addSiteID($siteid), addLangID($langid), addPageID($pageID), addCountryID($countryid)
|
| 90 |
+
|
| 91 |
+
Revision 1.2 added URL Encoding, Dataformat
|
| 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);
|
| 192 |
+
$item->productName = $this->emos_DataFormat($item->productName);
|
| 193 |
+
$item->productGroup = $this->emos_DataFormat($item->productGroup);
|
| 194 |
+
$item->variant1 = $this->emos_DataFormat($item->variant1);
|
| 195 |
+
$item->variant2 = $this->emos_DataFormat($item->variant2);
|
| 196 |
+
$item->variant3 = $this->emos_DataFormat($item->variant3);
|
| 197 |
+
return $item;
|
| 198 |
+
}
|
| 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;
|
| 252 |
+
$this->appendPreScript("<a name=\"emos_sid\" title=\"$sid\"></a>\n");
|
| 253 |
+
}
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
/* set the 1st party visitor id */
|
| 257 |
+
function setVid($vid = "") {
|
| 258 |
+
if ($vid) {
|
| 259 |
+
$this->emvid = $vid;
|
| 260 |
+
$this->appendPreScript("<a name=\"emos_vid\" title=\"$vid\"></a>");
|
| 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/";
|
| 576 |
+
}
|
| 577 |
+
if ($cip) {
|
| 578 |
+
$ort .= substr($cip, 0, 1) . "/" . substr($cip, 0, 2) . "/";
|
| 579 |
+
}
|
| 580 |
+
if ($city) {
|
| 581 |
+
$ort .= "$city/";
|
| 582 |
+
}
|
| 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)
|
| 682 |
+
* @param $cVar3 third variable of this custom event (optional)
|
| 683 |
+
* @param $cVar4 fourth variable of this custom event (optional)
|
| 684 |
+
* @param $cVar5 fifth variable of this custom event (optional)
|
| 685 |
+
* @param $cVar6 sixth variable of this custom event (optional)
|
| 686 |
+
* @param $cVar7 seventh variable of this custom event (optional)
|
| 687 |
+
* @param $cVar8 eighth variable of this custom event (optional)
|
| 688 |
+
* @param $cVar9 nineth variable of this custom event (optional)
|
| 689 |
+
* @param $cVar10 tenth variable of this custom event (optional)
|
| 690 |
+
* @param $cVar11 eleventh 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;
|
| 698 |
+
if($cVar3) $values[3] = $cVar3;
|
| 699 |
+
if($cVar4) $values[4] = $cVar4;
|
| 700 |
+
if($cVar5) $values[5] = $cVar5;
|
| 701 |
+
if($cVar6) $values[6] = $cVar6;
|
| 702 |
+
if($cVar7) $values[7] = $cVar7;
|
| 703 |
+
if($cVar8) $values[8] = $cVar8;
|
| 704 |
+
if($cVar9) $values[9] = $cVar9;
|
| 705 |
+
if($cVar10) $values[10] = $cVar10;
|
| 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 = "";
|
| 718 |
+
$out .= "emos_ecEvent('$event'," .
|
| 719 |
+
"'$item->productID'," .
|
| 720 |
+
"'$item->productName'," .
|
| 721 |
+
"'$item->price'," .
|
| 722 |
+
"'$item->productGroup'," .
|
| 723 |
+
"'$item->quantity'," .
|
| 724 |
+
"'$item->variant1'" .
|
| 725 |
+
"'$item->variant2'" .
|
| 726 |
+
"'$item->variant3');";
|
| 727 |
+
return $out;
|
| 728 |
+
}
|
| 729 |
+
|
| 730 |
+
function getEmosViewEvent($item) {
|
| 731 |
+
return getEmosECEvent($item, "view");
|
| 732 |
+
}
|
| 733 |
+
|
| 734 |
+
function getEmosAddToBasketEvent($item) {
|
| 735 |
+
return getEmosECEvent($item, "c_add");
|
| 736 |
+
}
|
| 737 |
+
|
| 738 |
+
function getRemoveFromBasketEvent($item) {
|
| 739 |
+
return getEmosECEvent($item, "c_rmv");
|
| 740 |
+
}
|
| 741 |
+
|
| 742 |
+
function getEmosBillingEventArray($billingID = "", $customerNumber = "", $total = 0, $country = "", $cip = "", $city = "") {
|
| 743 |
+
$b = new EMOS();
|
| 744 |
+
return $b->getEmosBillingArray($billingID, $customerNumber, $total, $country, $cip, $city, "emosBillingArray");
|
| 745 |
+
}
|
| 746 |
+
|
| 747 |
+
function getEMOSBasketEventArray($basket) {
|
| 748 |
+
$b = new EMOS();
|
| 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.
|
| 756 |
+
*
|
| 757 |
+
* Purpose of this class:
|
| 758 |
+
* This class provides a common subset of features for most shopping systems
|
| 759 |
+
* products or basket/cart items. So all you have to do is to convert your
|
| 760 |
+
* products/articles/basket items/cart items to a EMOS_Items. And finally use
|
| 761 |
+
* the functionaltiy of the EMOS class.
|
| 762 |
+
* So for each shopping system we only have to do the conversion of the cart/basket
|
| 763 |
+
* and items and we can (hopefully) keep the rest of code.
|
| 764 |
+
*
|
| 765 |
+
* Shopping carts:
|
| 766 |
+
* A shopping cart / basket is a simple Array[] of EMOS items.
|
| 767 |
+
* Convert your cart to a Array of EMOS_Items and your job is nearly done.
|
| 768 |
+
*/
|
| 769 |
+
class EMOS_Item {
|
| 770 |
+
/** unique Identifier of a product e.g. article number */
|
| 771 |
+
var $productID = "NULL";
|
| 772 |
+
/** the name of a product */
|
| 773 |
+
var $productName = "NULL";
|
| 774 |
+
/** the price of the product, it is your choice wether its gross or net */
|
| 775 |
+
var $price = "NULL";
|
| 776 |
+
/** the product group for this product, this is a drill down dimension
|
| 777 |
+
* or tree-like structure
|
| 778 |
+
* so you might want to use it like this:
|
| 779 |
+
* productgroup/subgroup/subgroup/product
|
| 780 |
+
*/
|
| 781 |
+
var $productGroup = "NULL";
|
| 782 |
+
/* the quantity / number of products viewed/bought etc.. */
|
| 783 |
+
var $quantity = "NULL";
|
| 784 |
+
/** variant of the product e.g. size, color, brand ....
|
| 785 |
+
* remember to keep the order of theses variants allways the same
|
| 786 |
+
* decide which variant is which feature and stick to it
|
| 787 |
+
*/
|
| 788 |
+
var $variant1 = "NULL";
|
| 789 |
+
var $variant2 = "NULL";
|
| 790 |
+
var $variant3 = "NULL";
|
| 791 |
+
}
|
| 792 |
+
?>
|
app/code/local/Mage/Econda/Model/System/Config/Source/Billing.php
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Mage_Econda_Model_System_Config_Source_Billing
|
| 4 |
+
{
|
| 5 |
+
public function toOptionArray()
|
| 6 |
+
{
|
| 7 |
+
return array(
|
| 8 |
+
array('value'=>'0', 'label'=>Mage::helper('econda')->__('Total Price (Grand Total)')),
|
| 9 |
+
array('value'=>'1', 'label'=>Mage::helper('econda')->__('Value of Goods without Tax (Subtotal)')),
|
| 10 |
+
array('value'=>'2', 'label'=>Mage::helper('econda')->__('Value of Goods with Tax (Subtotal + Tax)'))
|
| 11 |
+
);
|
| 12 |
+
}
|
| 13 |
+
}
|
app/code/local/Mage/Econda/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Mage_Econda>
|
| 5 |
-
<version>1.1.
|
| 6 |
</Mage_Econda>
|
| 7 |
</modules>
|
| 8 |
<frontend>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Mage_Econda>
|
| 5 |
+
<version>1.1.3</version>
|
| 6 |
</Mage_Econda>
|
| 7 |
</modules>
|
| 8 |
<frontend>
|
app/code/local/Mage/Econda/etc/system.xml
CHANGED
|
@@ -62,7 +62,17 @@
|
|
| 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>
|
| 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 |
+
<billing_total>
|
| 67 |
+
<label>Billing and Prices</label>
|
| 68 |
+
<comment>Get Billing and Prices with or without Tax and Shipping</comment>
|
| 69 |
+
<frontend_type>select</frontend_type>
|
| 70 |
+
<source_model>econda/system_config_source_billing</source_model>
|
| 71 |
+
<sort_order>3</sort_order>
|
| 72 |
+
<show_in_default>1</show_in_default>
|
| 73 |
+
<show_in_website>1</show_in_website>
|
| 74 |
+
<show_in_store>0</show_in_store>
|
| 75 |
+
</billing_total>
|
| 76 |
</fields>
|
| 77 |
</econda>
|
| 78 |
</groups>
|
app/design/frontend/default/default/template/econda/trackerop.phtml
CHANGED
|
@@ -52,7 +52,7 @@ if(stristr($realUrlOp,'checkout/onepage/') != false) {
|
|
| 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>";
|
|
@@ -67,7 +67,7 @@ if(stristr($realUrlOp,'checkout/onepage/') != false) {
|
|
| 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";
|
|
@@ -129,5 +129,4 @@ function dataFormat($str,$emVersion) {
|
|
| 129 |
}
|
| 130 |
return $str;
|
| 131 |
}
|
| 132 |
-
?>
|
| 133 |
-
|
| 52 |
}
|
| 53 |
|
| 54 |
if($emVersion == '2') {
|
| 55 |
+
$emosOut = "\n<!-- Start Econda-Monitor M111 -->\n";
|
| 56 |
$emosOut .= "\n<script type=\"text/javascript\">\n//<![CDATA[\n";
|
| 57 |
$emosOut .= " window.emosTrackVersion = 2;\n";
|
| 58 |
$emosOut .= "//]]>\n</script>";
|
| 67 |
$emosOut .= $emosLogin;
|
| 68 |
}
|
| 69 |
else {
|
| 70 |
+
$emosOut = "\n<!-- Start Econda-Monitor M111 -->\n";
|
| 71 |
$emosOut .= "\n<a name=\"emos_name\" title=\"content\" rel=\"Start/".$eLang[38]."\" rev=\"\"></a>\n";
|
| 72 |
$emosOut .= "<script type=\"text/javascript\">\n//<