Version Notes
Fixed caching issue for Magento Enterprise Edition.
Download this release
Release Info
Developer | HiConversion |
Extension | Hic_Integration |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.1.0
- app/code/community/Hic/Integration/Block/Html/Head.php +0 -43
- app/code/community/Hic/Integration/Block/Tag.php +30 -0
- app/code/community/Hic/Integration/Block/Template.php +0 -31
- app/code/community/Hic/Integration/Helper/Data.php +19 -3
- app/code/community/Hic/Integration/Model/Container/{Template.php → Cache.php} +66 -57
- app/code/community/Hic/Integration/Model/Data.php +59 -52
- app/code/community/Hic/Integration/Model/Observer.php +66 -0
- app/code/community/Hic/Integration/etc/cache.xml +11 -10
- app/code/community/Hic/Integration/etc/config.xml +20 -7
- app/design/frontend/base/default/layout/hic/hiconversion.xml +2 -2
- app/design/frontend/base/default/template/hic/head.phtml +26 -28
- package.xml +5 -5
app/code/community/Hic/Integration/Block/Html/Head.php
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* HiConversion
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* [http://opensource.org/licenses/MIT]
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* @category Hic
|
16 |
-
* @package Hic_Integration
|
17 |
-
* @Copyright © 2015 HiConversion, Inc. All rights reserved.
|
18 |
-
* @license [http://opensource.org/licenses/MIT] MIT License
|
19 |
-
*/
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Integration html head block
|
23 |
-
*
|
24 |
-
* @category Hic
|
25 |
-
* @package Integration
|
26 |
-
* @author HiConversion <support@hiconversion.com>
|
27 |
-
*/
|
28 |
-
class Hic_Integration_Block_Html_Head extends Mage_Page_Block_Html_Head
|
29 |
-
{
|
30 |
-
/**
|
31 |
-
* Prepends HiC header template to head.
|
32 |
-
*
|
33 |
-
* @params string
|
34 |
-
* @return string
|
35 |
-
*/
|
36 |
-
protected function _afterToHtml($html)
|
37 |
-
{
|
38 |
-
// prepend Hic block output
|
39 |
-
$block = Mage::app()->getLayout()->createBlock('integration/template','hiconversion.head.tag');
|
40 |
-
$block->setTemplate('hic/head.phtml');
|
41 |
-
return $block->toHtml() . $html;
|
42 |
-
}
|
43 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Hic/Integration/Block/Tag.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* HiConversion
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* [http://opensource.org/licenses/MIT]
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Hic
|
16 |
+
* @package Hic_Integration
|
17 |
+
* @Copyright © 2015 HiConversion, Inc. All rights reserved.
|
18 |
+
* @license [http://opensource.org/licenses/MIT] MIT License
|
19 |
+
*/
|
20 |
+
/**
|
21 |
+
* Integration Head Block
|
22 |
+
*
|
23 |
+
* @category Hic
|
24 |
+
* @package Integration
|
25 |
+
* @author HiConversion <support@hiconversion.com>
|
26 |
+
*/
|
27 |
+
class Hic_Integration_Block_Tag extends Mage_Core_Block_Template
|
28 |
+
{
|
29 |
+
|
30 |
+
}
|
app/code/community/Hic/Integration/Block/Template.php
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* HiConversion
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* [http://opensource.org/licenses/MIT]
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* @category Hic
|
16 |
-
* @package Hic_Integration
|
17 |
-
* @Copyright © 2015 HiConversion, Inc. All rights reserved.
|
18 |
-
* @license [http://opensource.org/licenses/MIT] MIT License
|
19 |
-
*/
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Integration template block
|
23 |
-
*
|
24 |
-
* @category Hic
|
25 |
-
* @package Integration
|
26 |
-
* @author HiConversion <support@hiconversion.com>
|
27 |
-
*/
|
28 |
-
class Hic_Integration_Block_Template extends Mage_Core_Block_Template
|
29 |
-
{
|
30 |
-
|
31 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Hic/Integration/Helper/Data.php
CHANGED
@@ -30,6 +30,7 @@ class Hic_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
30 |
const SETTINGS_ENABLED = 'integration/settings/enabled';
|
31 |
const SETTINGS_ENABLED_2 = 'integration/settings/enabled_2';
|
32 |
const SETTINGS_SITE_ID = 'integration/settings/site_id';
|
|
|
33 |
|
34 |
/**
|
35 |
* Returns Site ID from Configuration
|
@@ -66,9 +67,15 @@ class Hic_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
66 |
*
|
67 |
* @return object
|
68 |
*/
|
69 |
-
public function
|
70 |
{
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
|
74 |
/**
|
@@ -82,6 +89,16 @@ class Hic_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
82 |
return $route;
|
83 |
}
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
/**
|
86 |
* Determines if its a product page or not
|
87 |
*
|
@@ -102,5 +119,4 @@ class Hic_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
102 |
$request = Mage::app()->getRequest();
|
103 |
return false !== strpos($request->getRouteName(), 'checkout') && 'success' == $request->getActionName();
|
104 |
}
|
105 |
-
|
106 |
}
|
30 |
const SETTINGS_ENABLED = 'integration/settings/enabled';
|
31 |
const SETTINGS_ENABLED_2 = 'integration/settings/enabled_2';
|
32 |
const SETTINGS_SITE_ID = 'integration/settings/site_id';
|
33 |
+
const EXTENSION_VERSION = '1.1.0';
|
34 |
|
35 |
/**
|
36 |
* Returns Site ID from Configuration
|
67 |
*
|
68 |
* @return object
|
69 |
*/
|
70 |
+
public function hicData()
|
71 |
{
|
72 |
+
$model = Mage::getModel('integration/data');
|
73 |
+
$data = $model->toArray(array('page', 'cart', 'user','tr','version','platform','pid','product'));
|
74 |
+
$data = array_filter($data);
|
75 |
+
$obj = new Varien_Object($data);
|
76 |
+
if ($obj && $data) {
|
77 |
+
return Zend_Json::encode($obj->getData());
|
78 |
+
}
|
79 |
}
|
80 |
|
81 |
/**
|
89 |
return $route;
|
90 |
}
|
91 |
|
92 |
+
/**
|
93 |
+
* Return extension version
|
94 |
+
*
|
95 |
+
* @return string
|
96 |
+
*/
|
97 |
+
public function getVersion()
|
98 |
+
{
|
99 |
+
return self::EXTENSION_VERSION;
|
100 |
+
}
|
101 |
+
|
102 |
/**
|
103 |
* Determines if its a product page or not
|
104 |
*
|
119 |
$request = Mage::app()->getRequest();
|
120 |
return false !== strpos($request->getRouteName(), 'checkout') && 'success' == $request->getActionName();
|
121 |
}
|
|
|
122 |
}
|
app/code/community/Hic/Integration/Model/Container/{Template.php → Cache.php}
RENAMED
@@ -1,58 +1,67 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* HiConversion
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* [http://opensource.org/licenses/MIT]
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* @category Hic
|
16 |
-
* @package Hic_Integration
|
17 |
-
* @Copyright © 2015 HiConversion, Inc. All rights reserved.
|
18 |
-
* @license [http://opensource.org/licenses/MIT] MIT License
|
19 |
-
*/
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Integration container
|
23 |
-
*
|
24 |
-
* @category Hic
|
25 |
-
* @package Integration
|
26 |
-
* @author HiConversion <support@hiconversion.com>
|
27 |
-
*/
|
28 |
-
class
|
29 |
-
{
|
30 |
-
/**
|
31 |
-
*
|
32 |
-
*
|
33 |
-
* @return string
|
34 |
-
*/
|
35 |
-
protected function
|
36 |
-
{
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* HiConversion
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* [http://opensource.org/licenses/MIT]
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Hic
|
16 |
+
* @package Hic_Integration
|
17 |
+
* @Copyright © 2015 HiConversion, Inc. All rights reserved.
|
18 |
+
* @license [http://opensource.org/licenses/MIT] MIT License
|
19 |
+
*/
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Integration container to hole-punch
|
23 |
+
*
|
24 |
+
* @category Hic
|
25 |
+
* @package Integration
|
26 |
+
* @author HiConversion <support@hiconversion.com>
|
27 |
+
*/
|
28 |
+
class Hic_Integration_Model_Container_Cache extends Enterprise_PageCache_Model_Container_Abstract
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* Get container individual cache id
|
32 |
+
*
|
33 |
+
* @return string
|
34 |
+
*/
|
35 |
+
protected function _getCacheId()
|
36 |
+
{
|
37 |
+
return 'HICONVERSION' . md5($this->_placeholder->getAttribute('cache_id')) . '_' . $this->_getCookieValue(Enterprise_PageCache_Model_Cookie::COOKIE_CUSTOMER, '');
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Render block content
|
42 |
+
*
|
43 |
+
* @return mixed
|
44 |
+
*/
|
45 |
+
protected function _renderBlock()
|
46 |
+
{
|
47 |
+
$blockClass = $this->_placeholder->getAttribute('block');
|
48 |
+
$template = $this->_placeholder->getAttribute('template');
|
49 |
+
$block = new $blockClass;
|
50 |
+
$block->setTemplate($template);
|
51 |
+
return $block->toHtml();
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Save cache
|
56 |
+
*
|
57 |
+
* @param string $data
|
58 |
+
* @param string $id
|
59 |
+
* @param array $tags
|
60 |
+
* @param null $lifetime
|
61 |
+
* @return bool
|
62 |
+
*/
|
63 |
+
protected function _saveCache($data, $id, $tags = array(), $lifetime = null)
|
64 |
+
{
|
65 |
+
return false;
|
66 |
+
}
|
67 |
}
|
app/code/community/Hic/Integration/Model/Data.php
CHANGED
@@ -52,49 +52,49 @@ class Hic_Integration_Model_Data extends Varien_Object
|
|
52 |
}
|
53 |
}
|
54 |
|
55 |
-
/**
|
56 |
-
* Return JSON string representing data object
|
57 |
-
*
|
58 |
-
* @return string
|
59 |
-
*/
|
60 |
-
public function hicData()
|
61 |
-
{
|
62 |
-
$data = $this->toArray(array('page', 'cart', 'user','tr','version','platform','pid','product'));
|
63 |
-
$data = array_filter($data);
|
64 |
-
$obj = new Varien_Object($data);
|
65 |
-
if ($obj && $data) {
|
66 |
-
return Zend_Json::encode($obj->getData());
|
67 |
-
}
|
68 |
-
}
|
69 |
-
|
70 |
/**
|
71 |
* Returns product information for each product
|
72 |
* passed into function
|
73 |
*
|
74 |
-
* @param $items
|
75 |
-
* @return array
|
76 |
*/
|
77 |
protected function _getCartItems($items)
|
78 |
{
|
79 |
$data = array();
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
return $data;
|
100 |
}
|
@@ -110,10 +110,12 @@ class Hic_Integration_Model_Data extends Varien_Object
|
|
110 |
foreach (Mage::helper('catalog')->getBreadcrumbPath() as $item) {
|
111 |
$crumb[] = $item['label'];
|
112 |
}
|
113 |
-
$this->setPage(
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
117 |
return $this;
|
118 |
}
|
119 |
|
@@ -124,25 +126,26 @@ class Hic_Integration_Model_Data extends Varien_Object
|
|
124 |
*/
|
125 |
protected function _initCart()
|
126 |
{
|
127 |
-
$cart = Mage::getModel('checkout/cart')
|
128 |
-
|
|
|
129 |
$data = array();
|
130 |
-
if ($
|
131 |
-
$data['id'] = (string)$
|
132 |
}
|
133 |
-
if ($
|
134 |
-
$data['st'] = (float)$
|
135 |
}
|
136 |
-
if ($
|
137 |
-
$data['tt'] = (float)$
|
138 |
}
|
139 |
-
if ($
|
140 |
-
$data['qt'] = (float)$
|
141 |
}
|
142 |
if (Mage::app()->getStore()->getCurrentCurrencyCode()) {
|
143 |
$data['cu'] = Mage::app()->getStore()->getCurrentCurrencyCode();
|
144 |
}
|
145 |
-
$data['li'] = $this->_getCartItems($
|
146 |
$this->setCart($data);
|
147 |
return $this;
|
148 |
}
|
@@ -163,12 +166,11 @@ class Hic_Integration_Model_Data extends Varien_Object
|
|
163 |
$data['ht'] = false;
|
164 |
$data['nv'] = true;
|
165 |
$data['cg'] = Mage::getSingleton('customer/session')->getCustomerGroupId();
|
166 |
-
$data['sid'] = Mage::getSingleton("core/session")->getEncryptedSessionId();
|
167 |
if ($customer->getId()) {
|
168 |
// Determine if customer has transacted or not. Must be logged in.
|
169 |
$orders = Mage::getModel('sales/order')->getCollection();
|
170 |
-
$orders->addAttributeToFilter('customer_id'
|
171 |
-
if ($orders){
|
172 |
$data['ht'] = $orders->getSize() > 0;
|
173 |
}
|
174 |
if ($customer->getDob()) {
|
@@ -255,6 +257,11 @@ class Hic_Integration_Model_Data extends Varien_Object
|
|
255 |
}
|
256 |
}
|
257 |
|
|
|
|
|
|
|
|
|
|
|
258 |
protected function helper()
|
259 |
{
|
260 |
return Mage::helper('integration');
|
52 |
}
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
/**
|
56 |
* Returns product information for each product
|
57 |
* passed into function
|
58 |
*
|
59 |
+
* @param array $items
|
60 |
+
* @return array $data
|
61 |
*/
|
62 |
protected function _getCartItems($items)
|
63 |
{
|
64 |
$data = array();
|
65 |
+
|
66 |
+
// build list of product IDs from either cart or transaction object.
|
67 |
+
$productIds = array();
|
68 |
+
foreach ($items as $item) {
|
69 |
+
$productIds[] = $item->getProduct()->getId();
|
70 |
+
}
|
71 |
+
|
72 |
+
// request item information from product collection catalog
|
73 |
+
$collection = Mage::getResourceModel('catalog/product_collection')
|
74 |
+
->addFieldToFilter('entity_id', array('in' => $productIds ) )
|
75 |
+
->addAttributeToSelect(array('name','description'));
|
76 |
+
$count = 0;
|
77 |
+
|
78 |
+
// TODO: Swap Description for ShortDescription
|
79 |
+
foreach ($collection as $product) {
|
80 |
+
$info = array();
|
81 |
+
$info['ds'] = (float)$items[$count]->getDiscountAmount();
|
82 |
+
$info['tx'] = (float)$items[$count]->getTaxAmount();
|
83 |
+
$info['qt'] = (float)$items[$count]->getQty();
|
84 |
+
$info['pr'] = (float)$items[$count]->getRowTotalInclTax();
|
85 |
+
$info['bpr'] = (float)$items[$count]->getPrice();
|
86 |
+
if ( $this->helper()->isConfirmation()) {
|
87 |
+
$info['qt'] = (float)$items[$count]->getQtyOrdered();
|
88 |
}
|
89 |
+
$info['desc'] = strip_tags($product->getDescription());
|
90 |
+
$info['id'] = $product->getId();
|
91 |
+
$info['url'] = $product->getProductUrl();
|
92 |
+
$info['nm'] = $product->getName();
|
93 |
+
$info['img'] = $product->getImageUrl();
|
94 |
+
$info['sku'] = $product->getSku();
|
95 |
+
$info['cat'] = $product->getCategoryIds();
|
96 |
+
$data[] = $info;
|
97 |
+
$count = $count + 1;
|
98 |
}
|
99 |
return $data;
|
100 |
}
|
110 |
foreach (Mage::helper('catalog')->getBreadcrumbPath() as $item) {
|
111 |
$crumb[] = $item['label'];
|
112 |
}
|
113 |
+
$this->setPage(
|
114 |
+
array(
|
115 |
+
'route' => $this->helper()->getRoute(),
|
116 |
+
'bc' => $crumb
|
117 |
+
)
|
118 |
+
);
|
119 |
return $this;
|
120 |
}
|
121 |
|
126 |
*/
|
127 |
protected function _initCart()
|
128 |
{
|
129 |
+
$cart = Mage::getModel('checkout/cart');
|
130 |
+
$cartQuote = $cart->getQuote();
|
131 |
+
if ($cartQuote->getItemsCount() > 0) {
|
132 |
$data = array();
|
133 |
+
if ($cartQuote->getId()) {
|
134 |
+
$data['id'] = (string)$cartQuote->getId();
|
135 |
}
|
136 |
+
if ($cartQuote->getSubtotal()) {
|
137 |
+
$data['st'] = (float)$cartQuote->getSubtotal();
|
138 |
}
|
139 |
+
if ($cartQuote->getGrandTotal()) {
|
140 |
+
$data['tt'] = (float)$cartQuote->getGrandTotal();
|
141 |
}
|
142 |
+
if ($cartQuote->getItemsCount()) {
|
143 |
+
$data['qt'] = (float)$cartQuote->getItemsCount();
|
144 |
}
|
145 |
if (Mage::app()->getStore()->getCurrentCurrencyCode()) {
|
146 |
$data['cu'] = Mage::app()->getStore()->getCurrentCurrencyCode();
|
147 |
}
|
148 |
+
$data['li'] = $this->_getCartItems($cartQuote->getAllVisibleItems());
|
149 |
$this->setCart($data);
|
150 |
return $this;
|
151 |
}
|
166 |
$data['ht'] = false;
|
167 |
$data['nv'] = true;
|
168 |
$data['cg'] = Mage::getSingleton('customer/session')->getCustomerGroupId();
|
|
|
169 |
if ($customer->getId()) {
|
170 |
// Determine if customer has transacted or not. Must be logged in.
|
171 |
$orders = Mage::getModel('sales/order')->getCollection();
|
172 |
+
$orders->addAttributeToFilter('customer_id', $customer->getId());
|
173 |
+
if ($orders) {
|
174 |
$data['ht'] = $orders->getSize() > 0;
|
175 |
}
|
176 |
if ($customer->getDob()) {
|
257 |
}
|
258 |
}
|
259 |
|
260 |
+
/**
|
261 |
+
* Helper reference
|
262 |
+
*
|
263 |
+
* @return Mage_Core_Helper_Abstract
|
264 |
+
*/
|
265 |
protected function helper()
|
266 |
{
|
267 |
return Mage::helper('integration');
|
app/code/community/Hic/Integration/Model/Observer.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* HiConversion
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* [http://opensource.org/licenses/MIT]
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Hic
|
16 |
+
* @package Hic_Integration
|
17 |
+
* @Copyright © 2015 HiConversion, Inc. All rights reserved.
|
18 |
+
* @license [http://opensource.org/licenses/MIT] MIT License
|
19 |
+
*/
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Integration observer model
|
23 |
+
*
|
24 |
+
* @category Hic
|
25 |
+
* @package Integration
|
26 |
+
* @author HiConversion <support@hiconversion.com>
|
27 |
+
*/
|
28 |
+
class Hic_Integration_Model_Observer
|
29 |
+
{
|
30 |
+
protected static $isHead = FALSE;
|
31 |
+
protected static $isRendered = FALSE;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Check 'controller_action_layout_render_before' event response
|
35 |
+
* type to determine if it is a HTML page response
|
36 |
+
*/
|
37 |
+
public function checkResponseType()
|
38 |
+
{
|
39 |
+
if (Mage::app()->getLayout()->getBlock('head')) {
|
40 |
+
self::$isHead = TRUE;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Intercept 'controller_action_postdispatch' event response
|
46 |
+
* to inject block at top of head
|
47 |
+
*
|
48 |
+
* @param Varien_Event_Observer $observer
|
49 |
+
*/
|
50 |
+
public function interceptResponse(Varien_Event_Observer $observer)
|
51 |
+
{
|
52 |
+
if (self::$isHead && !self::$isRendered) {
|
53 |
+
$layout = Mage::getSingleton('core/layout');
|
54 |
+
$tag = $layout->createBlock('integration/tag', 'hic.integration.tag')->setTemplate('hic/head.phtml')->toHtml();
|
55 |
+
$response = $observer->getEvent()->getControllerAction()->getResponse();
|
56 |
+
// TODO: Will this always be <HEAD>
|
57 |
+
$openHeadTag = '<head>';
|
58 |
+
$pos = strpos($response, $openHeadTag);
|
59 |
+
if ($pos !== false && $layout && $tag && $response) {
|
60 |
+
$newStr = substr_replace($response, $tag, $pos + strlen($openHeadTag), 0);
|
61 |
+
$response->setBody($newStr);
|
62 |
+
self::$isRendered = TRUE;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
app/code/community/Hic/Integration/etc/cache.xml
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<placeholders>
|
4 |
-
<
|
5 |
-
<block>integration/
|
6 |
-
<
|
7 |
-
<
|
8 |
-
<
|
9 |
-
|
10 |
-
|
|
|
11 |
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<placeholders>
|
4 |
+
<integration>
|
5 |
+
<block>integration/tag</block>
|
6 |
+
<name>hic.integration.tag</name>
|
7 |
+
<placeholder>HICONVERSION</placeholder>
|
8 |
+
<container>Hic_Integration_Model_Container_Cache</container>
|
9 |
+
<cache_lifetime>86400</cache_lifetime>
|
10 |
+
</integration>
|
11 |
+
</placeholders>
|
12 |
</config>
|
app/code/community/Hic/Integration/etc/config.xml
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
-
<
|
5 |
<version>1.0</version>
|
6 |
-
</
|
7 |
</modules>
|
8 |
<global>
|
9 |
<models>
|
@@ -17,17 +17,30 @@
|
|
17 |
</integration>
|
18 |
</helpers>
|
19 |
<blocks>
|
20 |
-
<page>
|
21 |
-
<rewrite>
|
22 |
-
<html_head>Hic_Integration_Block_Html_Head</html_head>
|
23 |
-
</rewrite>
|
24 |
-
</page>
|
25 |
<integration>
|
26 |
<class>Hic_Integration_Block</class>
|
27 |
</integration>
|
28 |
</blocks>
|
29 |
</global>
|
30 |
<frontend>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
<layout>
|
32 |
<updates>
|
33 |
<integration>
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
+
<Hic_Integration>
|
5 |
<version>1.0</version>
|
6 |
+
</Hic_Integration>
|
7 |
</modules>
|
8 |
<global>
|
9 |
<models>
|
17 |
</integration>
|
18 |
</helpers>
|
19 |
<blocks>
|
|
|
|
|
|
|
|
|
|
|
20 |
<integration>
|
21 |
<class>Hic_Integration_Block</class>
|
22 |
</integration>
|
23 |
</blocks>
|
24 |
</global>
|
25 |
<frontend>
|
26 |
+
<events>
|
27 |
+
<controller_action_postdispatch>
|
28 |
+
<observers>
|
29 |
+
<integration_intercept_response>
|
30 |
+
<class>integration/observer</class>
|
31 |
+
<method>interceptResponse</method>
|
32 |
+
</integration_intercept_response>
|
33 |
+
</observers>
|
34 |
+
</controller_action_postdispatch>
|
35 |
+
<controller_action_layout_render_before>
|
36 |
+
<observers>
|
37 |
+
<integration_check_response>
|
38 |
+
<class>integration/observer</class>
|
39 |
+
<method>checkResponseType</method>
|
40 |
+
</integration_check_response>
|
41 |
+
</observers>
|
42 |
+
</controller_action_layout_render_before>
|
43 |
+
</events>
|
44 |
<layout>
|
45 |
<updates>
|
46 |
<integration>
|
app/design/frontend/base/default/layout/hic/hiconversion.xml
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<layout version="
|
3 |
<default>
|
4 |
<reference name="before_body_end">
|
5 |
-
<block type="core/template" name="
|
6 |
</reference>
|
7 |
</default>
|
8 |
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<layout version="1.1.0">
|
3 |
<default>
|
4 |
<reference name="before_body_end">
|
5 |
+
<block type="core/template" name="hic.integration.body" template="hic/body.phtml"/>
|
6 |
</reference>
|
7 |
</default>
|
8 |
</layout>
|
app/design/frontend/base/default/template/hic/head.phtml
CHANGED
@@ -19,12 +19,17 @@
|
|
19 |
*/
|
20 |
|
21 |
$helper = $this->helper('integration');
|
22 |
-
$hic_data = $helper->
|
|
|
23 |
?>
|
24 |
<?php if($helper->isEnabled()):?>
|
25 |
|
26 |
-
|
|
|
|
|
27 |
try {
|
|
|
|
|
28 |
var script = document.createElement("script");
|
29 |
script.id = "hiconversion_30";
|
30 |
script.async = "async";
|
@@ -37,31 +42,24 @@ $hic_data = $helper->getHicData();
|
|
37 |
} catch (e) {
|
38 |
|
39 |
}
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
if (nodes.length > 0) {
|
60 |
-
nodes[0].parentNode.insertBefore(script, nodes[0]);
|
61 |
-
}
|
62 |
-
}
|
63 |
-
hiconversion_head_load();
|
64 |
-
</script>
|
65 |
-
|
66 |
<?php endif;?>
|
67 |
<?php endif; ?>
|
19 |
*/
|
20 |
|
21 |
$helper = $this->helper('integration');
|
22 |
+
$hic_data = $helper->hicData();
|
23 |
+
|
24 |
?>
|
25 |
<?php if($helper->isEnabled()):?>
|
26 |
|
27 |
+
<script type="text/javascript">
|
28 |
+
var __hic = __hic || {};
|
29 |
+
(function(){
|
30 |
try {
|
31 |
+
__hic.version = "1.1.0";
|
32 |
+
__hic.data = <?php echo $hic_data; ?>;
|
33 |
var script = document.createElement("script");
|
34 |
script.id = "hiconversion_30";
|
35 |
script.async = "async";
|
42 |
} catch (e) {
|
43 |
|
44 |
}
|
45 |
+
})();
|
46 |
+
</script>
|
47 |
+
<?php if ($helper->isEnabled2()) : ?>
|
48 |
+
<script id="hiconversion_head_script" type="text/javascript">
|
49 |
+
var hiconversion_load = new Date();
|
50 |
+
function hiconversion_head_load() {
|
51 |
+
var external = "";
|
52 |
+
var script = document.createElement("script");
|
53 |
+
script.id = "hiconversion_head_include";
|
54 |
+
script.async = "async";
|
55 |
+
script.type = "text/javascript";
|
56 |
+
script.src = (document.location.protocol == "https:" ? "https://ssl" : "http://update") + ".hiconversion.com/app/update?async=true&external=" + external + "&version=2.0";
|
57 |
+
var nodes = document.getElementsByTagName("script");
|
58 |
+
if (nodes.length > 0) {
|
59 |
+
nodes[0].parentNode.insertBefore(script, nodes[0]);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
hiconversion_head_load();
|
63 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
<?php endif;?>
|
65 |
<?php endif; ?>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Hic_Integration</name>
|
4 |
-
<version>1.0
|
5 |
<stability>stable</stability>
|
6 |
<license>MIT</license>
|
7 |
<channel>community</channel>
|
@@ -12,11 +12,11 @@
|
|
12 |
Data Capture: We productized our knowledge about the types of data collected by the most advanced web analytics solutions deployed on Magento stores. We then created an extension that provides solid data collection right out-of-the-box. There is no need for any additional custom tagging of your site. All other custom events and metric tracking is provisioned through our application interface. 
|
13 |

|
14 |
Customer Experience Optimization: The second role for the extension is to enable client-side testing, targeting, personalization, and customer experience optimization. To minimize technical complexity and IT dependency, we provide a visual designer tool that enables you to visually provision your optimization campaigns. The visual designs are then translated into lines of code that are transparently executed by the visitor’s browser during the web page rendering process.</description>
|
15 |
-
<notes>
|
16 |
<authors><author><name>HiConversion</name><user>hiconversion</user><email>dhenrickson@hiconversion.com</email></author></authors>
|
17 |
-
<date>2015-
|
18 |
-
<time>
|
19 |
-
<contents><target name="magecommunity"><dir name="Hic"><dir name="Integration"><dir name="Block"><
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.2.6</min><max>5.6.7</max></php></required></dependencies>
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Hic_Integration</name>
|
4 |
+
<version>1.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>MIT</license>
|
7 |
<channel>community</channel>
|
12 |
Data Capture: We productized our knowledge about the types of data collected by the most advanced web analytics solutions deployed on Magento stores. We then created an extension that provides solid data collection right out-of-the-box. There is no need for any additional custom tagging of your site. All other custom events and metric tracking is provisioned through our application interface. 
|
13 |

|
14 |
Customer Experience Optimization: The second role for the extension is to enable client-side testing, targeting, personalization, and customer experience optimization. To minimize technical complexity and IT dependency, we provide a visual designer tool that enables you to visually provision your optimization campaigns. The visual designs are then translated into lines of code that are transparently executed by the visitor’s browser during the web page rendering process.</description>
|
15 |
+
<notes>Fixed caching issue for Magento Enterprise Edition.</notes>
|
16 |
<authors><author><name>HiConversion</name><user>hiconversion</user><email>dhenrickson@hiconversion.com</email></author></authors>
|
17 |
+
<date>2015-05-22</date>
|
18 |
+
<time>14:57:51</time>
|
19 |
+
<contents><target name="magecommunity"><dir name="Hic"><dir name="Integration"><dir name="Block"><file name="Tag.php" hash="7abd791499fb778faa055acb74a91507"/></dir><dir name="Helper"><file name="Data.php" hash="70dfdd14ae0306962a6e965d5fafece0"/></dir><file name="LICENSE.txt" hash="3b58e20f0b691c258d39cc034c5376eb"/><dir name="Model"><dir name="Container"><file name="Cache.php" hash="9902c2c467687268479dae1835dc6ee6"/></dir><file name="Data.php" hash="3a0ae0a6f7f741bd5dd92e7ecb8ad1e8"/><file name="Observer.php" hash="7b14ce1d8dc3df4cb2c8f0462b2f0431"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f122c26dfe576f4c09f83abe76424931"/><file name="cache.xml" hash="e19b0ad039f1d832e0710f887281adc4"/><file name="config.xml" hash="fdad0f87a0a55d11b769d94d18c37062"/><file name="system.xml" hash="62129b4db99b2ffcc698c68f89712ad1"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="hic"><file name="hiconversion.xml" hash="05531c3232369fdfa0d285d5f0982420"/></dir></dir><dir name="template"><dir name="hic"><file name="body.phtml" hash="a337202d1f589d299392a3dc6a3da4e3"/><file name="head.phtml" hash="5c40d8cf5e444bfd57086a5323673123"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Hic_Integration.xml" hash="94fd9568fa202ad3d4773331e46d88c2"/></dir></target></contents>
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.2.6</min><max>5.6.7</max></php></required></dependencies>
|
22 |
</package>
|