Intelligent_Reach - Version 1.0.15

Version Notes

Stable release. Compatible with older versions. Feed creation has been optimized to handle larger loads. The option to choose the store is now available. Can retrieve associated products for grouped types.Bug fixes.Has support for PHP V5.2

Download this release

Release Info

Developer Magento Core Team
Extension Intelligent_Reach
Version 1.0.15
Comparing to
See all releases


Version 1.0.15

Files changed (22) hide show
  1. app/code/local/IntelligentReach/Integration/etc/config.xml +28 -0
  2. app/design/frontend/base/default/layout/intelligentreach_integration.xml +33 -0
  3. app/design/frontend/base/default/template/intelligentreach_integration/basket/intelligentreach_integration.phtml +20 -0
  4. app/design/frontend/base/default/template/intelligentreach_integration/checkout/multishipping/intelligentreach_integration.phtml +95 -0
  5. app/design/frontend/base/default/template/intelligentreach_integration/checkout/onepage/intelligentreach_integration.phtml +66 -0
  6. app/design/frontend/base/default/template/intelligentreach_integration/intelligentreach_integration.phtml +15 -0
  7. app/design/frontend/base/default/template/intelligentreach_integration/product/intelligentreach_integration.phtml +17 -0
  8. app/design/frontend/default/default/layout/intelligentreach_integration.xml +33 -0
  9. app/design/frontend/default/default/template/intelligentreach_integration/basket/intelligentreach_integration.phtml +20 -0
  10. app/design/frontend/default/default/template/intelligentreach_integration/checkout/multishipping/intelligentreach_integration.phtml +95 -0
  11. app/design/frontend/default/default/template/intelligentreach_integration/checkout/onepage/intelligentreach_integration.phtml +66 -0
  12. app/design/frontend/default/default/template/intelligentreach_integration/intelligentreach_integration.phtml +15 -0
  13. app/design/frontend/default/default/template/intelligentreach_integration/product/intelligentreach_integration.phtml +17 -0
  14. app/design/frontend/enterprise/default/layout/intelligentreach_integration.xml +33 -0
  15. app/design/frontend/enterprise/default/template/intelligentreach_integration/basket/intelligentreach_integration.phtml +20 -0
  16. app/design/frontend/enterprise/default/template/intelligentreach_integration/checkout/multishipping/intelligentreach_integration.phtml +95 -0
  17. app/design/frontend/enterprise/default/template/intelligentreach_integration/checkout/onepage/intelligentreach_integration.phtml +66 -0
  18. app/design/frontend/enterprise/default/template/intelligentreach_integration/intelligentreach_integration.phtml +15 -0
  19. app/design/frontend/enterprise/default/template/intelligentreach_integration/product/intelligentreach_integration.phtml +17 -0
  20. app/etc/modules/IntelligentReach_Integration.xml +9 -0
  21. intelligentreach_integration.php +244 -0
  22. package.xml +25 -0
app/code/local/IntelligentReach/Integration/etc/config.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <IntelligentReach_Integration>
5
+ <version>0.1.0</version>
6
+ </IntelligentReach_Integration>
7
+ </modules>
8
+ <frontend>
9
+ <layout>
10
+ <updates>
11
+ <IntelligentReach_Integration>
12
+ <file>intelligentreach_integration.xml</file>
13
+ </IntelligentReach_Integration>
14
+ </updates>
15
+ </layout>
16
+ </frontend>
17
+ <admin>
18
+ <routers>
19
+ <IntelligentReach_Integration>
20
+ <use>admin</use>
21
+ <args>
22
+ <module>IntelligentReach_Integration</module>
23
+ <frontName>integration</frontName>
24
+ </args>
25
+ </IntelligentReach_Integration>
26
+ </routers>
27
+ </admin>
28
+ </config>
app/design/frontend/base/default/layout/intelligentreach_integration.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="after_body_start">
5
+ <block type="core/template" before="-" name="intelligentreach_integration_allpages" template="intelligentreach_integration/intelligentreach_integration.phtml"/>
6
+ </reference>
7
+ </default>
8
+
9
+ <catalog_product_view>
10
+ <reference name="after_body_start">
11
+ <block type="core/template" before="-" name="intelligentreach_integration_product_view" template="intelligentreach_integration/product/intelligentreach_integration.phtml"/>
12
+ </reference>
13
+ </catalog_product_view>
14
+
15
+ <checkout_cart_index>
16
+ <reference name="after_body_start">
17
+ <block type="core/template" before="-" name="intelligentreach_integration_cart_index" template="intelligentreach_integration/basket/intelligentreach_integration.phtml"/>
18
+ </reference>
19
+ </checkout_cart_index>
20
+
21
+ <checkout_onepage_success>
22
+ <reference name="after_body_start">
23
+ <block type="core/template" before="-" name="intelligentreach_integration_onepage_success" template="intelligentreach_integration/checkout/onepage/intelligentreach_integration.phtml"/>
24
+ </reference>
25
+ </checkout_onepage_success>
26
+
27
+ <checkout_multishipping_success>
28
+ <reference name="after_body_start">
29
+ <block type="core/template" before="-" name="intelligentreach_integration_multishipping_success" template="intelligentreach_integration/checkout/multishipping/intelligentreach_integration.phtml"/>
30
+ </reference>
31
+ </checkout_multishipping_success>
32
+ </layout>
33
+
app/design/frontend/base/default/template/intelligentreach_integration/basket/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //Basket Page
7
+ ?>
8
+ <?php
9
+ $store_id = Mage::app()->getstore()->getid();
10
+ $id = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
11
+ ?>
12
+ <?php $quote = Mage::getSingleton('checkout/session')->getQuote(); $cartItems = $quote->getAllItems(); $basketItems = "";?>
13
+ <?php foreach($cartItems as $item): ?>
14
+ <?php if($item === end($cartItems)){$basketItems .= $item->getProductId(); }else{$basketItems .= $item->getProductId()."|";} ?>
15
+ <?php endforeach ?>
16
+ <script type="text/javascript">
17
+ istCompanyId = "<?php echo $id; ?>";
18
+ istBasketItems = "<?php echo $basketItems; ?>";
19
+ </script>
20
+ <script type="text/javascript" src="//www.ist-track.com/ContainerBasketJavaScript.ashx?id=<?php echo $id; ?>"></script>
app/design/frontend/base/default/template/intelligentreach_integration/checkout/multishipping/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //Multi-shipping Checkout Page
7
+ ?>
8
+ <?php
9
+ $store_id = Mage::app()->getstore()->getid();
10
+ $istCompanyId = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
11
+ ?>
12
+ <?php
13
+ $orderIds = Mage::getSingleton('core/session')->getOrderIds();
14
+ $purchasedItems = "";
15
+ $purchasedItemQuantities = "";
16
+ $purchasedItemPrices = "";
17
+ ?>
18
+ <?php foreach($orderIds as $id): ?>
19
+ <?php
20
+ $orderNumber = $id;
21
+ $sale = Mage::getModel('sales/order')->loadByIncrementId($orderNumber); $orderItems = $sale->getAllVisibleItems();
22
+ ?>
23
+ <?php foreach($orderItems as $item): ?>
24
+ <?php
25
+ if(!in_array($item->getProductId(),$purchasedItemsArray))
26
+ {
27
+ $purchasedItemsArray[]= $item->getProductId();
28
+ $purchasedItemPricesArray[] = number_format($item->getPrice(),2,'.','');
29
+ }
30
+ $purchasedItemQuantitiesArray[$item->getProductId()] += (int)$item->getQtyOrdered();
31
+ ?>
32
+ <?php endforeach ?>
33
+ <?php foreach(array_unique($orderItems) as $i): ?>
34
+ <?php
35
+ $purchasedItemsTotal = $purchasedItemsTotal + $sale->getGrandTotal();
36
+ ?>
37
+ <?php endforeach ?>
38
+ <?php endforeach ?>
39
+ <?php
40
+ // Building the string for the Purchased Item Id's value
41
+ $lastItem = count($purchasedItemsArray);
42
+ $itemIndex = 1;
43
+ foreach($purchasedItemsArray as $itemId){
44
+ if($itemIndex == $lastItem){
45
+ $purchasedItems .= $itemId ;
46
+ }else{
47
+ $purchasedItems .= $itemId."|";
48
+ }
49
+ $itemIndex++;
50
+ }
51
+
52
+ // Building the string for the Purchased Item Quantities value
53
+ $lastQuantity = count($purchasedItemQuantitiesArray);
54
+ $quantityIndex = 1;
55
+ foreach($purchasedItemQuantitiesArray as $itemQuantity){
56
+ if($quantityIndex == $lastQuantity){
57
+ $purchasedItemQuantities .= $itemQuantity;
58
+ }else{
59
+ $purchasedItemQuantities .= $itemQuantity."|";
60
+ }
61
+ $quantityIndex++;
62
+ }
63
+
64
+ // Building the string for the Purchased Item Prices value
65
+ $lastPrice = count($purchasedItemPricesArray);
66
+ $priceIndex = 1;
67
+ foreach($purchasedItemPricesArray as $itemPrice){
68
+ if($priceIndex == $lastPrice){
69
+ $purchasedItemPrices .= $itemPrice ;
70
+ }else{
71
+ $purchasedItemPrices .= $itemPrice."|";
72
+ }
73
+ $priceIndex++;
74
+ }
75
+ ?>
76
+ <script type="text/javascript">
77
+ istCompanyId = "<?php echo $istCompanyId; ?>";
78
+ istOrderId = "<?php echo $orderNumber ?>";
79
+ istTotal = <?php echo $total = number_format($purchasedItemsTotal, 2, '.',''); ?>;
80
+ istItemCount = <?php echo $itemCount = (int)$sale->getTotalQtyOrdered();?>;
81
+ istNewCustomer = <?php if($sale->getCustomerIsGuest()== 0){$newCustomer = "false";}else{$newCustomer = "true";} echo $newCustomer ;?>;
82
+ istPurchasedItems = "<?php echo $purchasedItems ?>";
83
+ istPurchasedItemQuantities = "<?php echo $purchasedItemQuantities ?>";
84
+ istPurchasedItemPrices = "<?php echo $purchasedItemPrices ?>";
85
+ istInstorePickup = false;
86
+ istVoucherCode = "<?php echo $voucherCode = $sale->getCouponCode();?>";
87
+ istLastAffiliateCode = "";
88
+ istUserDefinedFieldOne = "";
89
+ istUserDefinedFieldTwo = "";
90
+ istUserDefinedFieldThree = "";
91
+ </script>
92
+ <script type="text/javascript" src="//www.ist-track.com/ContainerPurchaseJavaScript.ashx?id=<?php echo $istCompanyId; ?>"></script>
93
+ <noscript>
94
+ <img src="//www.ist-track.com/ProcessPurchaseImage.ashx?companyId=<?php echo $istCompanyId; ?>&orderId=<?php echo $orderNumber ?>&total=<?php echo $total ?>&itemCount=<?php echo $itemCount ?>&newCustomer=<?php echo $newCustomer ?>&purchasedItems=<?php echo $purchasedItems ?>&purchasedItemQuantities=<?php echo $purchasedItemQuantities ?>&purchasedItemPrices=<?php echo $purchasedItemPrices ?>&instorePickup=false&voucherCode=<?php echo $voucherCode ?>&lastAffiliateCode=&userDefinedFieldOne=&userDefinedFieldTwo=&userDefinedFieldThree=" alt="" width="1" />
95
+ </noscript>
app/design/frontend/base/default/template/intelligentreach_integration/checkout/onepage/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //One Page Checkout Page
7
+ ?>
8
+ <?php
9
+ $store_id = Mage::app()->getstore()->getid();
10
+ $id = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
11
+ ?>
12
+ <?php $order = Mage::getSingleton('checkout/session'); $lastorderId = $order->getLastRealOrderId(); $purchasedItems = ""; $purchasedItemQuantities = ""; $purchasedItemPrices = "";?>
13
+ <?php $sale = Mage::getModel('sales/order')->loadByIncrementId($lastorderId); $orderItems = $sale->getAllVisibleItems(); ?>
14
+ <?php foreach($orderItems as $item): ?>
15
+ <?php
16
+ $purchasedItemsArray[]= $item->getProductId();
17
+ $purchasedItemQuantitiesArray[] = (int)$item->getQtyOrdered();
18
+ $purchasedItemPricesArray[] = number_format($item->getPrice(),2,'.','');
19
+ ?>
20
+ <?php endforeach ?>
21
+ <?php
22
+ // Building the string for the Purchased Item Id's value
23
+ for($i = 0; $i < count($purchasedItemsArray); $i++){
24
+ if($i == (count($purchasedItemsArray) - 1)){
25
+ $purchasedItems .= $purchasedItemsArray[$i] ;
26
+ }else{
27
+ $purchasedItems .= $purchasedItemsArray[$i]."|";
28
+ }
29
+ }
30
+ // Building the string for the Purchased Item Quantities value
31
+ for($i = 0; $i < count($purchasedItemQuantitiesArray); $i++){
32
+ if($i == (count($purchasedItemQuantitiesArray) - 1)){
33
+ $purchasedItemQuantities .= $purchasedItemQuantitiesArray[$i] ;
34
+ }else{
35
+ $purchasedItemQuantities .= $purchasedItemQuantitiesArray[$i]."|";
36
+ }
37
+ }
38
+ // Building the string for the Purchased Item Prices value
39
+ for($i = 0; $i < count($purchasedItemPricesArray); $i++){
40
+ if($i == (count($purchasedItemPricesArray) - 1)){
41
+ $purchasedItemPrices .= $purchasedItemPricesArray[$i] ;
42
+ }else{
43
+ $purchasedItemPrices .= $purchasedItemPricesArray[$i]."|";
44
+ }
45
+ }
46
+ ?>
47
+ <script type="text/javascript">
48
+ istCompanyId = "<?php echo $id; ?>";
49
+ istOrderId = "<?php echo $lastorderId ?>";
50
+ istTotal = <?php echo $total = number_format($sale->getGrandTotal(), 2, '.',''); ?>;
51
+ istItemCount = <?php echo $itemCount = (int)$sale->getTotalQtyOrdered();?>;
52
+ istNewCustomer = <?php if($sale->getCustomerIsGuest()== 0){$newCustomer = "false";}else{$newCustomer = "true";} echo $newCustomer ;?>;
53
+ istPurchasedItems = "<?php echo $purchasedItems ?>";
54
+ istPurchasedItemQuantities = "<?php echo $purchasedItemQuantities ?>";
55
+ istPurchasedItemPrices = "<?php echo $purchasedItemPrices ?>";
56
+ istInstorePickup = false;
57
+ istVoucherCode = "<?php echo $voucherCode = $sale->getCouponCode();?>";
58
+ istLastAffiliateCode = "";
59
+ istUserDefinedFieldOne = "";
60
+ istUserDefinedFieldTwo = "";
61
+ istUserDefinedFieldThree = "";
62
+ </script>
63
+ <script type="text/javascript" src="//www.ist-track.com/ContainerPurchaseJavaScript.ashx?id=<?php echo $id; ?>"></script>
64
+ <noscript>
65
+ <img src="//www.ist-track.com/ProcessPurchaseImage.ashx?companyId=<?php echo $id; ?>&orderId=<?php echo $lastorderId ?>&total=<?php echo $total ?>&itemCount=<?php echo $itemCount ?>&newCustomer=<?php echo $newCustomer ?>&purchasedItems=<?php echo $purchasedItems ?>&purchasedItemQuantities=<?php echo $purchasedItemQuantities ?>&purchasedItemPrices=<?php echo $purchasedItemPrices ?>&instorePickup=false&voucherCode=<?php echo $voucherCode ?>&lastAffiliateCode=&userDefinedFieldOne=&userDefinedFieldTwo=&userDefinedFieldThree=" alt="" width="1" />
66
+ </noscript>
app/design/frontend/base/default/template/intelligentreach_integration/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //All Pages
7
+ ?>
8
+ <?php
9
+ $store_id = Mage::app()->getstore()->getid();
10
+ $id = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
11
+ ?>
12
+ <script type="text/javascript" src="//www.ist-track.com/ContainerJavaScript.ashx?id=<?php echo $id; ?>"></script>
13
+ <noscript>
14
+ <img src="//www.ist-track.com/ProcessClickImage.ashx" alt="" width="1" height="1"/>
15
+ </noscript>
app/design/frontend/base/default/template/intelligentreach_integration/product/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //Product Page
7
+ ?>
8
+ <?php
9
+ $product = Mage::registry('current_product');
10
+ $store_id = Mage::app()->getstore()->getid();
11
+ $id = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
12
+ ?>
13
+ <script type="text/javascript">
14
+ istCompanyId = "<?php echo $id ?>";
15
+ istItem = "<?php echo $product->getId();?>";
16
+ </script>
17
+ <script type="text/javascript" src="//www.ist-track.com/ContainerItemJavaScript.ashx?id=<?php echo $id; ?>"></script>
app/design/frontend/default/default/layout/intelligentreach_integration.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="after_body_start">
5
+ <block type="core/template" before="-" name="intelligentreach_integration_allpages" template="intelligentreach_integration/intelligentreach_integration.phtml"/>
6
+ </reference>
7
+ </default>
8
+
9
+ <catalog_product_view>
10
+ <reference name="after_body_start">
11
+ <block type="core/template" before="-" name="intelligentreach_integration_product_view" template="intelligentreach_integration/product/intelligentreach_integration.phtml"/>
12
+ </reference>
13
+ </catalog_product_view>
14
+
15
+ <checkout_cart_index>
16
+ <reference name="after_body_start">
17
+ <block type="core/template" before="-" name="intelligentreach_integration_cart_index" template="intelligentreach_integration/basket/intelligentreach_integration.phtml"/>
18
+ </reference>
19
+ </checkout_cart_index>
20
+
21
+ <checkout_onepage_success>
22
+ <reference name="after_body_start">
23
+ <block type="core/template" before="-" name="intelligentreach_integration_onepage_success" template="intelligentreach_integration/checkout/onepage/intelligentreach_integration.phtml"/>
24
+ </reference>
25
+ </checkout_onepage_success>
26
+
27
+ <checkout_multishipping_success>
28
+ <reference name="after_body_start">
29
+ <block type="core/template" before="-" name="intelligentreach_integration_multishipping_success" template="intelligentreach_integration/checkout/multishipping/intelligentreach_integration.phtml"/>
30
+ </reference>
31
+ </checkout_multishipping_success>
32
+ </layout>
33
+
app/design/frontend/default/default/template/intelligentreach_integration/basket/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //Basket Page
7
+ ?>
8
+ <?php
9
+ $store_id = Mage::app()->getstore()->getid();
10
+ $id = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
11
+ ?>
12
+ <?php $quote = Mage::getSingleton('checkout/session')->getQuote(); $cartItems = $quote->getAllItems(); $basketItems = "";?>
13
+ <?php foreach($cartItems as $item): ?>
14
+ <?php if($item === end($cartItems)){$basketItems .= $item->getProductId(); }else{$basketItems .= $item->getProductId()."|";} ?>
15
+ <?php endforeach ?>
16
+ <script type="text/javascript">
17
+ istCompanyId = "<?php echo $id; ?>";
18
+ istBasketItems = "<?php echo $basketItems; ?>";
19
+ </script>
20
+ <script type="text/javascript" src="//www.ist-track.com/ContainerBasketJavaScript.ashx?id=<?php echo $id; ?>"></script>
app/design/frontend/default/default/template/intelligentreach_integration/checkout/multishipping/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //Multi-shipping Checkout Page
7
+ ?>
8
+ <?php
9
+ $store_id = Mage::app()->getstore()->getid();
10
+ $istCompanyId = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
11
+ ?>
12
+ <?php
13
+ $orderIds = Mage::getSingleton('core/session')->getOrderIds();
14
+ $purchasedItems = "";
15
+ $purchasedItemQuantities = "";
16
+ $purchasedItemPrices = "";
17
+ ?>
18
+ <?php foreach($orderIds as $id): ?>
19
+ <?php
20
+ $orderNumber = $id;
21
+ $sale = Mage::getModel('sales/order')->loadByIncrementId($orderNumber); $orderItems = $sale->getAllVisibleItems();
22
+ ?>
23
+ <?php foreach($orderItems as $item): ?>
24
+ <?php
25
+ if(!in_array($item->getProductId(),$purchasedItemsArray))
26
+ {
27
+ $purchasedItemsArray[]= $item->getProductId();
28
+ $purchasedItemPricesArray[] = number_format($item->getPrice(),2,'.','');
29
+ }
30
+ $purchasedItemQuantitiesArray[$item->getProductId()] += (int)$item->getQtyOrdered();
31
+ ?>
32
+ <?php endforeach ?>
33
+ <?php foreach(array_unique($orderItems) as $i): ?>
34
+ <?php
35
+ $purchasedItemsTotal = $purchasedItemsTotal + $sale->getGrandTotal();
36
+ ?>
37
+ <?php endforeach ?>
38
+ <?php endforeach ?>
39
+ <?php
40
+ // Building the string for the Purchased Item Id's value
41
+ $lastItem = count($purchasedItemsArray);
42
+ $itemIndex = 1;
43
+ foreach($purchasedItemsArray as $itemId){
44
+ if($itemIndex == $lastItem){
45
+ $purchasedItems .= $itemId ;
46
+ }else{
47
+ $purchasedItems .= $itemId."|";
48
+ }
49
+ $itemIndex++;
50
+ }
51
+
52
+ // Building the string for the Purchased Item Quantities value
53
+ $lastQuantity = count($purchasedItemQuantitiesArray);
54
+ $quantityIndex = 1;
55
+ foreach($purchasedItemQuantitiesArray as $itemQuantity){
56
+ if($quantityIndex == $lastQuantity){
57
+ $purchasedItemQuantities .= $itemQuantity;
58
+ }else{
59
+ $purchasedItemQuantities .= $itemQuantity."|";
60
+ }
61
+ $quantityIndex++;
62
+ }
63
+
64
+ // Building the string for the Purchased Item Prices value
65
+ $lastPrice = count($purchasedItemPricesArray);
66
+ $priceIndex = 1;
67
+ foreach($purchasedItemPricesArray as $itemPrice){
68
+ if($priceIndex == $lastPrice){
69
+ $purchasedItemPrices .= $itemPrice ;
70
+ }else{
71
+ $purchasedItemPrices .= $itemPrice."|";
72
+ }
73
+ $priceIndex++;
74
+ }
75
+ ?>
76
+ <script type="text/javascript">
77
+ istCompanyId = "<?php echo $istCompanyId; ?>";
78
+ istOrderId = "<?php echo $orderNumber ?>";
79
+ istTotal = <?php echo $total = number_format($purchasedItemsTotal, 2, '.',''); ?>;
80
+ istItemCount = <?php echo $itemCount = (int)$sale->getTotalQtyOrdered();?>;
81
+ istNewCustomer = <?php if($sale->getCustomerIsGuest()== 0){$newCustomer = "false";}else{$newCustomer = "true";} echo $newCustomer ;?>;
82
+ istPurchasedItems = "<?php echo $purchasedItems ?>";
83
+ istPurchasedItemQuantities = "<?php echo $purchasedItemQuantities ?>";
84
+ istPurchasedItemPrices = "<?php echo $purchasedItemPrices ?>";
85
+ istInstorePickup = false;
86
+ istVoucherCode = "<?php echo $voucherCode = $sale->getCouponCode();?>";
87
+ istLastAffiliateCode = "";
88
+ istUserDefinedFieldOne = "";
89
+ istUserDefinedFieldTwo = "";
90
+ istUserDefinedFieldThree = "";
91
+ </script>
92
+ <script type="text/javascript" src="//www.ist-track.com/ContainerPurchaseJavaScript.ashx?id=<?php echo $istCompanyId; ?>"></script>
93
+ <noscript>
94
+ <img src="//www.ist-track.com/ProcessPurchaseImage.ashx?companyId=<?php echo $istCompanyId; ?>&orderId=<?php echo $orderNumber ?>&total=<?php echo $total ?>&itemCount=<?php echo $itemCount ?>&newCustomer=<?php echo $newCustomer ?>&purchasedItems=<?php echo $purchasedItems ?>&purchasedItemQuantities=<?php echo $purchasedItemQuantities ?>&purchasedItemPrices=<?php echo $purchasedItemPrices ?>&instorePickup=false&voucherCode=<?php echo $voucherCode ?>&lastAffiliateCode=&userDefinedFieldOne=&userDefinedFieldTwo=&userDefinedFieldThree=" alt="" width="1" />
95
+ </noscript>
app/design/frontend/default/default/template/intelligentreach_integration/checkout/onepage/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //One Page Checkout Page
7
+ ?>
8
+ <?php
9
+ $store_id = Mage::app()->getstore()->getid();
10
+ $id = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
11
+ ?>
12
+ <?php $order = Mage::getSingleton('checkout/session'); $lastorderId = $order->getLastRealOrderId(); $purchasedItems = ""; $purchasedItemQuantities = ""; $purchasedItemPrices = "";?>
13
+ <?php $sale = Mage::getModel('sales/order')->loadByIncrementId($lastorderId); $orderItems = $sale->getAllVisibleItems(); ?>
14
+ <?php foreach($orderItems as $item): ?>
15
+ <?php
16
+ $purchasedItemsArray[]= $item->getProductId();
17
+ $purchasedItemQuantitiesArray[] = (int)$item->getQtyOrdered();
18
+ $purchasedItemPricesArray[] = number_format($item->getPrice(),2,'.','');
19
+ ?>
20
+ <?php endforeach ?>
21
+ <?php
22
+ // Building the string for the Purchased Item Id's value
23
+ for($i = 0; $i < count($purchasedItemsArray); $i++){
24
+ if($i == (count($purchasedItemsArray) - 1)){
25
+ $purchasedItems .= $purchasedItemsArray[$i] ;
26
+ }else{
27
+ $purchasedItems .= $purchasedItemsArray[$i]."|";
28
+ }
29
+ }
30
+ // Building the string for the Purchased Item Quantities value
31
+ for($i = 0; $i < count($purchasedItemQuantitiesArray); $i++){
32
+ if($i == (count($purchasedItemQuantitiesArray) - 1)){
33
+ $purchasedItemQuantities .= $purchasedItemQuantitiesArray[$i] ;
34
+ }else{
35
+ $purchasedItemQuantities .= $purchasedItemQuantitiesArray[$i]."|";
36
+ }
37
+ }
38
+ // Building the string for the Purchased Item Prices value
39
+ for($i = 0; $i < count($purchasedItemPricesArray); $i++){
40
+ if($i == (count($purchasedItemPricesArray) - 1)){
41
+ $purchasedItemPrices .= $purchasedItemPricesArray[$i] ;
42
+ }else{
43
+ $purchasedItemPrices .= $purchasedItemPricesArray[$i]."|";
44
+ }
45
+ }
46
+ ?>
47
+ <script type="text/javascript">
48
+ istCompanyId = "<?php echo $id; ?>";
49
+ istOrderId = "<?php echo $lastorderId ?>";
50
+ istTotal = <?php echo $total = number_format($sale->getGrandTotal(), 2, '.',''); ?>;
51
+ istItemCount = <?php echo $itemCount = (int)$sale->getTotalQtyOrdered();?>;
52
+ istNewCustomer = <?php if($sale->getCustomerIsGuest()== 0){$newCustomer = "false";}else{$newCustomer = "true";} echo $newCustomer ;?>;
53
+ istPurchasedItems = "<?php echo $purchasedItems ?>";
54
+ istPurchasedItemQuantities = "<?php echo $purchasedItemQuantities ?>";
55
+ istPurchasedItemPrices = "<?php echo $purchasedItemPrices ?>";
56
+ istInstorePickup = false;
57
+ istVoucherCode = "<?php echo $voucherCode = $sale->getCouponCode();?>";
58
+ istLastAffiliateCode = "";
59
+ istUserDefinedFieldOne = "";
60
+ istUserDefinedFieldTwo = "";
61
+ istUserDefinedFieldThree = "";
62
+ </script>
63
+ <script type="text/javascript" src="//www.ist-track.com/ContainerPurchaseJavaScript.ashx?id=<?php echo $id; ?>"></script>
64
+ <noscript>
65
+ <img src="//www.ist-track.com/ProcessPurchaseImage.ashx?companyId=<?php echo $id; ?>&orderId=<?php echo $lastorderId ?>&total=<?php echo $total ?>&itemCount=<?php echo $itemCount ?>&newCustomer=<?php echo $newCustomer ?>&purchasedItems=<?php echo $purchasedItems ?>&purchasedItemQuantities=<?php echo $purchasedItemQuantities ?>&purchasedItemPrices=<?php echo $purchasedItemPrices ?>&instorePickup=false&voucherCode=<?php echo $voucherCode ?>&lastAffiliateCode=&userDefinedFieldOne=&userDefinedFieldTwo=&userDefinedFieldThree=" alt="" width="1" />
66
+ </noscript>
app/design/frontend/default/default/template/intelligentreach_integration/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //All Pages
7
+ ?>
8
+ <?php
9
+ $store_id = Mage::app()->getstore()->getid();
10
+ $id = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
11
+ ?>
12
+ <script type="text/javascript" src="//www.ist-track.com/ContainerJavaScript.ashx?id=<?php echo $id; ?>"></script>
13
+ <noscript>
14
+ <img src="//www.ist-track.com/ProcessClickImage.ashx" alt="" width="1" height="1"/>
15
+ </noscript>
app/design/frontend/default/default/template/intelligentreach_integration/product/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //Product Page
7
+ ?>
8
+ <?php
9
+ $product = Mage::registry('current_product');
10
+ $store_id = Mage::app()->getstore()->getid();
11
+ $id = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
12
+ ?>
13
+ <script type="text/javascript">
14
+ istCompanyId = "<?php echo $id ?>";
15
+ istItem = "<?php echo $product->getId();?>";
16
+ </script>
17
+ <script type="text/javascript" src="//www.ist-track.com/ContainerItemJavaScript.ashx?id=<?php echo $id; ?>"></script>
app/design/frontend/enterprise/default/layout/intelligentreach_integration.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="after_body_start">
5
+ <block type="core/template" before="-" name="intelligentreach_integration_allpages" template="intelligentreach_integration/intelligentreach_integration.phtml"/>
6
+ </reference>
7
+ </default>
8
+
9
+ <catalog_product_view>
10
+ <reference name="after_body_start">
11
+ <block type="core/template" before="-" name="intelligentreach_integration_product_view" template="intelligentreach_integration/product/intelligentreach_integration.phtml"/>
12
+ </reference>
13
+ </catalog_product_view>
14
+
15
+ <checkout_cart_index>
16
+ <reference name="after_body_start">
17
+ <block type="core/template" before="-" name="intelligentreach_integration_cart_index" template="intelligentreach_integration/basket/intelligentreach_integration.phtml"/>
18
+ </reference>
19
+ </checkout_cart_index>
20
+
21
+ <checkout_onepage_success>
22
+ <reference name="after_body_start">
23
+ <block type="core/template" before="-" name="intelligentreach_integration_onepage_success" template="intelligentreach_integration/checkout/onepage/intelligentreach_integration.phtml"/>
24
+ </reference>
25
+ </checkout_onepage_success>
26
+
27
+ <checkout_multishipping_success>
28
+ <reference name="after_body_start">
29
+ <block type="core/template" before="-" name="intelligentreach_integration_multishipping_success" template="intelligentreach_integration/checkout/multishipping/intelligentreach_integration.phtml"/>
30
+ </reference>
31
+ </checkout_multishipping_success>
32
+ </layout>
33
+
app/design/frontend/enterprise/default/template/intelligentreach_integration/basket/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //Basket Page
7
+ ?>
8
+ <?php
9
+ $store_id = Mage::app()->getstore()->getid();
10
+ $id = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
11
+ ?>
12
+ <?php $quote = Mage::getSingleton('checkout/session')->getQuote(); $cartItems = $quote->getAllItems(); $basketItems = "";?>
13
+ <?php foreach($cartItems as $item): ?>
14
+ <?php if($item === end($cartItems)){$basketItems .= $item->getProductId(); }else{$basketItems .= $item->getProductId()."|";} ?>
15
+ <?php endforeach ?>
16
+ <script type="text/javascript">
17
+ istCompanyId = "<?php echo $id; ?>";
18
+ istBasketItems = "<?php echo $basketItems; ?>";
19
+ </script>
20
+ <script type="text/javascript" src="//www.ist-track.com/ContainerBasketJavaScript.ashx?id=<?php echo $id; ?>"></script>
app/design/frontend/enterprise/default/template/intelligentreach_integration/checkout/multishipping/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //Multi-shipping Checkout Page
7
+ ?>
8
+ <?php
9
+ $store_id = Mage::app()->getstore()->getid();
10
+ $istCompanyId = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
11
+ ?>
12
+ <?php
13
+ $orderIds = Mage::getSingleton('core/session')->getOrderIds();
14
+ $purchasedItems = "";
15
+ $purchasedItemQuantities = "";
16
+ $purchasedItemPrices = "";
17
+ ?>
18
+ <?php foreach($orderIds as $id): ?>
19
+ <?php
20
+ $orderNumber = $id;
21
+ $sale = Mage::getModel('sales/order')->loadByIncrementId($orderNumber); $orderItems = $sale->getAllVisibleItems();
22
+ ?>
23
+ <?php foreach($orderItems as $item): ?>
24
+ <?php
25
+ if(!in_array($item->getProductId(),$purchasedItemsArray))
26
+ {
27
+ $purchasedItemsArray[]= $item->getProductId();
28
+ $purchasedItemPricesArray[] = number_format($item->getPrice(),2,'.','');
29
+ }
30
+ $purchasedItemQuantitiesArray[$item->getProductId()] += (int)$item->getQtyOrdered();
31
+ ?>
32
+ <?php endforeach ?>
33
+ <?php foreach(array_unique($orderItems) as $i): ?>
34
+ <?php
35
+ $purchasedItemsTotal = $purchasedItemsTotal + $sale->getGrandTotal();
36
+ ?>
37
+ <?php endforeach ?>
38
+ <?php endforeach ?>
39
+ <?php
40
+ // Building the string for the Purchased Item Id's value
41
+ $lastItem = count($purchasedItemsArray);
42
+ $itemIndex = 1;
43
+ foreach($purchasedItemsArray as $itemId){
44
+ if($itemIndex == $lastItem){
45
+ $purchasedItems .= $itemId ;
46
+ }else{
47
+ $purchasedItems .= $itemId."|";
48
+ }
49
+ $itemIndex++;
50
+ }
51
+
52
+ // Building the string for the Purchased Item Quantities value
53
+ $lastQuantity = count($purchasedItemQuantitiesArray);
54
+ $quantityIndex = 1;
55
+ foreach($purchasedItemQuantitiesArray as $itemQuantity){
56
+ if($quantityIndex == $lastQuantity){
57
+ $purchasedItemQuantities .= $itemQuantity;
58
+ }else{
59
+ $purchasedItemQuantities .= $itemQuantity."|";
60
+ }
61
+ $quantityIndex++;
62
+ }
63
+
64
+ // Building the string for the Purchased Item Prices value
65
+ $lastPrice = count($purchasedItemPricesArray);
66
+ $priceIndex = 1;
67
+ foreach($purchasedItemPricesArray as $itemPrice){
68
+ if($priceIndex == $lastPrice){
69
+ $purchasedItemPrices .= $itemPrice ;
70
+ }else{
71
+ $purchasedItemPrices .= $itemPrice."|";
72
+ }
73
+ $priceIndex++;
74
+ }
75
+ ?>
76
+ <script type="text/javascript">
77
+ istCompanyId = "<?php echo $istCompanyId; ?>";
78
+ istOrderId = "<?php echo $orderNumber ?>";
79
+ istTotal = <?php echo $total = number_format($purchasedItemsTotal, 2, '.',''); ?>;
80
+ istItemCount = <?php echo $itemCount = (int)$sale->getTotalQtyOrdered();?>;
81
+ istNewCustomer = <?php if($sale->getCustomerIsGuest()== 0){$newCustomer = "false";}else{$newCustomer = "true";} echo $newCustomer ;?>;
82
+ istPurchasedItems = "<?php echo $purchasedItems ?>";
83
+ istPurchasedItemQuantities = "<?php echo $purchasedItemQuantities ?>";
84
+ istPurchasedItemPrices = "<?php echo $purchasedItemPrices ?>";
85
+ istInstorePickup = false;
86
+ istVoucherCode = "<?php echo $voucherCode = $sale->getCouponCode();?>";
87
+ istLastAffiliateCode = "";
88
+ istUserDefinedFieldOne = "";
89
+ istUserDefinedFieldTwo = "";
90
+ istUserDefinedFieldThree = "";
91
+ </script>
92
+ <script type="text/javascript" src="//www.ist-track.com/ContainerPurchaseJavaScript.ashx?id=<?php echo $istCompanyId; ?>"></script>
93
+ <noscript>
94
+ <img src="//www.ist-track.com/ProcessPurchaseImage.ashx?companyId=<?php echo $istCompanyId; ?>&orderId=<?php echo $orderNumber ?>&total=<?php echo $total ?>&itemCount=<?php echo $itemCount ?>&newCustomer=<?php echo $newCustomer ?>&purchasedItems=<?php echo $purchasedItems ?>&purchasedItemQuantities=<?php echo $purchasedItemQuantities ?>&purchasedItemPrices=<?php echo $purchasedItemPrices ?>&instorePickup=false&voucherCode=<?php echo $voucherCode ?>&lastAffiliateCode=&userDefinedFieldOne=&userDefinedFieldTwo=&userDefinedFieldThree=" alt="" width="1" />
95
+ </noscript>
app/design/frontend/enterprise/default/template/intelligentreach_integration/checkout/onepage/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //One Page Checkout Page
7
+ ?>
8
+ <?php
9
+ $store_id = Mage::app()->getstore()->getid();
10
+ $id = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
11
+ ?>
12
+ <?php $order = Mage::getSingleton('checkout/session'); $lastorderId = $order->getLastRealOrderId(); $purchasedItems = ""; $purchasedItemQuantities = ""; $purchasedItemPrices = "";?>
13
+ <?php $sale = Mage::getModel('sales/order')->loadByIncrementId($lastorderId); $orderItems = $sale->getAllVisibleItems(); ?>
14
+ <?php foreach($orderItems as $item): ?>
15
+ <?php
16
+ $purchasedItemsArray[]= $item->getProductId();
17
+ $purchasedItemQuantitiesArray[] = (int)$item->getQtyOrdered();
18
+ $purchasedItemPricesArray[] = number_format($item->getPrice(),2,'.','');
19
+ ?>
20
+ <?php endforeach ?>
21
+ <?php
22
+ // Building the string for the Purchased Item Id's value
23
+ for($i = 0; $i < count($purchasedItemsArray); $i++){
24
+ if($i == (count($purchasedItemsArray) - 1)){
25
+ $purchasedItems .= $purchasedItemsArray[$i] ;
26
+ }else{
27
+ $purchasedItems .= $purchasedItemsArray[$i]."|";
28
+ }
29
+ }
30
+ // Building the string for the Purchased Item Quantities value
31
+ for($i = 0; $i < count($purchasedItemQuantitiesArray); $i++){
32
+ if($i == (count($purchasedItemQuantitiesArray) - 1)){
33
+ $purchasedItemQuantities .= $purchasedItemQuantitiesArray[$i] ;
34
+ }else{
35
+ $purchasedItemQuantities .= $purchasedItemQuantitiesArray[$i]."|";
36
+ }
37
+ }
38
+ // Building the string for the Purchased Item Prices value
39
+ for($i = 0; $i < count($purchasedItemPricesArray); $i++){
40
+ if($i == (count($purchasedItemPricesArray) - 1)){
41
+ $purchasedItemPrices .= $purchasedItemPricesArray[$i] ;
42
+ }else{
43
+ $purchasedItemPrices .= $purchasedItemPricesArray[$i]."|";
44
+ }
45
+ }
46
+ ?>
47
+ <script type="text/javascript">
48
+ istCompanyId = "<?php echo $id; ?>";
49
+ istOrderId = "<?php echo $lastorderId ?>";
50
+ istTotal = <?php echo $total = number_format($sale->getGrandTotal(), 2, '.',''); ?>;
51
+ istItemCount = <?php echo $itemCount = (int)$sale->getTotalQtyOrdered();?>;
52
+ istNewCustomer = <?php if($sale->getCustomerIsGuest()== 0){$newCustomer = "false";}else{$newCustomer = "true";} echo $newCustomer ;?>;
53
+ istPurchasedItems = "<?php echo $purchasedItems ?>";
54
+ istPurchasedItemQuantities = "<?php echo $purchasedItemQuantities ?>";
55
+ istPurchasedItemPrices = "<?php echo $purchasedItemPrices ?>";
56
+ istInstorePickup = false;
57
+ istVoucherCode = "<?php echo $voucherCode = $sale->getCouponCode();?>";
58
+ istLastAffiliateCode = "";
59
+ istUserDefinedFieldOne = "";
60
+ istUserDefinedFieldTwo = "";
61
+ istUserDefinedFieldThree = "";
62
+ </script>
63
+ <script type="text/javascript" src="//www.ist-track.com/ContainerPurchaseJavaScript.ashx?id=<?php echo $id; ?>"></script>
64
+ <noscript>
65
+ <img src="//www.ist-track.com/ProcessPurchaseImage.ashx?companyId=<?php echo $id; ?>&orderId=<?php echo $lastorderId ?>&total=<?php echo $total ?>&itemCount=<?php echo $itemCount ?>&newCustomer=<?php echo $newCustomer ?>&purchasedItems=<?php echo $purchasedItems ?>&purchasedItemQuantities=<?php echo $purchasedItemQuantities ?>&purchasedItemPrices=<?php echo $purchasedItemPrices ?>&instorePickup=false&voucherCode=<?php echo $voucherCode ?>&lastAffiliateCode=&userDefinedFieldOne=&userDefinedFieldTwo=&userDefinedFieldThree=" alt="" width="1" />
66
+ </noscript>
app/design/frontend/enterprise/default/template/intelligentreach_integration/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //All Pages
7
+ ?>
8
+ <?php
9
+ $store_id = Mage::app()->getstore()->getid();
10
+ $id = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
11
+ ?>
12
+ <script type="text/javascript" src="//www.ist-track.com/ContainerJavaScript.ashx?id=<?php echo $id; ?>"></script>
13
+ <noscript>
14
+ <img src="//www.ist-track.com/ProcessClickImage.ashx" alt="" width="1" height="1"/>
15
+ </noscript>
app/design/frontend/enterprise/default/template/intelligentreach_integration/product/intelligentreach_integration.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Tracking code for the Intelligent Reach platform (http://www.intelligentreach.com).
3
+ //Copyright � 2012 Intuitive Search Technologies Ltd.
4
+ //Release under OSL license (http://opensource.org/licenses/osl-3.0).
5
+ //
6
+ //Product Page
7
+ ?>
8
+ <?php
9
+ $product = Mage::registry('current_product');
10
+ $store_id = Mage::app()->getstore()->getid();
11
+ $id = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('intelligent_reach_id')->getValue();
12
+ ?>
13
+ <script type="text/javascript">
14
+ istCompanyId = "<?php echo $id ?>";
15
+ istItem = "<?php echo $product->getId();?>";
16
+ </script>
17
+ <script type="text/javascript" src="//www.ist-track.com/ContainerItemJavaScript.ashx?id=<?php echo $id; ?>"></script>
app/etc/modules/IntelligentReach_Integration.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <IntelligentReach_Integration>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </IntelligentReach_Integration>
8
+ </modules>
9
+ </config>
intelligentreach_integration.php ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** Version 1.0.10 Last updated by Kire on 28/02/2013 **/
3
+
4
+ ini_set('display_errors', 1);
5
+ ini_set('max_execution_time', 1800);
6
+ include_once 'app/Mage.php';
7
+ umask(0);
8
+ Mage::app();
9
+
10
+ // Check if a storeid parameter has been set, returns a boolean.
11
+ function storeIsSelected()
12
+ {
13
+ if(isset($_GET["storeid"]))
14
+ return true;
15
+ else
16
+ return false;
17
+ }
18
+
19
+ // Gets all the stores on the current website,
20
+ // returns a table containing Store Ids and Store Names.
21
+ function getStores()
22
+ {
23
+ $websiteStores = Mage::app()->getWebsite()->getStores();
24
+ echo "<table cellspacing='2px;' border='1px;' cellpadding='8px;'>";
25
+ echo "<tr><th>Store Id</th><th>Store Name</th></tr>";
26
+ foreach ($websiteStores as $store)
27
+ {
28
+ echo "<tr><td>".$store->getId()."</td><td><a href='?storeid=".$store->getId()."&splitby=100&amountofproducts=100'>".$store->getName()."</a></td></tr>";
29
+ }
30
+ echo "</table>";
31
+ }
32
+
33
+ function getSections($lastPageNumber, $sections, $splitBy)
34
+ {
35
+ $pages = $lastPageNumber;
36
+ echo "<table cellspacing='2px;' border='1px;' cellpadding='8px;'>";
37
+ echo "<tr><th>Section</th><th>Pages</th></tr>";
38
+ for($i=$sections; $i>0; $i--)
39
+ {
40
+ $startingPage = $pages-$splitBy + 1;
41
+ if($startingPage <= 0){
42
+ $startingPage = 0;
43
+ }
44
+ echo "<tr><td><a href='?storeid=".$_GET["storeid"]."&startingpage=".$startingPage."&endpage=".$pages."'>".$i."</a></td><td>".$startingPage."-".$pages."</td></tr>";
45
+ $pages = $startingPage - 1;
46
+ }
47
+ echo "</table>";
48
+ }
49
+
50
+ // Gets all the products in the catalog in the specific store view,
51
+ // returns an array of products and their details.
52
+ function getProducts($page)
53
+ {
54
+ $amountOfProductsPerPage = 100;
55
+ if(isset($_GET["amountofproducts"]))
56
+ $amountOfProductsPerPage = $_GET["amountofproducts"];
57
+
58
+ $products = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($_GET["storeid"]);
59
+ $products->setPage($page, $amountOfProductsPerPage);
60
+ $products->addAttributeToSelect('*');
61
+ $products->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED));
62
+
63
+ return $products;
64
+ }
65
+
66
+ // Run the task
67
+ function runTheTask($products, $page, $lastPageNumber)
68
+ {
69
+ header ("Content-Type: text/xml; charset=UTF-8");
70
+ echo '<?xml version="1.0" encoding="utf-8"?>
71
+ <products>';
72
+ //echo '<currentPages>'.$page." - ".$lastPageNumber.'</currentPages>';
73
+ while ($page <= $lastPageNumber)
74
+ {
75
+ $products = getProducts($page);
76
+ printProducts($products);
77
+ $page = $page + 1;
78
+ unset($products);
79
+ flush();
80
+ }
81
+ echo '</products>';
82
+ }
83
+
84
+ // Prints the products to the output as XML nodes, takes an array as a parameter.
85
+ function printProducts($products)
86
+ {
87
+ $stack = array();
88
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
89
+ foreach ($products as $product)
90
+ {
91
+ // Get associated products for configurable don't print out parent
92
+ if($product->getTypeId() == 'configurable')
93
+ {
94
+ $associatedProducts = $product->getTypeInstance()->getUsedProducts();
95
+ array_push($stack, $associatedProducts);
96
+ }
97
+ else
98
+ {
99
+ echo'<product>';
100
+ //echo '<memory>'.memory_get_usage().'</memory>';
101
+ foreach ($product->getdata() as $key=>$value)
102
+ {
103
+
104
+ if ($key!=='stock_item')
105
+ {
106
+
107
+ $url = $product->getProductUrl();
108
+
109
+ if (($key == 'url_path') || ($key =='url_key'))
110
+ {
111
+ $value = $url;
112
+ $value = str_replace('/intelligentreach_integration.php','',$value);
113
+ $value = trim ($value);
114
+ }
115
+
116
+ if ($key == 'image')
117
+ {
118
+ $value = $baseUrl."media/catalog/product".$value;
119
+ }
120
+
121
+ if ($key == 'thumbnail')
122
+ {
123
+ $value = $baseUrl."media/catalog/product".$value;
124
+ }
125
+
126
+ if ($product->getResource()->getAttribute($key) != null)
127
+ {
128
+ $value = $product->getResource()->getAttribute($key)->getFrontend()->getValue($product);
129
+ }
130
+
131
+ $value = "<![CDATA[$value]]>";
132
+
133
+ $key = str_replace('"','',$key);
134
+
135
+ echo '<'.$key.'>'.$value.'</'.$key.'>';
136
+ }
137
+
138
+ }
139
+
140
+ $categories = $product->getCategoryIds();
141
+
142
+ // echo '<categories>';
143
+
144
+ $output = "";
145
+ $firstCategoryPath = true;
146
+
147
+ foreach($categories as $k => $_category_id)
148
+ {
149
+ if($firstCategoryPath)
150
+ {
151
+ $_category = Mage::getModel('catalog/category')->setStoreId($_GET["storeid"])->load($_category_id);
152
+ $cat_parentCategories = array_reverse($_category->getParentCategories(), true);
153
+ $output = '<category_path><![CDATA[';
154
+
155
+ foreach($cat_parentCategories as $parent)
156
+ {
157
+ if($parent->getName() == end($cat_parentCategories)->getName())
158
+ {
159
+ $output .= $parent->getName();
160
+ }
161
+ else
162
+ {
163
+ $output .= $parent->getName().' > ';
164
+ }
165
+ }
166
+
167
+ $output .= ']]></category_path>';
168
+ $firstCategoryPath = false;
169
+ echo $output;
170
+ }
171
+ }
172
+
173
+ //echo '</categories>';
174
+ //echo '<memory>'.memory_get_usage().'</memory>';
175
+ echo '</product>';
176
+
177
+ $url = $product->getProductUrl();
178
+ // Get associated products for grouped
179
+ if($product->getTypeId() == 'grouped')
180
+ {
181
+ $associatedProductsPush = $product->getTypeInstance(true)->getAssociatedProducts($product);
182
+ array_push($stack, $associatedProductsPush);
183
+ }
184
+ }
185
+ }
186
+ //if the stack isn't empty recursively print the products out
187
+ if(!empty($stack))
188
+ {
189
+ for($i=0; $i<=count($stack);$i++)
190
+ {
191
+ $associatedProductsPop = array_pop($stack);
192
+ printProducts($associatedProductsPop);
193
+ }
194
+ }
195
+ }
196
+
197
+ // If a store id was provided then print the products to the output.
198
+ if(storeIsSelected())
199
+ {
200
+ $page = 1;
201
+ $products = getProducts($page);
202
+ $lastPageNumber = $products->getLastPageNumber();
203
+ if(isset($_GET["splitby"]))
204
+ $splitBy = $_GET["splitby"];
205
+ else
206
+ $splitBy = 100;
207
+ if($lastPageNumber < 10)
208
+ {
209
+ runTheTask($products, $page, $lastPageNumber);
210
+ }
211
+ else
212
+ {
213
+ if(isset($_GET["startingpage"]) && isset($_GET["endpage"]))
214
+ {
215
+ runTheTask($products, $_GET["startingpage"], $_GET["endpage"]);
216
+ }
217
+ else
218
+ {
219
+ $sections = ceil($lastPageNumber / $splitBy);
220
+ echo "<h2>This store has a lot of products so they have been split into ".$sections." sections.</h2>";
221
+ echo "<div class='sections' style='float:left;'>";
222
+ getSections($lastPageNumber, $sections, $splitBy);
223
+ echo "</div>";
224
+ echo "<div class='instructions' style='float:left; padding-left:100px;'>";
225
+ echo "<h3>Instructions</h3>";
226
+ echo "<p>The parameter <strong>'splitby'</strong> in the URL splits pages into sections, each page contains unless specified otherwise the default amount of 100 products.</p>";
227
+ echo "<p>So setting <strong>'splitby'</strong> to equal 100 will bring back 1,000 products per page and 10,000 products per section, if there are 40,000 products in the store then this will return 4 sections. </p>";
228
+ echo "<strong>e.g.</strong> http://www.exampledomain.com/intelligentreach_integration.php?storeid=1&<strong>splitby=100</strong></p>";
229
+ echo "<p>You can also set the value of the number of products per page that is returned, by setting the parameter <strong>'amountofproducts'</strong> in the URL</p>";
230
+ echo "<strong>e.g.</strong> http://www.exampledomain.com/intelligentreach_integration.php?storeid=1&splitby=100&<strong>amountofproducts=100</strong></p>";
231
+ echo "<p><strong>NB:</strong> The default value for <strong>'splitby'</strong> is 100 and for <strong>'amountofproducts'</strong> is 100.</p>";
232
+ echo "</div>";
233
+ }
234
+ }
235
+ }
236
+ else // Give the option to choose the specific store the data will be extracted from.
237
+ {
238
+ echo "<p>Sorry a Store Id was not provided, please choose a store from the options below.</p>";
239
+ getStores();
240
+ echo "<p>If you want to skip this step in the future, you can manually enter the Store Id in the URL.<br />";
241
+ echo "e.g. http://www.exampledomain.com/intelligentreach_integration.php?storeid=1</p>";
242
+ echo "<p><strong>NB:</strong> The Store Id parameter name is case sensitive. Only use \"storeid=\" not another variation.</p>";
243
+ }
244
+ ?>
package.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Intelligent_Reach</name>
4
+ <version>1.0.15</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/OSL-3.0">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This module integrates Magento with the Intelligent Reach platform, enabling product-level online marketing.</summary>
10
+ <description>Intelligent Reach combine a deep understanding of product data with real insight about how consumers behave online. In short, we know how and where to help a brand reach new customers, and that&#x2019;s exactly what we do for our clients.&#xD;
11
+ Delivering the benefits of automated data distribution coupled with actionable insight and creativity, Intelligent Reach help to maximise revenues and profit for any brand.&#xD;
12
+ We work with our customers to create, then optimise their data and dynamically distribute it to over 230 channels. &#xD;
13
+ We help them understand every interaction, across multiple channels and devices, attributing value to drive intelligent growth. Using this actionable insight to have the right product, in the right place at the right time, Increasing revenue streams from new and existing channels or markets. &#xD;
14
+ Our market leading merchant platform allows you to control every element of your campaigns and manage activity automatically at a granular level.&#xD;
15
+ Via tools such as the Network Affiliate Centre, we provide affiliates with innovative yet simple tools, empowering efficiency and engagement. This platform allows merchants to really drive affiliate engagement and take full advantage of publisher networks.&#xD;
16
+ Intelligent reach also offers advanced insight and trading services; whilst ensuring our customers are agile enough to adapt to new opportunities or challenges from the ever changing and increasingly sophisticated consumer. &#xD;
17
+ Contact us to arrange a free E-commerce therapy session. Get advice about e-privacy compliance, tag management, analytics or BI implementations and Data quality as well as any key pain points or challenges which are hampering your growth.</description>
18
+ <notes>Stable release. Compatible with older versions. Feed creation has been optimized to handle larger loads. The option to choose the store is now available. Can retrieve associated products for grouped types.Bug fixes.Has support for PHP V5.2</notes>
19
+ <authors><author><name>Intelligent Reach</name><user>auto-converted</user><email>development@intelligentreach.com</email></author></authors>
20
+ <date>2013-09-12</date>
21
+ <time>11:00:37</time>
22
+ <contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="IntelligentReach_Integration.xml" hash="6cdd19a11572e7073dbb3d746b6b57b6"/></dir></dir><dir name="code"><dir name="local"><dir name="IntelligentReach"><dir name="Integration"><dir name="etc"><file name="config.xml" hash="9f5204d61d6e65bc7f13ccd5e34cafc4"/></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="intelligentreach_integration.xml" hash="27ec74d2cd855aa9929e4ca27bc3bb16"/></dir><dir name="template"><dir name="intelligentreach_integration"><dir name="product"><file name="intelligentreach_integration.phtml" hash="197744f76c7bced3b054576421597dcd"/></dir><dir name="basket"><file name="intelligentreach_integration.phtml" hash="c60e4fa966a829285d4aa3451b2f892c"/></dir><dir name="checkout"><dir name="onepage"><file name="intelligentreach_integration.phtml" hash="15cda55afa12fdf606cb1e67c1f7c562"/></dir><dir name="multishipping"><file name="intelligentreach_integration.phtml" hash="9d7b34fdee46ed02596138ebdb0033ea"/></dir></dir><file name="intelligentreach_integration.phtml" hash="1cc1a973008bfc9c4c37276487307d8a"/></dir></dir></dir></dir><dir name="enterprise"><dir name="default"><dir name="layout"><file name="intelligentreach_integration.xml" hash="27ec74d2cd855aa9929e4ca27bc3bb16"/></dir><dir name="template"><dir name="intelligentreach_integration"><dir name="product"><file name="intelligentreach_integration.phtml" hash="197744f76c7bced3b054576421597dcd"/></dir><dir name="basket"><file name="intelligentreach_integration.phtml" hash="c60e4fa966a829285d4aa3451b2f892c"/></dir><dir name="checkout"><dir name="onepage"><file name="intelligentreach_integration.phtml" hash="15cda55afa12fdf606cb1e67c1f7c562"/></dir><dir name="multishipping"><file name="intelligentreach_integration.phtml" hash="9d7b34fdee46ed02596138ebdb0033ea"/></dir></dir><file name="intelligentreach_integration.phtml" hash="1cc1a973008bfc9c4c37276487307d8a"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="intelligentreach_integration.xml" hash="27ec74d2cd855aa9929e4ca27bc3bb16"/></dir><dir name="template"><dir name="intelligentreach_integration"><dir name="product"><file name="intelligentreach_integration.phtml" hash="197744f76c7bced3b054576421597dcd"/></dir><dir name="basket"><file name="intelligentreach_integration.phtml" hash="c60e4fa966a829285d4aa3451b2f892c"/></dir><dir name="checkout"><dir name="onepage"><file name="intelligentreach_integration.phtml" hash="15cda55afa12fdf606cb1e67c1f7c562"/></dir><dir name="multishipping"><file name="intelligentreach_integration.phtml" hash="9d7b34fdee46ed02596138ebdb0033ea"/></dir></dir><file name="intelligentreach_integration.phtml" hash="1cc1a973008bfc9c4c37276487307d8a"/></dir></dir></dir></dir></dir></dir></dir><dir name="."><file name="intelligentreach_integration.php" hash="1957b0d1e7808f3700d9e1158055510b"/></dir></target></contents>
23
+ <compatible/>
24
+ <dependencies/>
25
+ </package>