Version Notes
-Improved Magento Enterprise Placeholder caching for different levels of data
-Resolved issue with head tag integration
Download this release
Release Info
Developer | HiConversion |
Extension | Hic_Integration |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.1.2
- app/code/community/Hic/Integration/Block/Tag.php +19 -0
- app/code/community/Hic/Integration/Helper/Data.php +33 -58
- app/code/community/Hic/Integration/Model/Container/Cache.php +4 -2
- app/code/community/Hic/Integration/Model/Container/Never.php +67 -0
- app/code/community/Hic/Integration/Model/Container/Page.php +68 -0
- app/code/community/Hic/Integration/Model/Container/Session.php +73 -0
- app/code/community/Hic/Integration/Model/Data.php +65 -47
- app/code/community/Hic/Integration/Model/Observer.php +24 -32
- app/code/community/Hic/Integration/etc/cache.xml +19 -5
- app/code/community/Hic/Integration/etc/config.xml +60 -68
- app/design/frontend/base/default/layout/hic/hiconversion.xml +0 -8
- app/design/frontend/base/default/template/hic/{head.phtml → headAlways.phtml} +66 -64
- app/design/frontend/base/default/template/hic/headNever.phtml +45 -0
- app/design/frontend/base/default/template/hic/headPage.phtml +45 -0
- app/design/frontend/base/default/template/hic/headSession.phtml +45 -0
- package.xml +8 -6
app/code/community/Hic/Integration/Block/Tag.php
CHANGED
@@ -28,4 +28,23 @@
|
|
28 |
class Hic_Integration_Block_Tag extends Mage_Core_Block_Template
|
29 |
{
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
28 |
class Hic_Integration_Block_Tag extends Mage_Core_Block_Template
|
29 |
{
|
30 |
|
31 |
+
/**
|
32 |
+
* add product and category ids to placeholder
|
33 |
+
*
|
34 |
+
* @return array
|
35 |
+
*/
|
36 |
+
public function getCacheKeyInfo()
|
37 |
+
{
|
38 |
+
$info = parent::getCacheKeyInfo();
|
39 |
+
if (Mage::registry('current_product'))
|
40 |
+
{
|
41 |
+
$info['product_id'] = Mage::registry('current_product')->getId();
|
42 |
+
}
|
43 |
+
if (Mage::registry('current_category'))
|
44 |
+
{
|
45 |
+
$info['category_id'] = Mage::registry('current_category')->getId();
|
46 |
+
}
|
47 |
+
return $info;
|
48 |
+
}
|
49 |
+
|
50 |
}
|
app/code/community/Hic/Integration/Helper/Data.php
CHANGED
@@ -30,7 +30,6 @@ 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 |
-
const EXTENSION_VERSION = '1.1.1';
|
34 |
|
35 |
/**
|
36 |
* Returns Site ID from Configuration
|
@@ -63,75 +62,51 @@ class Hic_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
63 |
}
|
64 |
|
65 |
/**
|
66 |
-
* Returns Data
|
67 |
-
*
|
68 |
* @return object
|
69 |
*/
|
70 |
-
public function
|
71 |
{
|
72 |
-
$model = Mage::getModel('integration/data')
|
73 |
-
|
74 |
-
->
|
75 |
-
|
76 |
-
|
77 |
-
'cart',
|
78 |
-
'user',
|
79 |
-
'tr',
|
80 |
-
'version',
|
81 |
-
'platform',
|
82 |
-
'pid',
|
83 |
-
'product')
|
84 |
-
);
|
85 |
-
$data = array_filter($data);
|
86 |
-
$obj = new Varien_Object($data);
|
87 |
-
if ($obj && $data) {
|
88 |
-
return Zend_Json::encode($obj->getData());
|
89 |
-
}
|
90 |
}
|
91 |
-
|
92 |
/**
|
93 |
-
*
|
94 |
-
*
|
95 |
-
* @return
|
96 |
*/
|
97 |
-
public function
|
98 |
{
|
99 |
-
$
|
100 |
-
->
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
104 |
}
|
105 |
-
|
106 |
/**
|
107 |
-
*
|
108 |
-
*
|
109 |
-
* @return
|
110 |
*/
|
111 |
-
public function
|
112 |
{
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
}
|
115 |
|
116 |
-
/**
|
117 |
-
* Determines if its a product page or not
|
118 |
-
*
|
119 |
-
* @return boolean
|
120 |
-
*/
|
121 |
-
public function isProduct()
|
122 |
-
{
|
123 |
-
return 'catalog_product_view' == $this->getRoute();
|
124 |
-
}
|
125 |
|
126 |
-
/**
|
127 |
-
* Determines if Confirmation page or not
|
128 |
-
*
|
129 |
-
* @return boolean
|
130 |
-
*/
|
131 |
-
public function isConfirmation()
|
132 |
-
{
|
133 |
-
$request = Mage::app()->getRequest();
|
134 |
-
return false !== strpos($request->getRouteName(), 'checkout')
|
135 |
-
&& 'success' == $request->getActionName();
|
136 |
-
}
|
137 |
}
|
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
|
62 |
}
|
63 |
|
64 |
/**
|
65 |
+
* Returns Data that can be cached relative to a session
|
66 |
+
* currently cart and user data
|
67 |
* @return object
|
68 |
*/
|
69 |
+
public function hicSessionData()
|
70 |
{
|
71 |
+
$model = Mage::getModel('integration/data')
|
72 |
+
->populateCartData()
|
73 |
+
->populateUserData();
|
74 |
+
|
75 |
+
return $model;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
+
|
78 |
/**
|
79 |
+
* Returns Data that can be cached relative to a page
|
80 |
+
* currently page and product data
|
81 |
+
* @return object
|
82 |
*/
|
83 |
+
public function hicPageData()
|
84 |
{
|
85 |
+
$model = Mage::getModel('integration/data')
|
86 |
+
->populatePageData();
|
87 |
+
|
88 |
+
if ($model->isProduct()) {
|
89 |
+
$model->populateProductData();
|
90 |
+
}
|
91 |
+
|
92 |
+
return $model;
|
93 |
}
|
94 |
+
|
95 |
/**
|
96 |
+
* Returns Data that should never be cached
|
97 |
+
* currently order data
|
98 |
+
* @return object
|
99 |
*/
|
100 |
+
public function hicNeverData()
|
101 |
{
|
102 |
+
$model = Mage::getModel('integration/data');
|
103 |
+
|
104 |
+
if ($model->isConfirmation()) {
|
105 |
+
$model->populateOrderData();
|
106 |
+
}
|
107 |
+
|
108 |
+
return $model;
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
app/code/community/Hic/Integration/Model/Container/Cache.php
CHANGED
@@ -39,11 +39,13 @@ class Hic_Integration_Model_Container_Cache
|
|
39 |
{
|
40 |
$cookieCart = Enterprise_PageCache_Model_Cookie::COOKIE_CART;
|
41 |
$cookieCustomer = Enterprise_PageCache_Model_Cookie::COOKIE_CUSTOMER;
|
42 |
-
return md5(
|
|
|
43 |
. (array_key_exists($cookieCart, $_COOKIE)
|
44 |
? $_COOKIE[$cookieCart] : '')
|
45 |
. (array_key_exists($cookieCustomer, $_COOKIE)
|
46 |
-
? $_COOKIE[$cookieCustomer] : '')
|
|
|
47 |
}
|
48 |
|
49 |
/**
|
39 |
{
|
40 |
$cookieCart = Enterprise_PageCache_Model_Cookie::COOKIE_CART;
|
41 |
$cookieCustomer = Enterprise_PageCache_Model_Cookie::COOKIE_CUSTOMER;
|
42 |
+
return md5(
|
43 |
+
Hic_Integration_Model_Container_Cache::CACHE_TAG_PREFIX
|
44 |
. (array_key_exists($cookieCart, $_COOKIE)
|
45 |
? $_COOKIE[$cookieCart] : '')
|
46 |
. (array_key_exists($cookieCustomer, $_COOKIE)
|
47 |
+
? $_COOKIE[$cookieCustomer] : '')
|
48 |
+
);
|
49 |
}
|
50 |
|
51 |
/**
|
app/code/community/Hic/Integration/Model/Container/Never.php
ADDED
@@ -0,0 +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 which should never cache
|
23 |
+
*
|
24 |
+
* @category Hic
|
25 |
+
* @package Integration
|
26 |
+
* @author HiConversion <support@hiconversion.com>
|
27 |
+
*/
|
28 |
+
class Hic_Integration_Model_Container_Never
|
29 |
+
extends Enterprise_PageCache_Model_Container_Abstract
|
30 |
+
{
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Returns Cache ID
|
34 |
+
*
|
35 |
+
* @return string
|
36 |
+
*/
|
37 |
+
protected function _getCacheId()
|
38 |
+
{
|
39 |
+
return $this->_placeholder->getAttribute('cache_id');
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Render block content
|
44 |
+
*
|
45 |
+
* @return mixed
|
46 |
+
*/
|
47 |
+
protected function _renderBlock()
|
48 |
+
{
|
49 |
+
$blockClass = $this->_placeholder->getAttribute('block');
|
50 |
+
$template = $this->_placeholder->getAttribute('template');
|
51 |
+
$block = new $blockClass;
|
52 |
+
$block->setTemplate($template);
|
53 |
+
return $block->toHtml();
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @param string $data
|
58 |
+
* @param string $id
|
59 |
+
* @param array $tags
|
60 |
+
* @param null $lifetime
|
61 |
+
* @return bool|Enterprise_PageCache_Model_Container_Abstract
|
62 |
+
*/
|
63 |
+
protected function _saveCache($data, $id, $tags = array(), $lifetime = null)
|
64 |
+
{
|
65 |
+
return false;
|
66 |
+
}
|
67 |
+
}
|
app/code/community/Hic/Integration/Model/Container/Page.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 which should cache as long as page hasn't changed
|
23 |
+
*
|
24 |
+
* @category Hic
|
25 |
+
* @package Integration
|
26 |
+
* @author HiConversion <support@hiconversion.com>
|
27 |
+
*/
|
28 |
+
class Hic_Integration_Model_Container_Page
|
29 |
+
extends Enterprise_PageCache_Model_Container_Abstract
|
30 |
+
{
|
31 |
+
const CACHE_TAG_PREFIX = 'HICONVERSION_INTEGRATION_';
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get cache identifier
|
35 |
+
*
|
36 |
+
* @return string
|
37 |
+
*/
|
38 |
+
protected function _getCacheId()
|
39 |
+
{
|
40 |
+
if ($this->_placeholder->getAttribute('category_id')
|
41 |
+
|| $this->_placeholder->getAttribute('product_id')) {
|
42 |
+
$cacheSubKey = '_' . $this->_placeholder->getAttribute('category_id')
|
43 |
+
. '_' . $this->_placeholder->getAttribute('product_id');
|
44 |
+
} else {
|
45 |
+
$cacheSubKey = $this->_getRequestId();
|
46 |
+
}
|
47 |
+
|
48 |
+
return md5(Hic_Integration_Model_Container_Page::CACHE_TAG_PREFIX
|
49 |
+
. $cacheSubKey);
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Render block content
|
57 |
+
*
|
58 |
+
* @return mixed
|
59 |
+
*/
|
60 |
+
protected function _renderBlock()
|
61 |
+
{
|
62 |
+
$blockClass = $this->_placeholder->getAttribute('block');
|
63 |
+
$template = $this->_placeholder->getAttribute('template');
|
64 |
+
$block = new $blockClass;
|
65 |
+
$block->setTemplate($template);
|
66 |
+
return $block->toHtml();
|
67 |
+
}
|
68 |
+
}
|
app/code/community/Hic/Integration/Model/Container/Session.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 which should cache as long as cart and customer data hasn't changed
|
23 |
+
*
|
24 |
+
* @category Hic
|
25 |
+
* @package Integration
|
26 |
+
* @author HiConversion <support@hiconversion.com>
|
27 |
+
*/
|
28 |
+
class Hic_Integration_Model_Container_Session
|
29 |
+
extends Enterprise_PageCache_Model_Container_Abstract
|
30 |
+
{
|
31 |
+
const CACHE_TAG_PREFIX = 'HICONVERSION_INTEGRATION_';
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get identifier from cookies
|
35 |
+
*
|
36 |
+
* @return string
|
37 |
+
*/
|
38 |
+
public static function getCacheId()
|
39 |
+
{
|
40 |
+
$cookieCart = Enterprise_PageCache_Model_Cookie::COOKIE_CART;
|
41 |
+
$cookieCustomer = Enterprise_PageCache_Model_Cookie::COOKIE_CUSTOMER;
|
42 |
+
return md5(Hic_Integration_Model_Container_Session::CACHE_TAG_PREFIX
|
43 |
+
. (array_key_exists($cookieCart, $_COOKIE)
|
44 |
+
? $_COOKIE[$cookieCart] : '')
|
45 |
+
. (array_key_exists($cookieCustomer, $_COOKIE)
|
46 |
+
? $_COOKIE[$cookieCustomer] : ''));
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Returns Cache ID
|
52 |
+
*
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
protected function _getCacheId()
|
56 |
+
{
|
57 |
+
return Hic_Integration_Model_Container_Session::getCacheId();
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Render block content
|
62 |
+
*
|
63 |
+
* @return mixed
|
64 |
+
*/
|
65 |
+
protected function _renderBlock()
|
66 |
+
{
|
67 |
+
$blockClass = $this->_placeholder->getAttribute('block');
|
68 |
+
$template = $this->_placeholder->getAttribute('template');
|
69 |
+
$block = new $blockClass;
|
70 |
+
$block->setTemplate($template);
|
71 |
+
return $block->toHtml();
|
72 |
+
}
|
73 |
+
}
|
app/code/community/Hic/Integration/Model/Data.php
CHANGED
@@ -27,29 +27,13 @@
|
|
27 |
*/
|
28 |
class Hic_Integration_Model_Data extends Varien_Object
|
29 |
{
|
30 |
-
protected $_version = '1.1';
|
31 |
-
protected $_platform = 'magento';
|
32 |
-
|
33 |
const CATALOG_URL = 'catalog/product/';
|
34 |
-
|
35 |
/**
|
36 |
* Class constructor
|
37 |
*/
|
38 |
protected function _construct()
|
39 |
{
|
40 |
-
$this
|
41 |
-
->setVersion($this->_version)
|
42 |
-
->setPlatform($this->_platform)
|
43 |
-
->setPid($this->helper()->getSiteId())
|
44 |
-
->_initPage()
|
45 |
-
->_initUser()
|
46 |
-
->_initCart();
|
47 |
-
if ($this->helper()->isProduct()) {
|
48 |
-
$this->_initProduct();
|
49 |
-
}
|
50 |
-
if ($this->helper()->isConfirmation()) {
|
51 |
-
$this->_initOrder();
|
52 |
-
}
|
53 |
}
|
54 |
|
55 |
/**
|
@@ -57,9 +41,10 @@ class Hic_Integration_Model_Data extends Varien_Object
|
|
57 |
* passed into function
|
58 |
*
|
59 |
* @param array $items
|
|
|
60 |
* @return array $data
|
61 |
*/
|
62 |
-
protected function _getCartItems($items)
|
63 |
{
|
64 |
$data = array();
|
65 |
|
@@ -79,11 +64,12 @@ class Hic_Integration_Model_Data extends Varien_Object
|
|
79 |
$info = array();
|
80 |
$info['ds'] = (float)$items[$count]->getDiscountAmount();
|
81 |
$info['tx'] = (float)$items[$count]->getTaxAmount();
|
82 |
-
$info['qt'] = (float)$items[$count]->getQty();
|
83 |
$info['pr'] = (float)$items[$count]->getRowTotalInclTax();
|
84 |
$info['bpr'] = (float)$items[$count]->getPrice();
|
85 |
-
if ($
|
86 |
$info['qt'] = (float)$items[$count]->getQtyOrdered();
|
|
|
|
|
87 |
}
|
88 |
$info['desc'] = strip_tags($product->getDescription());
|
89 |
$info['id'] = $product->getId();
|
@@ -97,21 +83,59 @@ class Hic_Integration_Model_Data extends Varien_Object
|
|
97 |
}
|
98 |
return $data;
|
99 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
/**
|
102 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
*
|
104 |
* @return array $this
|
105 |
*/
|
106 |
-
|
107 |
{
|
108 |
$crumb = array();
|
109 |
foreach (Mage::helper('catalog')->getBreadcrumbPath() as $item) {
|
|
|
110 |
$crumb[] = $item['label'];
|
111 |
}
|
|
|
112 |
$this->setPage(
|
113 |
array(
|
114 |
-
'route' => $this->
|
115 |
'bc' => $crumb
|
116 |
)
|
117 |
);
|
@@ -119,11 +143,11 @@ class Hic_Integration_Model_Data extends Varien_Object
|
|
119 |
}
|
120 |
|
121 |
/**
|
122 |
-
*
|
123 |
*
|
124 |
* @return array $this
|
125 |
*/
|
126 |
-
|
127 |
{
|
128 |
$cart = Mage::getModel('checkout/cart');
|
129 |
$cartQuote = $cart->getQuote();
|
@@ -139,24 +163,24 @@ class Hic_Integration_Model_Data extends Varien_Object
|
|
139 |
$data['tt'] = (float)$cartQuote->getGrandTotal();
|
140 |
}
|
141 |
if ($cartQuote->getItemsCount()) {
|
142 |
-
$data['qt'] = (float)$cartQuote->
|
143 |
}
|
144 |
if (Mage::app()->getStore()->getCurrentCurrencyCode()) {
|
145 |
$data['cu'] = Mage::app()->getStore()->getCurrentCurrencyCode();
|
146 |
}
|
147 |
$data['li'] = $this
|
148 |
-
->_getCartItems($cartQuote->getAllVisibleItems());
|
149 |
$this->setCart($data);
|
150 |
-
return $this;
|
151 |
}
|
|
|
152 |
}
|
153 |
|
154 |
/**
|
155 |
-
*
|
156 |
*
|
157 |
* @return array $this
|
158 |
*/
|
159 |
-
|
160 |
{
|
161 |
$session = Mage::helper('customer');
|
162 |
$customer = $session->getCustomer();
|
@@ -188,16 +212,16 @@ class Hic_Integration_Model_Data extends Varien_Object
|
|
188 |
$data['since'] = $customer->getCreatedAt();
|
189 |
}
|
190 |
$this->setUser($data);
|
191 |
-
return $this;
|
192 |
}
|
|
|
193 |
}
|
194 |
|
195 |
/**
|
196 |
-
*
|
197 |
*
|
198 |
* @return array $this
|
199 |
*/
|
200 |
-
|
201 |
{
|
202 |
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
203 |
if (!$orderId) {
|
@@ -231,22 +255,23 @@ class Hic_Integration_Model_Data extends Varien_Object
|
|
231 |
$transaction['ds'] = -1 * $order->getDiscountAmount();
|
232 |
}
|
233 |
$transaction['li'] = $this
|
234 |
-
->_getCartItems($order->getAllVisibleItems());
|
235 |
$transaction['sh'] = (float)$order->getShippingAmount();
|
236 |
$transaction['shm'] = $order->getShippingMethod()
|
237 |
? $order->getShippingMethod() : '';
|
238 |
$this->setTr($transaction);
|
239 |
-
return $this;
|
240 |
}
|
|
|
241 |
}
|
242 |
|
243 |
/**
|
244 |
-
*
|
245 |
*
|
246 |
* @return array $this
|
247 |
*/
|
248 |
-
|
249 |
{
|
|
|
250 |
if ($product = Mage::registry('current_product')) {
|
251 |
$data['cat'] = $product->getCategoryIds();
|
252 |
$data['id'] = $product->getId();
|
@@ -256,17 +281,10 @@ class Hic_Integration_Model_Data extends Varien_Object
|
|
256 |
$data['img'] = Mage::getBaseUrl('media')
|
257 |
. self::CATALOG_URL . $product->getImage();
|
258 |
$this->setProduct($data);
|
259 |
-
return $this;
|
260 |
}
|
|
|
261 |
}
|
|
|
|
|
262 |
|
263 |
-
/**
|
264 |
-
* Helper reference
|
265 |
-
*
|
266 |
-
* @return Mage_Core_Helper_Abstract
|
267 |
-
*/
|
268 |
-
protected function helper()
|
269 |
-
{
|
270 |
-
return Mage::helper('integration');
|
271 |
-
}
|
272 |
}
|
27 |
*/
|
28 |
class Hic_Integration_Model_Data extends Varien_Object
|
29 |
{
|
|
|
|
|
|
|
30 |
const CATALOG_URL = 'catalog/product/';
|
31 |
+
|
32 |
/**
|
33 |
* Class constructor
|
34 |
*/
|
35 |
protected function _construct()
|
36 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
|
39 |
/**
|
41 |
* passed into function
|
42 |
*
|
43 |
* @param array $items
|
44 |
+
* @params boolean $isOrder
|
45 |
* @return array $data
|
46 |
*/
|
47 |
+
protected function _getCartItems($items, $isOrder)
|
48 |
{
|
49 |
$data = array();
|
50 |
|
64 |
$info = array();
|
65 |
$info['ds'] = (float)$items[$count]->getDiscountAmount();
|
66 |
$info['tx'] = (float)$items[$count]->getTaxAmount();
|
|
|
67 |
$info['pr'] = (float)$items[$count]->getRowTotalInclTax();
|
68 |
$info['bpr'] = (float)$items[$count]->getPrice();
|
69 |
+
if ($isOrder) {
|
70 |
$info['qt'] = (float)$items[$count]->getQtyOrdered();
|
71 |
+
} else {
|
72 |
+
$info['qt'] = (float)$items[$count]->getQty();
|
73 |
}
|
74 |
$info['desc'] = strip_tags($product->getDescription());
|
75 |
$info['id'] = $product->getId();
|
83 |
}
|
84 |
return $data;
|
85 |
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Determines and returns page route
|
89 |
+
*
|
90 |
+
* @return string
|
91 |
+
*/
|
92 |
+
protected function _getRoute()
|
93 |
+
{
|
94 |
+
return Mage::app()
|
95 |
+
->getFrontController()
|
96 |
+
->getAction()
|
97 |
+
->getFullActionName();
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Determines if its a product page or not
|
102 |
+
*
|
103 |
+
* @return boolean
|
104 |
+
*/
|
105 |
+
public function isProduct()
|
106 |
+
{
|
107 |
+
return 'catalog_product_view' == $this->_getRoute();
|
108 |
+
}
|
109 |
|
110 |
/**
|
111 |
+
* Determines if Confirmation page or not
|
112 |
+
*
|
113 |
+
* @return boolean
|
114 |
+
*/
|
115 |
+
public function isConfirmation()
|
116 |
+
{
|
117 |
+
$request = Mage::app()->getRequest();
|
118 |
+
return false !== strpos($request->getRouteName(), 'checkout')
|
119 |
+
&& 'success' == $request->getActionName();
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Retrieves page route and breadcrumb info and populates page
|
124 |
+
* attribute
|
125 |
*
|
126 |
* @return array $this
|
127 |
*/
|
128 |
+
public function populatePageData()
|
129 |
{
|
130 |
$crumb = array();
|
131 |
foreach (Mage::helper('catalog')->getBreadcrumbPath() as $item) {
|
132 |
+
|
133 |
$crumb[] = $item['label'];
|
134 |
}
|
135 |
+
|
136 |
$this->setPage(
|
137 |
array(
|
138 |
+
'route' => $this->_getRoute(),
|
139 |
'bc' => $crumb
|
140 |
)
|
141 |
);
|
143 |
}
|
144 |
|
145 |
/**
|
146 |
+
* Retrieves cart information and populates cart attribute
|
147 |
*
|
148 |
* @return array $this
|
149 |
*/
|
150 |
+
public function populateCartData()
|
151 |
{
|
152 |
$cart = Mage::getModel('checkout/cart');
|
153 |
$cartQuote = $cart->getQuote();
|
163 |
$data['tt'] = (float)$cartQuote->getGrandTotal();
|
164 |
}
|
165 |
if ($cartQuote->getItemsCount()) {
|
166 |
+
$data['qt'] = (float)$cartQuote->getItemsQty();
|
167 |
}
|
168 |
if (Mage::app()->getStore()->getCurrentCurrencyCode()) {
|
169 |
$data['cu'] = Mage::app()->getStore()->getCurrentCurrencyCode();
|
170 |
}
|
171 |
$data['li'] = $this
|
172 |
+
->_getCartItems($cartQuote->getAllVisibleItems(), false);
|
173 |
$this->setCart($data);
|
|
|
174 |
}
|
175 |
+
return $this;
|
176 |
}
|
177 |
|
178 |
/**
|
179 |
+
* Retrieves user information and populates user attribute
|
180 |
*
|
181 |
* @return array $this
|
182 |
*/
|
183 |
+
public function populateUserData()
|
184 |
{
|
185 |
$session = Mage::helper('customer');
|
186 |
$customer = $session->getCustomer();
|
212 |
$data['since'] = $customer->getCreatedAt();
|
213 |
}
|
214 |
$this->setUser($data);
|
|
|
215 |
}
|
216 |
+
return $this;
|
217 |
}
|
218 |
|
219 |
/**
|
220 |
+
* Retrieves order information and populates tr attribute
|
221 |
*
|
222 |
* @return array $this
|
223 |
*/
|
224 |
+
public function populateOrderData()
|
225 |
{
|
226 |
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
227 |
if (!$orderId) {
|
255 |
$transaction['ds'] = -1 * $order->getDiscountAmount();
|
256 |
}
|
257 |
$transaction['li'] = $this
|
258 |
+
->_getCartItems($order->getAllVisibleItems(), false);
|
259 |
$transaction['sh'] = (float)$order->getShippingAmount();
|
260 |
$transaction['shm'] = $order->getShippingMethod()
|
261 |
? $order->getShippingMethod() : '';
|
262 |
$this->setTr($transaction);
|
|
|
263 |
}
|
264 |
+
return $this;
|
265 |
}
|
266 |
|
267 |
/**
|
268 |
+
* Retrieves product information and populates product attribute
|
269 |
*
|
270 |
* @return array $this
|
271 |
*/
|
272 |
+
public function populateProductData()
|
273 |
{
|
274 |
+
// registry does not exist when we are cached
|
275 |
if ($product = Mage::registry('current_product')) {
|
276 |
$data['cat'] = $product->getCategoryIds();
|
277 |
$data['id'] = $product->getId();
|
281 |
$data['img'] = Mage::getBaseUrl('media')
|
282 |
. self::CATALOG_URL . $product->getImage();
|
283 |
$this->setProduct($data);
|
|
|
284 |
}
|
285 |
+
return $this;
|
286 |
}
|
287 |
+
|
288 |
+
|
289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
}
|
app/code/community/Hic/Integration/Model/Observer.php
CHANGED
@@ -27,8 +27,7 @@
|
|
27 |
*/
|
28 |
class Hic_Integration_Model_Observer
|
29 |
{
|
30 |
-
|
31 |
-
protected static $_isRendered = false;
|
32 |
protected static $_clearCache = false;
|
33 |
|
34 |
/**
|
@@ -57,21 +56,7 @@ class Hic_Integration_Model_Observer
|
|
57 |
}
|
58 |
|
59 |
/**
|
60 |
-
*
|
61 |
-
* type to determine if it is a HTML page response
|
62 |
-
*
|
63 |
-
* @return $this
|
64 |
-
*/
|
65 |
-
public function checkResponseType()
|
66 |
-
{
|
67 |
-
if (Mage::app()->getLayout()->getBlock('head')) {
|
68 |
-
self::$_isHead = true;
|
69 |
-
}
|
70 |
-
return $this;
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Intercept 'controller_action_postdispatch' event response
|
75 |
* to inject block at top of head
|
76 |
*
|
77 |
* @param Varien_Event_Observer $observer
|
@@ -79,39 +64,46 @@ class Hic_Integration_Model_Observer
|
|
79 |
*/
|
80 |
public function interceptResponse(Varien_Event_Observer $observer)
|
81 |
{
|
82 |
-
if (
|
|
|
83 |
$layout = Mage::getSingleton('core/layout');
|
84 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
->createBlock('integration/tag', 'hic.integration.tag')
|
86 |
-
->setTemplate('hic/
|
87 |
->toHtml();
|
88 |
-
|
89 |
-
|
90 |
-
->getResponse();
|
91 |
-
$openHeadTag = '<head>';
|
92 |
-
$pos = strpos($response, $openHeadTag);
|
93 |
-
if ($pos !== false && $layout && $tag && $response) {
|
94 |
-
$newStr = substr_replace($response, $tag, $pos + strlen($openHeadTag), 0);
|
95 |
-
$response->setBody($newStr);
|
96 |
-
self::$_isRendered = true;
|
97 |
-
}
|
98 |
}
|
|
|
99 |
return $this;
|
100 |
}
|
101 |
|
102 |
|
103 |
/**
|
104 |
-
* Clear placeholder cache for
|
105 |
*
|
106 |
* @return $this
|
107 |
*/
|
108 |
public function flushCache()
|
109 |
{
|
|
|
110 |
if (!$this->isCacheEnabled()) {
|
111 |
return $this;
|
112 |
}
|
113 |
if (self::$_clearCache == false) {
|
114 |
-
$cacheId =
|
115 |
Enterprise_PageCache_Model_Cache::getCacheInstance()
|
116 |
->remove($cacheId);
|
117 |
self::$_clearCache = true;
|
27 |
*/
|
28 |
class Hic_Integration_Model_Observer
|
29 |
{
|
30 |
+
|
|
|
31 |
protected static $_clearCache = false;
|
32 |
|
33 |
/**
|
56 |
}
|
57 |
|
58 |
/**
|
59 |
+
* Intercept 'core_block_abstract_tohtml_after' event response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
* to inject block at top of head
|
61 |
*
|
62 |
* @param Varien_Event_Observer $observer
|
64 |
*/
|
65 |
public function interceptResponse(Varien_Event_Observer $observer)
|
66 |
{
|
67 |
+
if ($observer->getBlock()->getNameInLayout() == 'head') {
|
68 |
+
$html = $observer->getTransport()->getHtml();
|
69 |
$layout = Mage::getSingleton('core/layout');
|
70 |
+
$tagSession = $layout
|
71 |
+
->createBlock('integration/tag', 'hic.integration.tag.session')
|
72 |
+
->setTemplate('hic/headSession.phtml')
|
73 |
+
->toHtml();
|
74 |
+
$tagPage = $layout
|
75 |
+
->createBlock('integration/tag', 'hic.integration.tag.page')
|
76 |
+
->setTemplate('hic/headPage.phtml')
|
77 |
+
->toHtml();
|
78 |
+
$tagNever = $layout
|
79 |
+
->createBlock('integration/tag', 'hic.integration.tag.never')
|
80 |
+
->setTemplate('hic/headNever.phtml')
|
81 |
+
->toHtml();
|
82 |
+
$tagAlways = $layout
|
83 |
->createBlock('integration/tag', 'hic.integration.tag')
|
84 |
+
->setTemplate('hic/headAlways.phtml')
|
85 |
->toHtml();
|
86 |
+
|
87 |
+
$observer->getTransport()->setHtml($tagSession . $tagPage . $tagNever . $tagAlways . $html);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
+
|
90 |
return $this;
|
91 |
}
|
92 |
|
93 |
|
94 |
/**
|
95 |
+
* Clear placeholder cache for Session Container
|
96 |
*
|
97 |
* @return $this
|
98 |
*/
|
99 |
public function flushCache()
|
100 |
{
|
101 |
+
|
102 |
if (!$this->isCacheEnabled()) {
|
103 |
return $this;
|
104 |
}
|
105 |
if (self::$_clearCache == false) {
|
106 |
+
$cacheId = Hic_Integration_Model_Container_Session::getCacheId();
|
107 |
Enterprise_PageCache_Model_Cache::getCacheInstance()
|
108 |
->remove($cacheId);
|
109 |
self::$_clearCache = true;
|
app/code/community/Hic/Integration/etc/cache.xml
CHANGED
@@ -1,12 +1,26 @@
|
|
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>
|
8 |
-
<container>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
<cache_lifetime>86400</cache_lifetime>
|
10 |
-
</integration>
|
11 |
</placeholders>
|
12 |
</config>
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
<placeholders>
|
4 |
+
<integration-never>
|
5 |
<block>integration/tag</block>
|
6 |
+
<name>hic.integration.tag.never</name>
|
7 |
+
<placeholder>HICONVERSION_NEV</placeholder>
|
8 |
+
<container>Hic_Integration_Model_Container_Never</container>
|
9 |
+
<cache_lifetime>1</cache_lifetime>
|
10 |
+
</integration-never>
|
11 |
+
<integration-page>
|
12 |
+
<block>integration/tag</block>
|
13 |
+
<name>hic.integration.tag.page</name>
|
14 |
+
<placeholder>HICONVERSION_PAGE</placeholder>
|
15 |
+
<container>Hic_Integration_Model_Container_Page</container>
|
16 |
+
<cache_lifetime>86400</cache_lifetime>
|
17 |
+
</integration-page>
|
18 |
+
<integration-session>
|
19 |
+
<block>integration/tag</block>
|
20 |
+
<name>hic.integration.tag.session</name>
|
21 |
+
<placeholder>HICONVERSION_SES</placeholder>
|
22 |
+
<container>Hic_Integration_Model_Container_Session</container>
|
23 |
<cache_lifetime>86400</cache_lifetime>
|
24 |
+
</integration-session>
|
25 |
</placeholders>
|
26 |
</config>
|
app/code/community/Hic/Integration/etc/config.xml
CHANGED
@@ -1,69 +1,61 @@
|
|
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>
|
10 |
-
<integration>
|
11 |
-
<class>Hic_Integration_Model</class>
|
12 |
-
</integration>
|
13 |
-
</models>
|
14 |
-
<helpers>
|
15 |
-
<integration>
|
16 |
-
<class>Hic_Integration_Helper</class>
|
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 |
-
<
|
28 |
-
<observers>
|
29 |
-
<integration_intercept_response>
|
30 |
-
<class>integration/observer</class>
|
31 |
-
<method>interceptResponse</method>
|
32 |
-
</integration_intercept_response>
|
33 |
-
</observers>
|
34 |
-
</
|
35 |
-
<
|
36 |
-
<observers>
|
37 |
-
<
|
38 |
-
<class>integration/observer</class>
|
39 |
-
<method>
|
40 |
-
</
|
41 |
-
</observers>
|
42 |
-
</
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
</
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
<integration>
|
62 |
-
<settings>
|
63 |
-
<enabled>1</enabled>
|
64 |
-
<enabled_2>1</enabled_2>
|
65 |
-
<site_id></site_id>
|
66 |
-
</settings>
|
67 |
-
</integration>
|
68 |
-
</default>
|
69 |
</config>
|
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>
|
10 |
+
<integration>
|
11 |
+
<class>Hic_Integration_Model</class>
|
12 |
+
</integration>
|
13 |
+
</models>
|
14 |
+
<helpers>
|
15 |
+
<integration>
|
16 |
+
<class>Hic_Integration_Helper</class>
|
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 |
+
<core_block_abstract_to_html_after>
|
28 |
+
<observers>
|
29 |
+
<integration_intercept_response>
|
30 |
+
<class>integration/observer</class>
|
31 |
+
<method>interceptResponse</method>
|
32 |
+
</integration_intercept_response>
|
33 |
+
</observers>
|
34 |
+
</core_block_abstract_to_html_after>
|
35 |
+
<checkout_cart_save_after>
|
36 |
+
<observers>
|
37 |
+
<integration_flush_cache>
|
38 |
+
<class>integration/observer</class>
|
39 |
+
<method>flushCache</method>
|
40 |
+
</integration_flush_cache>
|
41 |
+
</observers>
|
42 |
+
</checkout_cart_save_after>
|
43 |
+
</events>
|
44 |
+
<layout>
|
45 |
+
<updates>
|
46 |
+
<integration>
|
47 |
+
<file>hic/hiconversion.xml</file>
|
48 |
+
</integration>
|
49 |
+
</updates>
|
50 |
+
</layout>
|
51 |
+
</frontend>
|
52 |
+
<default>
|
53 |
+
<integration>
|
54 |
+
<settings>
|
55 |
+
<enabled>1</enabled>
|
56 |
+
<enabled_2>1</enabled_2>
|
57 |
+
<site_id></site_id>
|
58 |
+
</settings>
|
59 |
+
</integration>
|
60 |
+
</default>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
</config>
|
app/design/frontend/base/default/layout/hic/hiconversion.xml
DELETED
@@ -1,8 +0,0 @@
|
|
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 → headAlways.phtml}
RENAMED
@@ -1,65 +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
|
18 |
-
* @license [http://opensource.org/licenses/MIT] MIT License
|
19 |
-
*/
|
20 |
-
|
21 |
-
$helper = $this->helper('integration');
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
__hic.
|
32 |
-
__hic.data =
|
33 |
-
|
34 |
-
|
35 |
-
script
|
36 |
-
script.
|
37 |
-
script.
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
}
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
script
|
55 |
-
script.
|
56 |
-
script.
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
65 |
<?php endif; ?>
|
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 |
+
$helper = $this->helper('integration');
|
22 |
+
|
23 |
+
?>
|
24 |
+
<?php if($helper->isEnabled()):?>
|
25 |
+
|
26 |
+
<script id="hiconversion_head_always" type="text/javascript">
|
27 |
+
var __hic = __hic || {};
|
28 |
+
(function(){
|
29 |
+
try {
|
30 |
+
__hic.version = "1.1.2";
|
31 |
+
__hic.data = __hic.data || {};
|
32 |
+
__hic.data.platform = "magento";
|
33 |
+
__hic.data.pid = "<?php echo $helper->getSiteId(); ?>";
|
34 |
+
|
35 |
+
var script = document.createElement("script");
|
36 |
+
script.id = "hiconversion_30";
|
37 |
+
script.async = "async";
|
38 |
+
script.type = "text/javascript";
|
39 |
+
script.src = "//h30-deploy.hiconversion.com/origin/tag/<?php echo $helper->getSiteId(); ?>";
|
40 |
+
var nodes = document.getElementsByTagName("script");
|
41 |
+
if (nodes.length > 0) {
|
42 |
+
nodes[0].parentNode.insertBefore(script, nodes[0]);
|
43 |
+
}
|
44 |
+
} catch (e) {
|
45 |
+
|
46 |
+
}
|
47 |
+
})();
|
48 |
+
</script>
|
49 |
+
<?php if ($helper->isEnabled2()) : ?>
|
50 |
+
<script id="hiconversion_head_script" type="text/javascript">
|
51 |
+
var hiconversion_load = new Date();
|
52 |
+
function hiconversion_head_load() {
|
53 |
+
var external = "";
|
54 |
+
var script = document.createElement("script");
|
55 |
+
script.id = "hiconversion_head_include";
|
56 |
+
script.async = "async";
|
57 |
+
script.type = "text/javascript";
|
58 |
+
script.src = (document.location.protocol == "https:" ? "https://ssl" : "http://update") + ".hiconversion.com/app/update?async=true&external=" + external + "&version=2.0";
|
59 |
+
var nodes = document.getElementsByTagName("script");
|
60 |
+
if (nodes.length > 0) {
|
61 |
+
nodes[0].parentNode.insertBefore(script, nodes[0]);
|
62 |
+
}
|
63 |
+
}
|
64 |
+
hiconversion_head_load();
|
65 |
+
</script>
|
66 |
+
<?php endif;?>
|
67 |
<?php endif; ?>
|
app/design/frontend/base/default/template/hic/headNever.phtml
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
$helper = $this->helper('integration');
|
22 |
+
$hic_data = $helper->hicNeverData();
|
23 |
+
|
24 |
+
?>
|
25 |
+
<?php if($helper->isEnabled()):?>
|
26 |
+
<?php if(isset($hic_data)):?>
|
27 |
+
<?php if(null!==$hic_data->getData('tr')):?>
|
28 |
+
<script id="hiconversion_head_never" type="text/javascript">
|
29 |
+
var __hic = __hic || {};
|
30 |
+
(function(){
|
31 |
+
try {
|
32 |
+
|
33 |
+
__hic.data = __hic.data || {};
|
34 |
+
|
35 |
+
__hic.data.tr = <?php echo Zend_Json::encode($hic_data->getData('tr')); ?>;
|
36 |
+
|
37 |
+
|
38 |
+
} catch (e) {
|
39 |
+
|
40 |
+
}
|
41 |
+
})();
|
42 |
+
</script>
|
43 |
+
<?php endif; ?>
|
44 |
+
<?php endif; ?>
|
45 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/hic/headPage.phtml
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
$helper = $this->helper('integration');
|
22 |
+
$hic_data = $helper->hicPageData();
|
23 |
+
|
24 |
+
?>
|
25 |
+
<?php if($helper->isEnabled()):?>
|
26 |
+
|
27 |
+
<script id="hiconversion_head_page" type="text/javascript">
|
28 |
+
var __hic = __hic || {};
|
29 |
+
(function(){
|
30 |
+
try {
|
31 |
+
<?php if(isset($hic_data)):?>
|
32 |
+
__hic.data = __hic.data || {};
|
33 |
+
<?php if(null!==$hic_data->getData('page')):?>
|
34 |
+
__hic.data.page = <?php echo Zend_Json::encode($hic_data->getData('page')); ?>;
|
35 |
+
<?php endif; ?>
|
36 |
+
<?php if(null!==$hic_data->getData('product')):?>
|
37 |
+
__hic.data.product = <?php echo Zend_Json::encode($hic_data->getData('product')); ?>;
|
38 |
+
<?php endif; ?>
|
39 |
+
<?php endif; ?>
|
40 |
+
} catch (e) {
|
41 |
+
|
42 |
+
}
|
43 |
+
})();
|
44 |
+
</script>
|
45 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/hic/headSession.phtml
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
$helper = $this->helper('integration');
|
22 |
+
$hic_data = $helper->hicSessionData();
|
23 |
+
|
24 |
+
?>
|
25 |
+
<?php if($helper->isEnabled()):?>
|
26 |
+
|
27 |
+
<script id="hiconversion_head_session" type="text/javascript">
|
28 |
+
var __hic = __hic || {};
|
29 |
+
(function(){
|
30 |
+
try {
|
31 |
+
<?php if(isset($hic_data)):?>
|
32 |
+
__hic.data = __hic.data || {};
|
33 |
+
<?php if(null!==$hic_data->getData('cart')):?>
|
34 |
+
__hic.data.cart = <?php echo Zend_Json::encode($hic_data->getData('cart')); ?>;
|
35 |
+
<?php endif; ?>
|
36 |
+
<?php if(null!==$hic_data->getData('user')):?>
|
37 |
+
__hic.data.user = <?php echo Zend_Json::encode($hic_data->getData('user')); ?>;
|
38 |
+
<?php endif; ?>
|
39 |
+
<?php endif; ?>
|
40 |
+
} catch (e) {
|
41 |
+
|
42 |
+
}
|
43 |
+
})();
|
44 |
+
</script>
|
45 |
+
<?php endif; ?>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Hic_Integration</name>
|
4 |
-
<version>1.1.
|
5 |
<stability>stable</stability>
|
6 |
<license>MIT</license>
|
7 |
<channel>community</channel>
|
@@ -12,11 +12,13 @@
|
|
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"><file name="Tag.php" hash="
|
20 |
<compatible/>
|
21 |
-
<dependencies><required><php><min>5.2.0</min><max>5.6.
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Hic_Integration</name>
|
4 |
+
<version>1.1.2</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>-Improved Magento Enterprise Placeholder caching for different levels of data
|
16 |
+

|
17 |
+
-Resolved issue with head tag integration</notes>
|
18 |
<authors><author><name>HiConversion</name><user>hiconversion</user><email>dhenrickson@hiconversion.com</email></author></authors>
|
19 |
+
<date>2015-07-28</date>
|
20 |
+
<time>17:07:26</time>
|
21 |
+
<contents><target name="magelocal"><dir/></target><target name="magecommunity"><dir name="Hic"><dir name="Integration"><dir name="Block"><file name="Tag.php" hash="f78bcbe4f6ca77a1d5ba9915f00a00e9"/></dir><dir name="Helper"><file name="Data.php" hash="56e60fd9bf55cbbaf4e7770f717c665b"/></dir><file name="LICENSE.txt" hash="3b58e20f0b691c258d39cc034c5376eb"/><dir name="Model"><dir name="Container"><file name="Cache.php" hash="0b31d39b61a9c2c5306ddec38da89159"/><file name="Never.php" hash="8f55b957c44cd17cf833b65790ec2cda"/><file name="Page.php" hash="8c71028d0c2e4a8cf64252588ebd65d5"/><file name="Session.php" hash="73a07532644425b9fb8cc63de80704a5"/></dir><file name="Data.php" hash="ddc8e916c423f9ef73ebeff121c5af45"/><file name="Observer.php" hash="ab0ed8bd1c9cf92f1fc4d82edb7e4e9e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f122c26dfe576f4c09f83abe76424931"/><file name="cache.xml" hash="95b38442affa3bdcdbbe69d79f14b541"/><file name="config.xml" hash="52c9660805fa919fc3a1ebdb2a3af231"/><file name="system.xml" hash="099f557cbbd148bee56909732dd9a0cf"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="hic"><file name="body.phtml" hash="a337202d1f589d299392a3dc6a3da4e3"/><file name="headAlways.phtml" hash="0e96370e43e9d440912b1b3160932d18"/><file name="headNever.phtml" hash="27a5c62062a4925eb49aa1cb9504aef0"/><file name="headPage.phtml" hash="d2a1ffa32e6b408e7497a95330264c9e"/><file name="headSession.phtml" hash="197eae4633258c4f353647af5fb34b9b"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Hic_Integration.xml" hash="94fd9568fa202ad3d4773331e46d88c2"/></dir></target></contents>
|
22 |
<compatible/>
|
23 |
+
<dependencies><required><php><min>5.2.0</min><max>5.6.10</max></php><extension><name>Core</name><min/><max/></extension></required></dependencies>
|
24 |
</package>
|