Version Notes
Initial Stable Release
Download this release
Release Info
Developer | HiConversion |
Extension | Hic_Integration |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Hic/Integration/Block/Html/Head.php +12 -0
- app/code/community/Hic/Integration/Block/Template.php +6 -0
- app/code/community/Hic/Integration/Helper/Data.php +80 -0
- app/code/community/Hic/Integration/Model/Container/Template.php +27 -0
- app/code/community/Hic/Integration/Model/Data.php +197 -0
- app/code/community/Hic/Integration/etc/adminhtml.xml +23 -0
- app/code/community/Hic/Integration/etc/cache.xml +11 -0
- app/code/community/Hic/Integration/etc/config.xml +48 -0
- app/code/community/Hic/Integration/etc/system.xml +59 -0
- app/design/frontend/base/default/layout/hic/hiconversion.xml +8 -0
- app/design/frontend/base/default/template/hic/body.phtml +22 -0
- app/design/frontend/base/default/template/hic/head.phtml +48 -0
- app/etc/modules/Hic_Integration.xml +9 -0
- package.xml +22 -0
app/code/community/Hic/Integration/Block/Html/Head.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Hic_Integration_Block_Html_Head extends Mage_Page_Block_Html_Head
|
4 |
+
{
|
5 |
+
protected function _afterToHtml($html)
|
6 |
+
{
|
7 |
+
//prepend Hic block output
|
8 |
+
$block = Mage::app()->getLayout()->createBlock('integration/template','hiconversion.head.tag');
|
9 |
+
$block->setTemplate('hic/head.phtml');
|
10 |
+
return $block->toHtml() . $html;
|
11 |
+
}
|
12 |
+
}
|
app/code/community/Hic/Integration/Block/Template.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Hic_Integration_Block_Template extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/community/Hic/Integration/Helper/Data.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Hic_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
const SETTINGS_ENABLED = 'integration/settings/enabled';
|
6 |
+
const SETTINGS_ENABLED_2 = 'integration/settings/enabled_2';
|
7 |
+
const SETTINGS_SITE_ID = 'integration/settings/site_id';
|
8 |
+
|
9 |
+
public function getSiteId()
|
10 |
+
{
|
11 |
+
return Mage::getStoreConfig(self::SETTINGS_SITE_ID);
|
12 |
+
}
|
13 |
+
|
14 |
+
public function isEnabled()
|
15 |
+
{
|
16 |
+
return Mage::getStoreConfig(self::SETTINGS_ENABLED);
|
17 |
+
}
|
18 |
+
|
19 |
+
public function isEnabled2()
|
20 |
+
{
|
21 |
+
return Mage::getStoreConfig(self::SETTINGS_ENABLED_2);
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getHicData()
|
25 |
+
{
|
26 |
+
return Mage::getModel('integration/data');
|
27 |
+
}
|
28 |
+
|
29 |
+
public function getRoute()
|
30 |
+
{
|
31 |
+
$route = Mage::app()->getFrontController()->getAction()->getFullActionName();
|
32 |
+
return $route;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function isHomepage()
|
36 |
+
{
|
37 |
+
return 'cms_index_index' == $this->getRoute();
|
38 |
+
}
|
39 |
+
|
40 |
+
public function isContent()
|
41 |
+
{
|
42 |
+
return 'cms_page_view' == $this->getRoute();
|
43 |
+
}
|
44 |
+
|
45 |
+
public function isCategory()
|
46 |
+
{
|
47 |
+
return 'catalog_category_view' == $this->getRoute();
|
48 |
+
}
|
49 |
+
|
50 |
+
public function isSearch(){
|
51 |
+
return 'catalogsearch_result_index' == $this->getRoute();
|
52 |
+
}
|
53 |
+
|
54 |
+
public function isProduct()
|
55 |
+
{
|
56 |
+
return 'catalog_product_view' == $this->getRoute();
|
57 |
+
}
|
58 |
+
|
59 |
+
public function isCart()
|
60 |
+
{
|
61 |
+
return 'checkout_cart_index' == $this->getRoute();
|
62 |
+
}
|
63 |
+
|
64 |
+
public function isCheckout()
|
65 |
+
{
|
66 |
+
return 'checkout_onepage_index' == $this->getRoute();
|
67 |
+
}
|
68 |
+
|
69 |
+
public function is404()
|
70 |
+
{
|
71 |
+
return 'cms_index_noRoute' == $this->getRoute();
|
72 |
+
}
|
73 |
+
|
74 |
+
public function isConfirmation()
|
75 |
+
{
|
76 |
+
$request = Mage::app()->getRequest();
|
77 |
+
return false !== strpos($request->getRouteName(), 'checkout') && 'success' == $request->getActionName();
|
78 |
+
}
|
79 |
+
|
80 |
+
}
|
app/code/community/Hic/Integration/Model/Container/Template.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Hic_Integration_Model_Container_Template extends Enterprise_PageCache_Model_Container_Advanced_Quote
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Render block content
|
8 |
+
*
|
9 |
+
* @return string
|
10 |
+
*/
|
11 |
+
protected function _renderBlock()
|
12 |
+
{
|
13 |
+
$block = $this->_placeholder->getAttribute('block');
|
14 |
+
$template = $this->_placeholder->getAttribute('template');
|
15 |
+
|
16 |
+
$block = new $block;
|
17 |
+
$block->setTemplate($template);
|
18 |
+
$block->setLayout(Mage::app()->getLayout());
|
19 |
+
|
20 |
+
return $block->toHtml();
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _saveCache($data, $id, $tags = array(), $lifetime = null)
|
24 |
+
{
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
}
|
app/code/community/Hic/Integration/Model/Data.php
ADDED
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Hic_Integration_Model_Data extends Varien_Object
|
4 |
+
{
|
5 |
+
protected $_version = "1.0";
|
6 |
+
protected $_platform = "magento";
|
7 |
+
|
8 |
+
const CATALOG_URL = 'catalog/product/';
|
9 |
+
|
10 |
+
protected function _construct()
|
11 |
+
{
|
12 |
+
$this
|
13 |
+
->setVersion($this->_version)
|
14 |
+
->setPlatform($this->_platform)
|
15 |
+
->setPid($this->helper()->getSiteId())
|
16 |
+
->_initPage()
|
17 |
+
->_initUser()
|
18 |
+
->_initCart();
|
19 |
+
if ($this->helper()->isProduct()) {
|
20 |
+
$this->_initProduct();
|
21 |
+
}
|
22 |
+
if ($this->helper()->isConfirmation()) {
|
23 |
+
$this->_initOrder();
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
public function hicData()
|
28 |
+
{
|
29 |
+
$data = $this->toArray(array('page', 'cart', 'user','tr','version','platform','pid','product'));
|
30 |
+
$data = array_filter($data);
|
31 |
+
$obj = new Varien_Object($data);
|
32 |
+
if ($obj && $data) {
|
33 |
+
return Zend_Json::encode($obj->getData());
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
protected function _getCartItems($items)
|
38 |
+
{
|
39 |
+
$data = array();
|
40 |
+
foreach ($items as $i) {
|
41 |
+
$p = Mage::getModel('catalog/product')->load($i->getProductId());
|
42 |
+
if ($p) {
|
43 |
+
$info = array();
|
44 |
+
$info['tt'] = (float)$i->getRowTotalInclTax();
|
45 |
+
$info['ds'] = (float)$i->getDiscountAmount();
|
46 |
+
$info['qt'] = (float)$i->getQty();
|
47 |
+
$info['id'] = $p->getId();
|
48 |
+
$info['url'] = $p->getProductUrl();
|
49 |
+
$info['nm'] = $p->getName();
|
50 |
+
$info['bpr'] = (float)$p->getPrice();
|
51 |
+
$info['pr'] = (float)$p->getFinalPrice();
|
52 |
+
$info['desc'] = strip_tags($p->getShortDescription());
|
53 |
+
$info['img'] = $p->getImageUrl();
|
54 |
+
$info['sku'] = $p->getSku();
|
55 |
+
$info['cat'] = $p->getCategoryIds();
|
56 |
+
$data[] = $info;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
return $data;
|
60 |
+
}
|
61 |
+
|
62 |
+
protected function _initPage()
|
63 |
+
{
|
64 |
+
$crumb = array();
|
65 |
+
foreach (Mage::helper('catalog')->getBreadcrumbPath() as $item) {
|
66 |
+
$crumb[] = $item['label'];
|
67 |
+
}
|
68 |
+
$this->setPage(array(
|
69 |
+
'route' => $this->helper()->getRoute(),
|
70 |
+
'bc' => $crumb
|
71 |
+
));
|
72 |
+
return $this;
|
73 |
+
}
|
74 |
+
|
75 |
+
protected function _initCart()
|
76 |
+
{
|
77 |
+
$cart = Mage::getModel('checkout/cart')->getQuote();
|
78 |
+
if ($cart->getItemsCount() > 0) {
|
79 |
+
$data = array();
|
80 |
+
if ($cart->getId()) {
|
81 |
+
$data['id'] = (string)$cart->getId();
|
82 |
+
}
|
83 |
+
if ($cart->getSubtotal()) {
|
84 |
+
$data['st'] = (float)$cart->getSubtotal();
|
85 |
+
}
|
86 |
+
if ($cart->getGrandTotal()) {
|
87 |
+
$data['tt'] = (float)$cart->getGrandTotal();
|
88 |
+
}
|
89 |
+
if ($cart->getItemsCount()) {
|
90 |
+
$data['qt'] = (float)$cart->getItemsCount();
|
91 |
+
}
|
92 |
+
if (Mage::app()->getStore()->getCurrentCurrencyCode()) {
|
93 |
+
$data['cu'] = Mage::app()->getStore()->getCurrentCurrencyCode();
|
94 |
+
}
|
95 |
+
$data['li'] = $this->_getCartItems($cart->getAllVisibleItems());
|
96 |
+
$this->setCart($data);
|
97 |
+
return $this;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
protected function _initUser()
|
102 |
+
{
|
103 |
+
$session = Mage::helper('customer');
|
104 |
+
$customer = $session->getCustomer();
|
105 |
+
$data = array();
|
106 |
+
if ($customer) {
|
107 |
+
$data['auth'] = $session->isLoggedIn();
|
108 |
+
$data['ht'] = false;
|
109 |
+
$data['nv'] = true;
|
110 |
+
$data['cg'] = Mage::getSingleton('customer/session')->getCustomerGroupId(); // TODO: Array?
|
111 |
+
$data['sid'] = Mage::getSingleton("core/session")->getEncryptedSessionId();
|
112 |
+
if ($customer->getId()) {
|
113 |
+
// Determine if customer has transacted or not. Must be logged in.
|
114 |
+
$orders = Mage::getModel('sales/order')->getCollection();
|
115 |
+
$orders->addAttributeToFilter('customer_id',$customer->getId());
|
116 |
+
if ($orders){
|
117 |
+
$data['ht'] = $orders->getSize() > 0;
|
118 |
+
}
|
119 |
+
if ($customer->getDob()) {
|
120 |
+
$data['bday'] = $customer->getDob();
|
121 |
+
}
|
122 |
+
if ($customer->getGender()) {
|
123 |
+
$data['gndr'] = $customer->getGender();
|
124 |
+
}
|
125 |
+
if ($customer->getEmail()) {
|
126 |
+
$data['email'] = $customer->getEmail();
|
127 |
+
}
|
128 |
+
$data['id'] = $customer->getId();
|
129 |
+
$data['nv'] = false;
|
130 |
+
$data['nm'] = trim($customer->getFirstname() . ' ' . $customer->getLastname());
|
131 |
+
$data['since'] = $customer->getCreatedAt(); // yyyy-mm-dd hh:mm:ss+01:00
|
132 |
+
}
|
133 |
+
$this->setUser($data);
|
134 |
+
return $this;
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
protected function _initOrder()
|
139 |
+
{
|
140 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
141 |
+
if (!$orderId) {
|
142 |
+
return false;
|
143 |
+
}
|
144 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
145 |
+
$transaction = array();
|
146 |
+
if ( $order ) {
|
147 |
+
if ($order->getIncrementId()) {
|
148 |
+
$transaction['id'] = $order->getIncrementId();
|
149 |
+
}
|
150 |
+
if (Mage::app()->getStore()->getCurrentCurrencyCode()) {
|
151 |
+
$transaction['cu'] = Mage::app()->getStore()->getCurrentCurrencyCode();
|
152 |
+
}
|
153 |
+
if ($order->getSubtotal()) {
|
154 |
+
$transaction['st'] = (float)$order->getSubtotal();
|
155 |
+
}
|
156 |
+
if ($order->getTaxAmount()) {
|
157 |
+
$transaction['tx'] = (float)$order->getTaxAmount();
|
158 |
+
}
|
159 |
+
if ($order->getPayment()->getMethodInstance()->getTitle()) {
|
160 |
+
$transaction['type'] = $order->getPayment()->getMethodInstance()->getTitle();
|
161 |
+
}
|
162 |
+
if ($order->getGrandTotal()) {
|
163 |
+
$transaction['tt'] = (float)$order->getGrandTotal();
|
164 |
+
}
|
165 |
+
if ($order->getCouponCode()) {
|
166 |
+
$transaction['coup'] = array($order->getCouponCode());
|
167 |
+
}
|
168 |
+
if ($order->getDiscountAmount() > 0) {
|
169 |
+
$transaction['ds'] = -1 * $order->getDiscountAmount();
|
170 |
+
}
|
171 |
+
$transaction['li'] = $this->_getCartItems($order->getAllVisibleItems());
|
172 |
+
$transaction['sh'] = (float)$order->getShippingAmount();
|
173 |
+
$transaction['shm'] = $order->getShippingMethod() ? $order->getShippingMethod() : '';
|
174 |
+
$this->setTr($transaction);
|
175 |
+
return $this;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
protected function _initProduct()
|
180 |
+
{
|
181 |
+
if ($product = Mage::registry('current_product')) {
|
182 |
+
$data['cat'] = $product->getCategoryIds();
|
183 |
+
$data['id'] = $product->getId();
|
184 |
+
$data['nm'] = $product->getName();
|
185 |
+
$data['url'] = $product->getProductUrl();
|
186 |
+
$data['sku'] = $product->getSku();
|
187 |
+
$data['img'] = Mage::getBaseUrl('media') . self::CATALOG_URL . $product->getImage();
|
188 |
+
$this->setProduct($data);
|
189 |
+
return $this;
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
protected function helper()
|
194 |
+
{
|
195 |
+
return Mage::helper('integration');
|
196 |
+
}
|
197 |
+
}
|
app/code/community/Hic/Integration/etc/adminhtml.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<integration translate="title" module="integration">
|
12 |
+
<sort_order>1000</sort_order>
|
13 |
+
<title>HiConversion</title>
|
14 |
+
</integration>
|
15 |
+
</children>
|
16 |
+
</config>
|
17 |
+
</children>
|
18 |
+
</system>
|
19 |
+
</children>
|
20 |
+
</admin>
|
21 |
+
</resources>
|
22 |
+
</acl>
|
23 |
+
</config>
|
app/code/community/Hic/Integration/etc/cache.xml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<placeholders>
|
4 |
+
<hiconversion>
|
5 |
+
<block>integration/template</block>
|
6 |
+
<placeholder>HICONVERSION</placeholder>
|
7 |
+
<container>Hic_Integration_Model_Container_Template</container>
|
8 |
+
<cache_lifetime>86400</cache_lifetime>
|
9 |
+
</hiconversion>
|
10 |
+
</placeholders>
|
11 |
+
</config>
|
app/code/community/Hic/Integration/etc/config.xml
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<integration>
|
5 |
+
<version>1.0</version>
|
6 |
+
</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 |
+
<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>
|
34 |
+
<file>hic/hiconversion.xml</file>
|
35 |
+
</integration>
|
36 |
+
</updates>
|
37 |
+
</layout>
|
38 |
+
</frontend>
|
39 |
+
<default>
|
40 |
+
<integration>
|
41 |
+
<settings>
|
42 |
+
<enabled>1</enabled>
|
43 |
+
<enabled_2>1</enabled_2>
|
44 |
+
<site_id></site_id>
|
45 |
+
</settings>
|
46 |
+
</integration>
|
47 |
+
</default>
|
48 |
+
</config>
|
app/code/community/Hic/Integration/etc/system.xml
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<integration translate="label">
|
5 |
+
<label>HiConversion</label>
|
6 |
+
<sort_order>1000</sort_order>
|
7 |
+
</integration>
|
8 |
+
</tabs>
|
9 |
+
|
10 |
+
<sections>
|
11 |
+
<integration translate="label">
|
12 |
+
<label>Settings</label>
|
13 |
+
<tab>integration</tab>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>10</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
|
20 |
+
<groups>
|
21 |
+
<settings translate="label">
|
22 |
+
<label>Configuration</label>
|
23 |
+
<sort_order>1</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
<fields>
|
28 |
+
<enabled translate="label">
|
29 |
+
<label>Enable Extension</label>
|
30 |
+
<frontend_type>select</frontend_type>
|
31 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
32 |
+
<sort_order>1</sort_order>
|
33 |
+
<show_in_default>1</show_in_default>
|
34 |
+
<show_in_website>1</show_in_website>
|
35 |
+
<show_in_store>1</show_in_store>
|
36 |
+
</enabled>
|
37 |
+
<enabled_2 translate="label">
|
38 |
+
<label>Enable CX Optimization</label>
|
39 |
+
<frontend_type>select</frontend_type>
|
40 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
41 |
+
<sort_order>3</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
</enabled_2>
|
46 |
+
<site_id translate="label">
|
47 |
+
<label>Site ID</label>
|
48 |
+
<frontend_type>text</frontend_type>
|
49 |
+
<sort_order>2</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
</site_id>
|
54 |
+
</fields>
|
55 |
+
</settings>
|
56 |
+
</groups>
|
57 |
+
</integration>
|
58 |
+
</sections>
|
59 |
+
</config>
|
app/design/frontend/base/default/layout/hic/hiconversion.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.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/body.phtml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$helper = $this->helper('integration');
|
3 |
+
?>
|
4 |
+
<?php if ($helper->isEnabled() && $helper->isEnabled2()) : ?>
|
5 |
+
|
6 |
+
<script id="hiconversion_body_script" type="text/javascript">
|
7 |
+
function hiconversion_body_run(arg) {
|
8 |
+
var then = new Date();
|
9 |
+
var diff = then - arg.ran;
|
10 |
+
if (diff < arg.wait) {
|
11 |
+
if (typeof hiconversion_body_update == "function") {
|
12 |
+
hiconversion_body_update({async: true, pass: arg.pass, ran: arg.ran, then: then });
|
13 |
+
} else {
|
14 |
+
arg.pass = arg.pass + 1;
|
15 |
+
setTimeout(function() { hiconversion_body_run(arg); }, 100);
|
16 |
+
}
|
17 |
+
}
|
18 |
+
}
|
19 |
+
hiconversion_body_run({ async: true, pass: 0, ran: new Date(), wait: 30000 });
|
20 |
+
</script>
|
21 |
+
|
22 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/hic/head.phtml
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$helper = $this->helper('integration');
|
3 |
+
$hic_data = $helper->getHicData();
|
4 |
+
?>
|
5 |
+
<?php if($helper->isEnabled()):?>
|
6 |
+
|
7 |
+
<script>
|
8 |
+
try {
|
9 |
+
var script = document.createElement("script");
|
10 |
+
script.id = "hiconversion_30";
|
11 |
+
script.async = "async";
|
12 |
+
script.type = "text/javascript";
|
13 |
+
script.src = "//h30-deploy.hiconversion.com/origin/tag/<?php echo $helper->getSiteId(); ?>";
|
14 |
+
var nodes = document.getElementsByTagName("script");
|
15 |
+
if (nodes.length > 0) {
|
16 |
+
nodes[0].parentNode.insertBefore(script, nodes[0]);
|
17 |
+
}
|
18 |
+
} catch (e) {
|
19 |
+
|
20 |
+
}
|
21 |
+
</script>
|
22 |
+
|
23 |
+
<script type="text/javascript">
|
24 |
+
var __hic = __hic || {};
|
25 |
+
__hic.version = "1.0.0";
|
26 |
+
__hic.data = <?php echo $hic_data->hicData() ?>;
|
27 |
+
</script>
|
28 |
+
|
29 |
+
<?php if ($helper->isEnabled2()) : ?>
|
30 |
+
<script id="hiconversion_head_script" type="text/javascript">
|
31 |
+
var hiconversion_load = new Date();
|
32 |
+
function hiconversion_head_load() {
|
33 |
+
var external ="";
|
34 |
+
var script = document.createElement("script");
|
35 |
+
script.id = "hiconversion_head_include";
|
36 |
+
script.async = "async";
|
37 |
+
script.type = "text/javascript";
|
38 |
+
script.src = (document.location.protocol == "https:" ? "https://ssl" : "http://update") + ".hiconversion.com/app/update?async=true&external=" + external + "&version=2.0";
|
39 |
+
var nodes = document.getElementsByTagName("script");
|
40 |
+
if (nodes.length > 0) {
|
41 |
+
nodes[0].parentNode.insertBefore(script, nodes[0]);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
hiconversion_head_load();
|
45 |
+
</script>
|
46 |
+
|
47 |
+
<?php endif;?>
|
48 |
+
<?php endif; ?>
|
app/etc/modules/Hic_Integration.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Hic_Integration>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Hic_Integration>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Hic_Integration</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>MIT</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This is the official all-in-one HiConversion - Magento connector that enables the use of all web analytics, testing, targeting, personalization, and customer experience optimization capabilities of the HiConversion product suite. This one-time integration will save you from custom tagging and the other implementation pains associated with traditional web analytics, testing, and optimization solutions.</summary>
|
10 |
+
<description>Once live, the extension will provide total data capture and the client-side page modification capabilities needed for running of live adaptive customer experience optimization campaigns. These include:
|
11 |
+

|
12 |
+
Data Capture: We productized our knowledge about the types of data collected by the most advanced web analytics solutions deployed on the Magento stores. We then created an extension that provides a 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 |
+
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 will enable you to visually provision your optimization campaigns. The visual designs are then translated into lines of code that are then transparently executed by the visitor browser during the web page rendering process.</description>
|
15 |
+
<notes>Initial Stable Release</notes>
|
16 |
+
<authors><author><name>HiConversion</name><user>hiconversion</user><email>dhenrickson@hiconversion.com</email></author></authors>
|
17 |
+
<date>2015-04-21</date>
|
18 |
+
<time>15:49:47</time>
|
19 |
+
<contents><target name="magecommunity"><dir name="Hic"><dir name="Integration"><dir name="Block"><dir name="Html"><file name="Head.php" hash="6b9949c419ce6a98ddc2437d55749914"/></dir><file name="Template.php" hash="aa50189e5d9c57017c5f85fe3140a3cd"/></dir><dir name="Helper"><file name="Data.php" hash="47c1b873a75ef4efb3f1491de5cf1682"/></dir><dir name="Model"><dir name="Container"><file name="Template.php" hash="916c3b28e359054e9e0f3019576b6098"/></dir><file name="Data.php" hash="99c327f2e058e662787fc7a7c48abe2b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f122c26dfe576f4c09f83abe76424931"/><file name="cache.xml" hash="b67ce021de2a64b796e3ba88e84df601"/><file name="config.xml" hash="b192a565cec62d2eadcac18657515962"/><file name="system.xml" hash="62129b4db99b2ffcc698c68f89712ad1"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Hic_Integration.xml" hash="94fd9568fa202ad3d4773331e46d88c2"/></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="01b3d087e71e592a5dadb8ac0ad7c822"/></dir></dir><dir name="template"><dir name="hic"><file name="body.phtml" hash="ca0b99af17fe0f844db8c2fa265ff32f"/><file name="head.phtml" hash="28dbb72df9adce978a552623e74b2bea"/></dir></dir></dir></dir></dir></target></contents>
|
20 |
+
<compatible/>
|
21 |
+
<dependencies><required><php><min>5.4.0</min><max>5.6.7</max></php></required></dependencies>
|
22 |
+
</package>
|