Version Notes
No notes
Download this release
Release Info
Developer | Yireo |
Extension | yireo_googletagmanager |
Version | 1.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.5 to 1.3.0
- app/code/community/Yireo/GoogleTagManager/Block/Category.php +10 -0
- app/code/community/Yireo/GoogleTagManager/Block/Customer.php +13 -0
- app/code/community/Yireo/GoogleTagManager/Block/Default.php +35 -0
- app/code/community/Yireo/GoogleTagManager/Block/Order.php +15 -1
- app/code/community/Yireo/GoogleTagManager/Block/Script.php +3 -3
- app/code/community/Yireo/GoogleTagManager/Helper/Data.php +192 -41
- app/code/community/Yireo/GoogleTagManager/Model/Backend/Source/Method.php +26 -0
- app/code/community/Yireo/GoogleTagManager/Model/Observer.php +21 -3
- app/code/community/Yireo/GoogleTagManager/etc/config.xml +12 -11
- app/code/community/Yireo/GoogleTagManager/etc/system.xml +18 -0
- app/design/frontend/base/default/layout/googletagmanager.xml +5 -3
- app/design/frontend/base/default/template/googletagmanager/category.phtml +24 -6
- app/design/frontend/base/default/template/googletagmanager/customer.phtml +21 -0
- app/design/frontend/base/default/template/googletagmanager/default.phtml +23 -21
- app/design/frontend/base/default/template/googletagmanager/order.phtml +18 -13
- app/design/frontend/base/default/template/googletagmanager/product.phtml +1 -0
- app/design/frontend/base/default/template/googletagmanager/quote.phtml +11 -9
- app/design/frontend/base/default/template/googletagmanager/script.phtml +13 -0
- package.xml +1 -1
app/code/community/Yireo/GoogleTagManager/Block/Category.php
CHANGED
@@ -10,4 +10,14 @@
|
|
10 |
|
11 |
class Yireo_GoogleTagManager_Block_Category extends Yireo_GoogleTagManager_Block_Default
|
12 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
10 |
|
11 |
class Yireo_GoogleTagManager_Block_Category extends Yireo_GoogleTagManager_Block_Default
|
12 |
{
|
13 |
+
public function getLoadedProductCollection()
|
14 |
+
{
|
15 |
+
$productListBlock = Mage::app()->getLayout()->getBlock('product_list');
|
16 |
+
|
17 |
+
if (empty($productListBlock)) {
|
18 |
+
return null;
|
19 |
+
}
|
20 |
+
|
21 |
+
return $productListBlock->getLoadedProductCollection();
|
22 |
+
}
|
23 |
}
|
app/code/community/Yireo/GoogleTagManager/Block/Customer.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* GoogleTagManager plugin for Magento
|
4 |
+
*
|
5 |
+
* @package Yireo_GoogleTagManager
|
6 |
+
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
8 |
+
* @license Open Source License (OSL v3)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Yireo_GoogleTagManager_Block_Customer extends Yireo_GoogleTagManager_Block_Default
|
12 |
+
{
|
13 |
+
}
|
app/code/community/Yireo/GoogleTagManager/Block/Default.php
CHANGED
@@ -10,21 +10,44 @@
|
|
10 |
|
11 |
class Yireo_GoogleTagManager_Block_Default extends Mage_Core_Block_Template
|
12 |
{
|
|
|
|
|
|
|
13 |
public function isEnabled()
|
14 |
{
|
15 |
return (bool)$this->getConfig('active');
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
public function getId()
|
19 |
{
|
20 |
return $this->getConfig('id');
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
public function getConfig($key = null, $default_value = null)
|
24 |
{
|
25 |
return Mage::helper('googletagmanager')->getConfigValue($key, $default_value);
|
26 |
}
|
27 |
|
|
|
|
|
|
|
28 |
public function hasAttributes()
|
29 |
{
|
30 |
$attributes = $this->getAttributes();
|
@@ -34,17 +57,29 @@ class Yireo_GoogleTagManager_Block_Default extends Mage_Core_Block_Template
|
|
34 |
return false;
|
35 |
}
|
36 |
|
|
|
|
|
|
|
37 |
public function getAttributesAsJson()
|
38 |
{
|
39 |
$attributes = $this->getAttributes();
|
40 |
return json_encode($attributes);
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
public function addAttribute($name, $value)
|
44 |
{
|
45 |
return Mage::getSingleton('googletagmanager/container')->setData($name, $value);
|
46 |
}
|
47 |
|
|
|
|
|
|
|
48 |
public function getAttributes()
|
49 |
{
|
50 |
return Mage::getSingleton('googletagmanager/container')->getData();
|
10 |
|
11 |
class Yireo_GoogleTagManager_Block_Default extends Mage_Core_Block_Template
|
12 |
{
|
13 |
+
/**
|
14 |
+
* @return bool
|
15 |
+
*/
|
16 |
public function isEnabled()
|
17 |
{
|
18 |
return (bool)$this->getConfig('active');
|
19 |
}
|
20 |
|
21 |
+
/**
|
22 |
+
* @return bool
|
23 |
+
*/
|
24 |
+
public function isDebug()
|
25 |
+
{
|
26 |
+
return (bool)$this->getConfig('debug');
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @return mixed
|
31 |
+
*/
|
32 |
public function getId()
|
33 |
{
|
34 |
return $this->getConfig('id');
|
35 |
}
|
36 |
|
37 |
+
/**
|
38 |
+
* @param null $key
|
39 |
+
* @param null $default_value
|
40 |
+
*
|
41 |
+
* @return mixed
|
42 |
+
*/
|
43 |
public function getConfig($key = null, $default_value = null)
|
44 |
{
|
45 |
return Mage::helper('googletagmanager')->getConfigValue($key, $default_value);
|
46 |
}
|
47 |
|
48 |
+
/**
|
49 |
+
* @return bool
|
50 |
+
*/
|
51 |
public function hasAttributes()
|
52 |
{
|
53 |
$attributes = $this->getAttributes();
|
57 |
return false;
|
58 |
}
|
59 |
|
60 |
+
/**
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
public function getAttributesAsJson()
|
64 |
{
|
65 |
$attributes = $this->getAttributes();
|
66 |
return json_encode($attributes);
|
67 |
}
|
68 |
|
69 |
+
/**
|
70 |
+
* @param $name
|
71 |
+
* @param $value
|
72 |
+
*
|
73 |
+
* @return Varien_Object
|
74 |
+
*/
|
75 |
public function addAttribute($name, $value)
|
76 |
{
|
77 |
return Mage::getSingleton('googletagmanager/container')->setData($name, $value);
|
78 |
}
|
79 |
|
80 |
+
/**
|
81 |
+
* @return mixed
|
82 |
+
*/
|
83 |
public function getAttributes()
|
84 |
{
|
85 |
return Mage::getSingleton('googletagmanager/container')->getData();
|
app/code/community/Yireo/GoogleTagManager/Block/Order.php
CHANGED
@@ -10,17 +10,31 @@
|
|
10 |
|
11 |
class Yireo_GoogleTagManager_Block_Order extends Yireo_GoogleTagManager_Block_Default
|
12 |
{
|
13 |
-
|
|
|
|
|
|
|
14 |
{
|
15 |
$data = array();
|
|
|
16 |
foreach($this->getOrder()->getAllItems() as $item) {
|
|
|
17 |
$data[] = array(
|
18 |
'sku' => $item->getSku(),
|
19 |
'name' => $item->getName(),
|
20 |
'price' => $item->getPrice(),
|
|
|
21 |
'quantity' => $item->getQtyOrdered(),
|
22 |
);
|
23 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
return json_encode($data);
|
25 |
}
|
26 |
}
|
10 |
|
11 |
class Yireo_GoogleTagManager_Block_Order extends Yireo_GoogleTagManager_Block_Default
|
12 |
{
|
13 |
+
/**
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public function getItems()
|
17 |
{
|
18 |
$data = array();
|
19 |
+
|
20 |
foreach($this->getOrder()->getAllItems() as $item) {
|
21 |
+
$product = $item->getProduct();
|
22 |
$data[] = array(
|
23 |
'sku' => $item->getSku(),
|
24 |
'name' => $item->getName(),
|
25 |
'price' => $item->getPrice(),
|
26 |
+
'category' => implode('|', $product->getCategoryIds()),
|
27 |
'quantity' => $item->getQtyOrdered(),
|
28 |
);
|
29 |
}
|
30 |
+
|
31 |
+
return $data;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getItemsAsJson()
|
35 |
+
{
|
36 |
+
$data = $this->getItems();
|
37 |
+
|
38 |
return json_encode($data);
|
39 |
}
|
40 |
}
|
app/code/community/Yireo/GoogleTagManager/Block/Script.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* GoogleTagManager plugin for Magento
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
@@ -8,9 +8,9 @@
|
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
11 |
-
class Yireo_GoogleTagManager_Block_Script extends
|
12 |
{
|
13 |
-
public function
|
14 |
{
|
15 |
return Mage::helper('googletagmanager')->getHeaderScript();
|
16 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* GoogleTagManager plugin for Magento
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
11 |
+
class Yireo_GoogleTagManager_Block_Script extends Yireo_GoogleTagManager_Block_Default
|
12 |
{
|
13 |
+
public function getScript()
|
14 |
{
|
15 |
return Mage::helper('googletagmanager')->getHeaderScript();
|
16 |
}
|
app/code/community/Yireo/GoogleTagManager/Helper/Data.php
CHANGED
@@ -1,92 +1,243 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
-
* GoogleTagManager plugin for Magento
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
-
|
11 |
class Yireo_GoogleTagManager_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
public function getConfigValue($key = null, $default_value = null)
|
14 |
{
|
15 |
-
$value = Mage::getStoreConfig('googletagmanager/settings/'
|
16 |
-
if(empty($value)) $value = $default_value;
|
17 |
return $value;
|
18 |
}
|
19 |
|
20 |
-
|
21 |
-
*
|
22 |
-
*
|
23 |
-
*
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
*/
|
26 |
public function getHeaderScript()
|
27 |
{
|
28 |
$childScript = '';
|
29 |
|
30 |
// Check for the frontend layout
|
31 |
-
if (!($
|
32 |
return $childScript;
|
33 |
}
|
34 |
|
35 |
-
//
|
36 |
-
|
37 |
-
return $childScript;
|
38 |
-
}
|
39 |
|
40 |
// Add product-information
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
$currentProduct = Mage::registry('current_product');
|
42 |
-
if(!empty($currentProduct)) {
|
43 |
-
$productBlock = $
|
44 |
-
|
|
|
45 |
$productBlock->setProduct($currentProduct);
|
46 |
$childScript .= $productBlock->toHtml();
|
47 |
}
|
48 |
}
|
|
|
49 |
|
50 |
-
|
|
|
|
|
|
|
|
|
51 |
$currentCategory = Mage::registry('current_category');
|
52 |
-
if(!empty($currentCategory)) {
|
53 |
-
$categoryBlock = $
|
54 |
-
|
|
|
55 |
$categoryBlock->setCategory($currentCategory);
|
56 |
$childScript .= $categoryBlock->toHtml();
|
57 |
}
|
58 |
}
|
|
|
59 |
|
60 |
-
|
|
|
|
|
|
|
|
|
61 |
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
62 |
-
|
|
|
63 |
$order = Mage::getModel('sales/order')->loadByIncrementId($lastOrderId);
|
64 |
-
$orderBlock = $
|
65 |
-
|
|
|
66 |
$orderBlock->setOrder($order);
|
67 |
$childScript .= $orderBlock->toHtml();
|
68 |
}
|
|
|
|
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
}
|
|
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
85 |
$childScript .= $customBlock->toHtml();
|
86 |
}
|
87 |
-
|
88 |
-
$block->setChildScript($childScript);
|
89 |
-
$html = $block->toHtml();
|
90 |
-
return $html;
|
91 |
}
|
92 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
+
* GoogleTagManager plugin for Magento
|
5 |
*
|
6 |
* @package Yireo_GoogleTagManager
|
7 |
* @author Yireo (http://www.yireo.com/)
|
8 |
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
9 |
* @license Open Source License (OSL v3)
|
10 |
*/
|
|
|
11 |
class Yireo_GoogleTagManager_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
{
|
13 |
+
/**
|
14 |
+
* @return bool
|
15 |
+
*/
|
16 |
+
public function isEnabled()
|
17 |
+
{
|
18 |
+
return (bool)$this->gertConfigValue('enabled');
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @return bool
|
23 |
+
*/
|
24 |
+
public function isDebug()
|
25 |
+
{
|
26 |
+
return (bool)$this->getConfigValue('debug');
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @return bool
|
31 |
+
*/
|
32 |
+
public function isMethodObserver()
|
33 |
+
{
|
34 |
+
return ($this->getConfigValue('method') == 0);
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @return bool
|
39 |
+
*/
|
40 |
+
public function isMethodLayout()
|
41 |
+
{
|
42 |
+
return ($this->getConfigValue('method') == 1);
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @param $string
|
47 |
+
* @param null $variable
|
48 |
+
*
|
49 |
+
* @return bool
|
50 |
+
*/
|
51 |
+
public function debug($string, $variable = null)
|
52 |
+
{
|
53 |
+
if ($this->isDebug() == false) {
|
54 |
+
return false;
|
55 |
+
}
|
56 |
+
|
57 |
+
if (!empty($variable)) {
|
58 |
+
$string .= ': ' . var_export($variable, true);
|
59 |
+
}
|
60 |
+
|
61 |
+
Mage::log('Yireo_GoogleTagManager: ' . $string);
|
62 |
+
|
63 |
+
return true;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @param null $key
|
68 |
+
* @param null $default_value
|
69 |
+
*
|
70 |
+
* @return mixed|null
|
71 |
+
*/
|
72 |
public function getConfigValue($key = null, $default_value = null)
|
73 |
{
|
74 |
+
$value = Mage::getStoreConfig('googletagmanager/settings/' . $key);
|
75 |
+
if (empty($value)) $value = $default_value;
|
76 |
return $value;
|
77 |
}
|
78 |
|
79 |
+
/**
|
80 |
+
* @param $name
|
81 |
+
* @param $type
|
82 |
+
* @param $template
|
83 |
+
*
|
84 |
+
* @return bool
|
85 |
+
*/
|
86 |
+
public function fetchBlock($name, $type, $template)
|
87 |
+
{
|
88 |
+
if (!($layout = Mage::app()->getFrontController()->getAction()->getLayout())) {
|
89 |
+
return false;
|
90 |
+
}
|
91 |
+
|
92 |
+
if ($block = $layout->getBlock('googletagmanager_' . $name)) {
|
93 |
+
$this->debug('Helper: Loading block from layout: '.$name);
|
94 |
+
return $block;
|
95 |
+
}
|
96 |
+
|
97 |
+
if ($block = $layout->createBlock('googletagmanager/' . $type)->setTemplate('googletagmanager/' . $template)) {
|
98 |
+
$this->debug('Helper: Creating new block: '.$type);
|
99 |
+
return $block;
|
100 |
+
}
|
101 |
+
|
102 |
+
$this->debug('Helper: Unknown block: '.$name);
|
103 |
+
return false;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
*
|
108 |
*/
|
109 |
public function getHeaderScript()
|
110 |
{
|
111 |
$childScript = '';
|
112 |
|
113 |
// Check for the frontend layout
|
114 |
+
if (!($block = $this->fetchBlock('default', 'default', 'default.phtml'))) {
|
115 |
return $childScript;
|
116 |
}
|
117 |
|
118 |
+
// Add customer-information
|
119 |
+
$this->addCustomer($childScript);
|
|
|
|
|
120 |
|
121 |
// Add product-information
|
122 |
+
$this->addProduct($childScript);
|
123 |
+
|
124 |
+
// Add category-information
|
125 |
+
$this->addCategory($childScript);
|
126 |
+
|
127 |
+
// Add order-information
|
128 |
+
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
129 |
+
if (!empty($lastOrderId)) {
|
130 |
+
$this->addOrder($childScript);
|
131 |
+
|
132 |
+
// Add quote-information
|
133 |
+
} else {
|
134 |
+
$this->addQuote($childScript);
|
135 |
+
}
|
136 |
+
|
137 |
+
// Add custom information
|
138 |
+
$this->addCustom($childScript);
|
139 |
+
|
140 |
+
$block->setChildScript($childScript);
|
141 |
+
$html = $block->toHtml();
|
142 |
+
|
143 |
+
return $html;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* @param $childScript string
|
148 |
+
*/
|
149 |
+
public function addCustomer(&$childScript)
|
150 |
+
{
|
151 |
+
$customer = Mage::getSingleton('customer/session');
|
152 |
+
if (!empty($customer)) {
|
153 |
+
$customerBlock = $this->fetchBlock('customer', 'customer', 'customer.phtml');
|
154 |
+
|
155 |
+
if ($customerBlock) {
|
156 |
+
$customerBlock->setCustomer($customer);
|
157 |
+
$customerGroup = Mage::getSingleton('customer/group')->load($customer->getCustomerGroupId());
|
158 |
+
$customerBlock->setCustomerGroup($customerGroup);
|
159 |
+
$childScript .= $customerBlock->toHtml();
|
160 |
+
}
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* @param $childScript string
|
166 |
+
*/
|
167 |
+
public function addProduct(&$childScript)
|
168 |
+
{
|
169 |
$currentProduct = Mage::registry('current_product');
|
170 |
+
if (!empty($currentProduct)) {
|
171 |
+
$productBlock = $this->fetchBlock('product', 'product', 'product.phtml');
|
172 |
+
|
173 |
+
if ($productBlock) {
|
174 |
$productBlock->setProduct($currentProduct);
|
175 |
$childScript .= $productBlock->toHtml();
|
176 |
}
|
177 |
}
|
178 |
+
}
|
179 |
|
180 |
+
/**
|
181 |
+
* @param $childScript string
|
182 |
+
*/
|
183 |
+
public function addCategory(&$childScript)
|
184 |
+
{
|
185 |
$currentCategory = Mage::registry('current_category');
|
186 |
+
if (!empty($currentCategory)) {
|
187 |
+
$categoryBlock = $this->fetchBlock('category', 'category', 'category.phtml');
|
188 |
+
|
189 |
+
if ($categoryBlock) {
|
190 |
$categoryBlock->setCategory($currentCategory);
|
191 |
$childScript .= $categoryBlock->toHtml();
|
192 |
}
|
193 |
}
|
194 |
+
}
|
195 |
|
196 |
+
/**
|
197 |
+
* @param $childScript string
|
198 |
+
*/
|
199 |
+
public function addOrder(&$childScript)
|
200 |
+
{
|
201 |
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
202 |
+
|
203 |
+
if (!empty($lastOrderId)) {
|
204 |
$order = Mage::getModel('sales/order')->loadByIncrementId($lastOrderId);
|
205 |
+
$orderBlock = $this->fetchBlock('order', 'order', 'order.phtml');
|
206 |
+
|
207 |
+
if ($orderBlock) {
|
208 |
$orderBlock->setOrder($order);
|
209 |
$childScript .= $orderBlock->toHtml();
|
210 |
}
|
211 |
+
}
|
212 |
+
}
|
213 |
|
214 |
+
/**
|
215 |
+
* @param $childScript string
|
216 |
+
*/
|
217 |
+
public function addQuote(&$childScript)
|
218 |
+
{
|
219 |
+
/** @var Mage_Sales_Model_Quote $quote */
|
220 |
+
$quote = Mage::getModel('checkout/cart')->getQuote();
|
221 |
+
|
222 |
+
if ($quote->getId() > 0) {
|
223 |
+
$quoteBlock = $this->fetchBlock('quote', 'quote', 'quote.phtml');
|
224 |
+
|
225 |
+
if ($quoteBlock) {
|
226 |
+
$quoteBlock->setQuote($quote);
|
227 |
+
$childScript .= $quoteBlock->toHtml();
|
228 |
}
|
229 |
}
|
230 |
+
}
|
231 |
|
232 |
+
/**
|
233 |
+
* @param $childScript string
|
234 |
+
*/
|
235 |
+
public function addCustom(&$childScript)
|
236 |
+
{
|
237 |
+
$customBlock = $this->fetchBlock('custom', 'custom', 'custom.phtml');
|
238 |
+
|
239 |
+
if ($customBlock) {
|
240 |
$childScript .= $customBlock->toHtml();
|
241 |
}
|
|
|
|
|
|
|
|
|
242 |
}
|
243 |
}
|
app/code/community/Yireo/GoogleTagManager/Model/Backend/Source/Method.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* GoogleTagManager plugin for Magento
|
4 |
+
*
|
5 |
+
* @package Yireo_GoogleTagManager
|
6 |
+
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (http://www.yireo.com/)
|
8 |
+
* @license Open Source License (OSL v3)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Yireo_GoogleTagManager_Model_Backend_Source_Method
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* Options getter
|
15 |
+
*
|
16 |
+
* @return array
|
17 |
+
*/
|
18 |
+
public function toOptionArray()
|
19 |
+
{
|
20 |
+
return array(
|
21 |
+
array('value' => '0', 'label'=> Mage::helper('googletagmanager')->__('Observer')),
|
22 |
+
array('value' => '1', 'label'=> Mage::helper('googletagmanager')->__('XML Layout')),
|
23 |
+
);
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
app/code/community/Yireo/GoogleTagManager/Model/Observer.php
CHANGED
@@ -10,15 +10,18 @@
|
|
10 |
|
11 |
class Yireo_GoogleTagManager_Model_Observer
|
12 |
{
|
13 |
-
|
14 |
* Listen to the event core_block_abstract_to_html_after
|
15 |
-
*
|
16 |
-
* @access public
|
17 |
* @parameter Varien_Event_Observer $observer
|
18 |
* @return $this
|
19 |
*/
|
20 |
public function coreBlockAbstractToHtmlAfter($observer)
|
21 |
{
|
|
|
|
|
|
|
|
|
22 |
$block = $observer->getEvent()->getBlock();
|
23 |
if($block->getNameInLayout() == 'root') {
|
24 |
|
@@ -26,11 +29,26 @@ class Yireo_GoogleTagManager_Model_Observer
|
|
26 |
$html = $transport->getHtml();
|
27 |
|
28 |
$script = Mage::helper('googletagmanager')->getHeaderScript();
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
$html = preg_replace('/\<body([^\>]+)\>/', '\0'.$script, $html);
|
|
|
30 |
|
31 |
$transport->setHtml($html);
|
32 |
}
|
33 |
|
34 |
return $this;
|
35 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
10 |
|
11 |
class Yireo_GoogleTagManager_Model_Observer
|
12 |
{
|
13 |
+
/**
|
14 |
* Listen to the event core_block_abstract_to_html_after
|
15 |
+
*
|
|
|
16 |
* @parameter Varien_Event_Observer $observer
|
17 |
* @return $this
|
18 |
*/
|
19 |
public function coreBlockAbstractToHtmlAfter($observer)
|
20 |
{
|
21 |
+
if ($this->getHelper()->isMethodObserver() == false) {
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
+
|
25 |
$block = $observer->getEvent()->getBlock();
|
26 |
if($block->getNameInLayout() == 'root') {
|
27 |
|
29 |
$html = $transport->getHtml();
|
30 |
|
31 |
$script = Mage::helper('googletagmanager')->getHeaderScript();
|
32 |
+
|
33 |
+
if (empty($script)) {
|
34 |
+
$this->getHelper()->debug('Observer: Empty script');
|
35 |
+
return $this;
|
36 |
+
}
|
37 |
+
|
38 |
$html = preg_replace('/\<body([^\>]+)\>/', '\0'.$script, $html);
|
39 |
+
$this->getHelper()->debug('Observer: Replacing header');
|
40 |
|
41 |
$transport->setHtml($html);
|
42 |
}
|
43 |
|
44 |
return $this;
|
45 |
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @return Yireo_GoogleGears_Helper_Data
|
49 |
+
*/
|
50 |
+
public function getHelper()
|
51 |
+
{
|
52 |
+
return Mage::helper('googletagmanager');
|
53 |
+
}
|
54 |
}
|
app/code/community/Yireo/GoogleTagManager/etc/config.xml
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
<config>
|
13 |
<modules>
|
14 |
<Yireo_GoogleTagManager>
|
15 |
-
<version>1.
|
16 |
</Yireo_GoogleTagManager>
|
17 |
</modules>
|
18 |
|
@@ -32,6 +32,17 @@
|
|
32 |
<class>Yireo_GoogleTagManager_Model</class>
|
33 |
</googletagmanager>
|
34 |
</models>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
<events>
|
36 |
<core_block_abstract_to_html_after>
|
37 |
<observers>
|
@@ -43,16 +54,6 @@
|
|
43 |
</observers>
|
44 |
</core_block_abstract_to_html_after>
|
45 |
</events>
|
46 |
-
</global>
|
47 |
-
|
48 |
-
<frontend>
|
49 |
-
<layout>
|
50 |
-
<updates>
|
51 |
-
<googletagmanager>
|
52 |
-
<file>googletagmanager.xml</file>
|
53 |
-
</googletagmanager>
|
54 |
-
</updates>
|
55 |
-
</layout>
|
56 |
</frontend>
|
57 |
|
58 |
<adminhtml>
|
12 |
<config>
|
13 |
<modules>
|
14 |
<Yireo_GoogleTagManager>
|
15 |
+
<version>1.3.0</version>
|
16 |
</Yireo_GoogleTagManager>
|
17 |
</modules>
|
18 |
|
32 |
<class>Yireo_GoogleTagManager_Model</class>
|
33 |
</googletagmanager>
|
34 |
</models>
|
35 |
+
</global>
|
36 |
+
|
37 |
+
<frontend>
|
38 |
+
<layout>
|
39 |
+
<updates>
|
40 |
+
<googletagmanager>
|
41 |
+
<file>googletagmanager.xml</file>
|
42 |
+
</googletagmanager>
|
43 |
+
</updates>
|
44 |
+
</layout>
|
45 |
+
|
46 |
<events>
|
47 |
<core_block_abstract_to_html_after>
|
48 |
<observers>
|
54 |
</observers>
|
55 |
</core_block_abstract_to_html_after>
|
56 |
</events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
</frontend>
|
58 |
|
59 |
<adminhtml>
|
app/code/community/Yireo/GoogleTagManager/etc/system.xml
CHANGED
@@ -53,6 +53,24 @@
|
|
53 |
<show_in_website>1</show_in_website>
|
54 |
<show_in_store>1</show_in_store>
|
55 |
</id>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
</fields>
|
57 |
</settings>
|
58 |
</groups>
|
53 |
<show_in_website>1</show_in_website>
|
54 |
<show_in_store>1</show_in_store>
|
55 |
</id>
|
56 |
+
<method translate="label">
|
57 |
+
<label>Insertion Method</label>
|
58 |
+
<frontend_type>select</frontend_type>
|
59 |
+
<source_model>googletagmanager/backend_source_method</source_model>
|
60 |
+
<sort_order>10</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
</method>
|
65 |
+
<debug translate="label">
|
66 |
+
<label>Debug</label>
|
67 |
+
<frontend_type>select</frontend_type>
|
68 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
69 |
+
<sort_order>11</sort_order>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>1</show_in_store>
|
73 |
+
</debug>
|
74 |
</fields>
|
75 |
</settings>
|
76 |
</groups>
|
app/design/frontend/base/default/layout/googletagmanager.xml
CHANGED
@@ -11,17 +11,19 @@
|
|
11 |
-->
|
12 |
<layout>
|
13 |
<default>
|
|
|
14 |
<block type="googletagmanager/order" name="googletagmanager_order" template="googletagmanager/order.phtml" />
|
15 |
<block type="googletagmanager/quote" name="googletagmanager_quote" template="googletagmanager/quote.phtml" />
|
16 |
<block type="googletagmanager/product" name="googletagmanager_product" template="googletagmanager/product.phtml" />
|
17 |
<block type="googletagmanager/category" name="googletagmanager_category" template="googletagmanager/category.phtml" />
|
18 |
<block type="googletagmanager/custom" name="googletagmanager_custom" template="googletagmanager/custom.phtml" />
|
19 |
<block type="googletagmanager/default" name="googletagmanager" template="googletagmanager/default.phtml" />
|
|
|
20 |
|
21 |
-
<!--
|
22 |
<reference name="after_body_start">
|
23 |
-
<
|
|
|
|
|
24 |
</reference>
|
25 |
-
-->
|
26 |
</default>
|
27 |
</layout>
|
11 |
-->
|
12 |
<layout>
|
13 |
<default>
|
14 |
+
<block type="googletagmanager/customer" name="googletagmanager_customer" template="googletagmanager/customer.phtml" />
|
15 |
<block type="googletagmanager/order" name="googletagmanager_order" template="googletagmanager/order.phtml" />
|
16 |
<block type="googletagmanager/quote" name="googletagmanager_quote" template="googletagmanager/quote.phtml" />
|
17 |
<block type="googletagmanager/product" name="googletagmanager_product" template="googletagmanager/product.phtml" />
|
18 |
<block type="googletagmanager/category" name="googletagmanager_category" template="googletagmanager/category.phtml" />
|
19 |
<block type="googletagmanager/custom" name="googletagmanager_custom" template="googletagmanager/custom.phtml" />
|
20 |
<block type="googletagmanager/default" name="googletagmanager" template="googletagmanager/default.phtml" />
|
21 |
+
<block type="googletagmanager/script" name="googletagmanager_script" template="googletagmanager/script.phtml" />
|
22 |
|
|
|
23 |
<reference name="after_body_start">
|
24 |
+
<action method="append" ifconfig="googletagmanager/settings/method">
|
25 |
+
<block>googletagmanager_script</block>
|
26 |
+
</action>
|
27 |
</reference>
|
|
|
28 |
</default>
|
29 |
</layout>
|
app/design/frontend/base/default/template/googletagmanager/category.phtml
CHANGED
@@ -7,11 +7,29 @@
|
|
7 |
* @copyright Copyright (c) 2014 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Software License
|
9 |
*/
|
|
|
|
|
10 |
?>
|
11 |
<?php if($this->isEnabled()) : ?>
|
12 |
-
<?php $category = $this->getCategory(); ?>
|
13 |
-
<?php if(!empty($category) && $category->getId() > 0) : ?>
|
14 |
-
|
15 |
-
|
16 |
-
<?php endif; ?>
|
17 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
* @copyright Copyright (c) 2014 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Software License
|
9 |
*/
|
10 |
+
|
11 |
+
$productCollection = $this->getLoadedProductCollection();
|
12 |
?>
|
13 |
<?php if($this->isEnabled()) : ?>
|
14 |
+
<?php $category = $this->getCategory(); ?>
|
15 |
+
<?php if(!empty($category) && $category->getId() > 0) : ?>
|
16 |
+
<?php $this->addAttribute('categoryId', $category->getId()); ?>
|
17 |
+
<?php $this->addAttribute('categoryName', $category->getName()); ?>
|
18 |
+
<?php endif; ?>
|
19 |
+
<?php if(!empty($productCollection)) : ?>
|
20 |
+
<?php $this->addAttribute('categorySize', $productCollection->getSize()); ?>
|
21 |
+
<?php $categoryProducts = array(); ?>
|
22 |
+
<?php $i = 0; ?>
|
23 |
+
<?php foreach($productCollection as $product) : ?>
|
24 |
+
<?php if ($i > 3) continue; ?>
|
25 |
+
<?php $categoryProduct = array(); ?>
|
26 |
+
<?php $categoryProduct['id'] = $product->getId(); ?>
|
27 |
+
<?php $categoryProduct['name'] = $product->getName(); ?>
|
28 |
+
<?php $categoryProduct['sku'] = $product->getSku(); ?>
|
29 |
+
<?php $categoryProduct['price'] = $product->getPrice(); ?>
|
30 |
+
<?php $categoryProducts[] = $categoryProduct; ?>
|
31 |
+
<?php $i++ ; ?>
|
32 |
+
<?php endforeach; ?>
|
33 |
+
<?php $this->addAttribute('categoryProducts', $categoryProducts); ?>
|
34 |
+
<?php endif; ?>
|
35 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/googletagmanager/customer.phtml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* GoogleTagManager plugin for Magento
|
4 |
+
*
|
5 |
+
* @package Yireo_GoogleTagManager
|
6 |
+
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright (c) 2014 Yireo (http://www.yireo.com/)
|
8 |
+
* @license Open Software License
|
9 |
+
*/
|
10 |
+
?>
|
11 |
+
<?php if($this->isEnabled()) : ?>
|
12 |
+
<?php $customer = $this->getCustomer(); ?>
|
13 |
+
<?php $customerGroup = $this->getCustomerGroup(); ?>
|
14 |
+
<?php if(!empty($customer) && $customer->getId() > 0) : ?>
|
15 |
+
<?php $this->addAttribute('customerLoggedIn', 1); ?>
|
16 |
+
<?php else: ?>
|
17 |
+
<?php $this->addAttribute('customerLoggedIn', 0); ?>
|
18 |
+
<?php endif; ?>
|
19 |
+
<?php $this->addAttribute('customerGroupId', $customerGroup->getId()); ?>
|
20 |
+
<?php $this->addAttribute('customerGroupCode', strtoupper($customerGroup->getCustomerGroupCode())); ?>
|
21 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/googletagmanager/default.phtml
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* GoogleTagManager plugin for Magento
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
@@ -8,23 +8,25 @@
|
|
8 |
* @license Open Software License
|
9 |
*/
|
10 |
?>
|
11 |
-
<?php if($this->isEnabled()) : ?>
|
12 |
-
|
13 |
-
<
|
14 |
-
|
15 |
-
<?php $childScript = $this->getChildScript(); ?>
|
16 |
-
|
17 |
-
|
18 |
-
<?php if($this->hasAttributes()) : ?>
|
19 |
-
dataLayer = [
|
20 |
-
<?php endif; ?>
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
{'gtm.start': new Date().getTime(),event:'gtm.js'}
|
26 |
-
|
27 |
-
j
|
28 |
-
'//www.googletagmanager.com/gtm.js?id='+i+dl;
|
29 |
-
|
30 |
-
|
|
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* GoogleTagManager plugin for Magento
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
8 |
* @license Open Software License
|
9 |
*/
|
10 |
?>
|
11 |
+
<?php if ($this->isEnabled()) : ?>
|
12 |
+
<noscript>
|
13 |
+
<iframe src="//www.googletagmanager.com/ns.html?id=<?= $this->getId(); ?>" height="0" width="0" style="display:none;visibility:hidden"></iframe>
|
14 |
+
</noscript>
|
15 |
+
<?php $childScript = $this->getChildScript(); ?>
|
16 |
+
<script>
|
17 |
+
<?php if (!empty($childScript)) : ?>
|
18 |
+
<?php if($this->hasAttributes()) : ?>
|
19 |
+
dataLayer = [<?= $this->getAttributesAsJson(); ?>];
|
20 |
+
<?php endif; ?>
|
21 |
+
<?= $childScript; ?>
|
22 |
+
<?php endif; ?>
|
23 |
+
(function (w, d, s, l, i) {
|
24 |
+
w[l] = w[l] || [];
|
25 |
+
w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
|
26 |
+
var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
|
27 |
+
j.async = true;
|
28 |
+
j.src = '//www.googletagmanager.com/gtm.js?id=' + i + dl;
|
29 |
+
f.parentNode.insertBefore(j, f);
|
30 |
+
})(window, document, 'script', 'dataLayer', '<?= $this->getId(); ?>');
|
31 |
+
</script>
|
32 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/googletagmanager/order.phtml
CHANGED
@@ -1,21 +1,26 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* GoogleTagManager plugin for Magento
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license Open Software License
|
9 |
*/
|
10 |
?>
|
11 |
-
<?php if($this->isEnabled()) : ?>
|
12 |
-
<?php $order = $this->getOrder(); ?>
|
13 |
-
<?php if(!empty($order) && $order->getId() > 0) : ?>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
<?php
|
21 |
-
<?php
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* GoogleTagManager plugin for Magento
|
4 |
*
|
5 |
* @package Yireo_GoogleTagManager
|
6 |
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright (c) 2015 Yireo (http://www.yireo.com/)
|
8 |
* @license Open Software License
|
9 |
*/
|
10 |
?>
|
11 |
+
<?php if ($this->isEnabled()) : ?>
|
12 |
+
<?php $order = $this->getOrder(); ?>
|
13 |
+
<?php if (!empty($order) && $order->getId() > 0) : ?>
|
14 |
+
<?php $this->addAttribute('transactionEntity', 'ORDER'); ?>
|
15 |
+
<?php $this->addAttribute('transactionId', $order->getIncrementId()); ?>
|
16 |
+
<?php $this->addAttribute('transactionDate', $order->getCreatedAt()); ?>
|
17 |
+
<?php $this->addAttribute('transactionAffiliation', Mage::app()->getWebsite()->getName()); ?>
|
18 |
+
<?php $this->addAttribute('transactionTotal', $order->getGrandTotal()); ?>
|
19 |
+
<?php $this->addAttribute('transactionTax', $order->getGrandTotal() - $order->getSubtotal()); ?>
|
20 |
+
<?php $this->addAttribute('transactionShipping', $order->getShippingAmount()); ?>
|
21 |
+
<?php $this->addAttribute('transactionPayment', $order->getPayment()->getMethodInstance()->getTitle()); ?>
|
22 |
+
<?php $this->addAttribute('transactionCurrency', Mage::app()->getStore()->getBaseCurrencyCode()); ?>
|
23 |
+
<?php $this->addAttribute('transactionPromoCode', $order->getCouponCode()); ?>
|
24 |
+
<?php $this->addAttribute('transactionProducts', $this->getItems()); ?>
|
25 |
+
<?php endif; ?>
|
26 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/googletagmanager/product.phtml
CHANGED
@@ -14,5 +14,6 @@
|
|
14 |
<?php $this->addAttribute('productId', $product->getId()); ?>
|
15 |
<?php $this->addAttribute('productName', $product->getName()); ?>
|
16 |
<?php $this->addAttribute('productSku', $product->getSku()); ?>
|
|
|
17 |
<?php endif; ?>
|
18 |
<?php endif; ?>
|
14 |
<?php $this->addAttribute('productId', $product->getId()); ?>
|
15 |
<?php $this->addAttribute('productName', $product->getName()); ?>
|
16 |
<?php $this->addAttribute('productSku', $product->getSku()); ?>
|
17 |
+
<?php $this->addAttribute('productPrice', $product->getPrice()); ?>
|
18 |
<?php endif; ?>
|
19 |
<?php endif; ?>
|
app/design/frontend/base/default/template/googletagmanager/quote.phtml
CHANGED
@@ -9,12 +9,14 @@
|
|
9 |
*/
|
10 |
?>
|
11 |
<?php if($this->isEnabled()) : ?>
|
12 |
-
<?php $quote = $this->getQuote(); ?>
|
13 |
-
<?php if(!empty($quote) && $quote->getId() > 0) : ?>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
<?php
|
20 |
-
<?php
|
|
|
|
9 |
*/
|
10 |
?>
|
11 |
<?php if($this->isEnabled()) : ?>
|
12 |
+
<?php $quote = $this->getQuote(); ?>
|
13 |
+
<?php if(!empty($quote) && $quote->getId() > 0) : ?>
|
14 |
+
<?php $this->addAttribute('transactionEntity', 'QUOTE'); ?>
|
15 |
+
<?php $this->addAttribute('transactionId', $quote->getId()); ?>
|
16 |
+
<?php $this->addAttribute('transactionId', $quote->getId()); ?>
|
17 |
+
<?php $this->addAttribute('transactionAffiliation', Mage::app()->getWebsite()->getName()); ?>
|
18 |
+
<?php $this->addAttribute('transactionTotal', (float)$quote->getGrandTotal()); ?>
|
19 |
+
<?php $this->addAttribute('transactionTax', $quote->getGrandTotal() - $quote->getSubtotal()); ?>
|
20 |
+
<?php $this->addAttribute('transactionProducts', $this->getItemsAsJson()); ?>
|
21 |
+
<?php endif; ?>
|
22 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/googletagmanager/script.phtml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* GoogleTagManager plugin for Magento
|
4 |
+
*
|
5 |
+
* @package Yireo_GoogleTagManager
|
6 |
+
* @author Yireo (http://www.yireo.com/)
|
7 |
+
* @copyright Copyright (c) 2014 Yireo (http://www.yireo.com/)
|
8 |
+
* @license Open Software License
|
9 |
+
*/
|
10 |
+
?>
|
11 |
+
<?php if($this->isEnabled()) : ?>
|
12 |
+
<?= $this->getScript(); ?>
|
13 |
+
<?php endif; ?>
|
package.xml
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<package><name>yireo_googletagmanager</name><version>1.
|
1 |
<?xml version="1.0"?>
|
2 |
+
<package><name>yireo_googletagmanager</name><version>1.3.0</version><stability>stable</stability><license>Open Source License</license><channel>community</channel><extends></extends><summary>No summary</summary><description>No description</description><notes>No notes</notes><authors><author><name>Yireo</name><user>yireo</user><email>info@yireo.com</email></author></authors><date>2015-08-20</date><time>12:30:08</time><compatible></compatible><dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Yireo_GoogleTagManager.xml" hash="420bde8207c2ed151e50ef4b7df1c28f"/></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="googletagmanager"><file name="category.phtml" hash="e02dc5d555dd7a5195031d80e5308fc1"/><file name="custom.phtml" hash="2b4ae99a074d314241a1ba7127661c04"/><file name="customer.phtml" hash="4772e8eb1f495aad7e562d3d0c3ec6ff"/><file name="default.phtml" hash="a6fe34885f3c223445a10d4e4d9d6ae1"/><file name="order.phtml" hash="b0b1c6130caba6198ebebe06484190f2"/><file name="product.phtml" hash="e0af99cd595af21de5a97911d2d41fa1"/><file name="quote.phtml" hash="3303deca9e3012c8dcfda1e972e36ace"/><file name="script.phtml" hash="18e2d45895b95061ccf04c5af74e25a9"/></dir></dir><dir name="layout"><file name="googletagmanager.xml" hash="4b2e83f2e964891da358c9a64647a043"/></dir></dir></dir></dir></dir><dir name="code"><dir name="community"><dir name="Yireo"><dir name="GoogleTagManager"><dir name="etc"><file name="config.xml" hash="1f8a33354fb6bc1929d71c34aba13ca6"/><file name="system.xml" hash="c6d755d52247656fd8e6931503a5840a"/></dir><dir name="Model"><file name="Container.php" hash="782c5f85ca92dc39dff034768d9d7177"/><file name="Observer.php" hash="114ce303d3487ead4bd81ae084665525"/><dir name="Backend"><dir name="Source"><file name="Method.php" hash="d5e60a00a1f85fa658c02e9f895539d3"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="53060c6d58747cbf35cee11c81555f31"/></dir><dir name="Block"><file name="Category.php" hash="e1da36db1401d657a19e2c6291d70c38"/><file name="Custom.php" hash="fd1c528409d0186f9ec7de8391d2509c"/><file name="Customer.php" hash="a6f461d0210b141d3d3e0e4cfd80cc3a"/><file name="Default.php" hash="2c078f7152ac294a3d712193624c9fd4"/><file name="Order.php" hash="a36269d8b49f8c5bbd05504a33b392db"/><file name="Product.php" hash="02f816ccdb1a0b7a74f001dee0d0018d"/><file name="Quote.php" hash="17580bf20487ceb803421c0ca0575741"/><file name="Script.php" hash="3ddfa74f22197a17f6158b6b40c20abf"/></dir></dir></dir></dir></dir></dir></target></contents></package>
|