Version Notes
No notes
Download this release
Release Info
Developer | Yireo |
Extension | yireo_googletagmanager |
Version | 1.3.22 |
Comparing to | |
See all releases |
Code changes from version 1.3.20 to 1.3.22
- app/code/community/Yireo/GoogleTagManager/Block/Category.php +1 -1
- app/code/community/Yireo/GoogleTagManager/Block/Default.php +1 -1
- app/code/community/Yireo/GoogleTagManager/Block/Search.php +1 -3
- app/code/community/Yireo/GoogleTagManager/Block/Tag.php +40 -0
- app/code/community/Yireo/GoogleTagManager/Helper/Data.php +23 -0
- app/code/community/Yireo/GoogleTagManager/etc/config.xml +1 -1
- app/design/frontend/base/default/layout/googletagmanager.xml +1 -0
- app/design/frontend/base/default/template/googletagmanager/tag.phtml +41 -0
- package.xml +1 -1
app/code/community/Yireo/GoogleTagManager/Block/Category.php
CHANGED
@@ -60,7 +60,7 @@ class Yireo_GoogleTagManager_Block_Category extends Yireo_GoogleTagManager_Block
|
|
60 |
{
|
61 |
$order = $this->getCurrentOrder();
|
62 |
$dir = $this->getCurrentPosition();
|
63 |
-
|
64 |
if ($order) {
|
65 |
$sortingData = $this->catalogConfig->getAttributesUsedForSortBy();
|
66 |
|
60 |
{
|
61 |
$order = $this->getCurrentOrder();
|
62 |
$dir = $this->getCurrentPosition();
|
63 |
+
|
64 |
if ($order) {
|
65 |
$sortingData = $this->catalogConfig->getAttributesUsedForSortBy();
|
66 |
|
app/code/community/Yireo/GoogleTagManager/Block/Default.php
CHANGED
@@ -175,7 +175,7 @@ class Yireo_GoogleTagManager_Block_Default extends Mage_Core_Block_Template
|
|
175 |
*/
|
176 |
public function jsonEncode($data)
|
177 |
{
|
178 |
-
$string = json_encode($data);
|
179 |
$string = str_replace('"', "'", $string);
|
180 |
return $string;
|
181 |
}
|
175 |
*/
|
176 |
public function jsonEncode($data)
|
177 |
{
|
178 |
+
$string = json_encode($data, JSON_HEX_APOS);
|
179 |
$string = str_replace('"', "'", $string);
|
180 |
return $string;
|
181 |
}
|
app/code/community/Yireo/GoogleTagManager/Block/Search.php
CHANGED
@@ -33,9 +33,7 @@ class Yireo_GoogleTagManager_Block_Search extends Yireo_GoogleTagManager_Block_C
|
|
33 |
$collection->setCurPage($this->getCurrentPage())->setPageSize($this->getLimit());
|
34 |
}
|
35 |
|
36 |
-
|
37 |
-
$collection->setOrder($searchListBlock->getSortBy(), $searchListBlock->getDefaultDirection());
|
38 |
-
}
|
39 |
|
40 |
return $collection;
|
41 |
}
|
33 |
$collection->setCurPage($this->getCurrentPage())->setPageSize($this->getLimit());
|
34 |
}
|
35 |
|
36 |
+
$this->applySorting($collection);
|
|
|
|
|
37 |
|
38 |
return $collection;
|
39 |
}
|
app/code/community/Yireo/GoogleTagManager/Block/Tag.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* GoogleTagManager plugin for Magento
|
4 |
+
*
|
5 |
+
* @package Yireo_GoogleTagManager
|
6 |
+
* @author Yireo (https://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2016 Yireo (https://www.yireo.com/)
|
8 |
+
* @license Open Source License (OSL v3)
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Yireo_GoogleTagManager_Block_Tag
|
13 |
+
*/
|
14 |
+
class Yireo_GoogleTagManager_Block_Tag extends Yireo_GoogleTagManager_Block_Category
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* @return Mage_Eav_Model_Entity_Collection_Abstract|null
|
18 |
+
*/
|
19 |
+
public function getProductCollection()
|
20 |
+
{
|
21 |
+
/** @var Mage_Catalog_Block_Product_List $taggedProductsBlock */
|
22 |
+
$taggedProductsBlock = $this->layout->getBlock('search_result_list');
|
23 |
+
|
24 |
+
if (empty($taggedProductsBlock)) {
|
25 |
+
return null;
|
26 |
+
}
|
27 |
+
|
28 |
+
// Fetch the current collection from the block and set pagination and order
|
29 |
+
$collection = $taggedProductsBlock->getLoadedProductCollection();
|
30 |
+
|
31 |
+
// Set Limit Except for 'all' products
|
32 |
+
if ($this->getLimit() != 'all') {
|
33 |
+
$collection->setCurPage($this->getCurrentPage())->setPageSize($this->getLimit());
|
34 |
+
}
|
35 |
+
|
36 |
+
$this->applySorting($collection);
|
37 |
+
|
38 |
+
return $collection;
|
39 |
+
}
|
40 |
+
}
|
app/code/community/Yireo/GoogleTagManager/Helper/Data.php
CHANGED
@@ -181,6 +181,9 @@ class Yireo_GoogleTagManager_Helper_Data extends Mage_Core_Helper_Abstract
|
|
181 |
|
182 |
// Add search-information
|
183 |
$childScript .= $this->getSearchScript();
|
|
|
|
|
|
|
184 |
|
185 |
// Add order-information
|
186 |
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
@@ -276,6 +279,26 @@ class Yireo_GoogleTagManager_Helper_Data extends Mage_Core_Helper_Abstract
|
|
276 |
return $html;
|
277 |
}
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
/**
|
280 |
* @return string
|
281 |
*/
|
181 |
|
182 |
// Add search-information
|
183 |
$childScript .= $this->getSearchScript();
|
184 |
+
|
185 |
+
// Add tagged products
|
186 |
+
$childScript .= $this->getTagScript();
|
187 |
|
188 |
// Add order-information
|
189 |
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
279 |
return $html;
|
280 |
}
|
281 |
|
282 |
+
/**
|
283 |
+
* @return string
|
284 |
+
*/
|
285 |
+
public function getTagScript()
|
286 |
+
{
|
287 |
+
$tagBlock = $this->fetchBlock('tag', 'tag', 'tag.phtml');
|
288 |
+
if (!$tagBlock) {
|
289 |
+
return '';
|
290 |
+
}
|
291 |
+
|
292 |
+
$productCollection = $tagBlock->getProductCollection();
|
293 |
+
if (empty($productCollection) || $productCollection->count() < 1) {
|
294 |
+
return '';
|
295 |
+
}
|
296 |
+
|
297 |
+
$tagBlock->setProducts($productCollection);
|
298 |
+
$html = $tagBlock->toHtml();
|
299 |
+
return $html;
|
300 |
+
}
|
301 |
+
|
302 |
/**
|
303 |
* @return string
|
304 |
*/
|
app/code/community/Yireo/GoogleTagManager/etc/config.xml
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
<config>
|
13 |
<modules>
|
14 |
<Yireo_GoogleTagManager>
|
15 |
-
<version>1.3.
|
16 |
</Yireo_GoogleTagManager>
|
17 |
</modules>
|
18 |
|
12 |
<config>
|
13 |
<modules>
|
14 |
<Yireo_GoogleTagManager>
|
15 |
+
<version>1.3.22</version>
|
16 |
</Yireo_GoogleTagManager>
|
17 |
</modules>
|
18 |
|
app/design/frontend/base/default/layout/googletagmanager.xml
CHANGED
@@ -17,6 +17,7 @@
|
|
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/search" name="googletagmanager_search" template="googletagmanager/search.phtml" />
|
|
|
20 |
<block type="googletagmanager/ecommerce" name="googletagmanager_ecommerce" template="googletagmanager/ecommerce.phtml" />
|
21 |
<block type="googletagmanager/custom" name="googletagmanager_custom" template="googletagmanager/custom.phtml" />
|
22 |
<block type="googletagmanager/default" name="googletagmanager" template="googletagmanager/default.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/search" name="googletagmanager_search" template="googletagmanager/search.phtml" />
|
20 |
+
<block type="googletagmanager/tag" name="googletagmanager_tag" template="googletagmanager/tag.phtml" />
|
21 |
<block type="googletagmanager/ecommerce" name="googletagmanager_ecommerce" template="googletagmanager/ecommerce.phtml" />
|
22 |
<block type="googletagmanager/custom" name="googletagmanager_custom" template="googletagmanager/custom.phtml" />
|
23 |
<block type="googletagmanager/default" name="googletagmanager" template="googletagmanager/default.phtml" />
|
app/design/frontend/base/default/template/googletagmanager/tag.phtml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* GoogleTagManager plugin for Magento
|
4 |
+
*
|
5 |
+
* @package Yireo_GoogleTagManager
|
6 |
+
* @author Yireo (https://www.yireo.com/)
|
7 |
+
* @copyright Copyright (c) 2016 Yireo (https://www.yireo.com/)
|
8 |
+
* @license Open Software License
|
9 |
+
*/
|
10 |
+
$loadProducts = (int)Mage::helper('googletagmanager')->getConfigValue('category_products');
|
11 |
+
if ($loadProducts > 0) {
|
12 |
+
$products = $this->getProducts();
|
13 |
+
}
|
14 |
+
|
15 |
+
if ($this->isEnabled()) {
|
16 |
+
if (!empty($products)) {
|
17 |
+
$this->addAttribute('categorySize', $products->getSize());
|
18 |
+
$categoryProducts = array();
|
19 |
+
|
20 |
+
$i = 0;
|
21 |
+
foreach ($products as $product) {
|
22 |
+
|
23 |
+
if ($i > $loadProducts) {
|
24 |
+
break;
|
25 |
+
}
|
26 |
+
|
27 |
+
$categoryProduct = array();
|
28 |
+
$categoryProduct['id'] = $product->getId();
|
29 |
+
$categoryProduct['name'] = $product->getName();
|
30 |
+
$categoryProduct['sku'] = $product->getSku();
|
31 |
+
$categoryProduct['price'] = $product->getPrice();
|
32 |
+
$categoryProduct['position'] = $i;
|
33 |
+
|
34 |
+
$categoryProducts[] = $categoryProduct;
|
35 |
+
$i++;
|
36 |
+
}
|
37 |
+
|
38 |
+
$this->addAttribute('categoryProducts', $categoryProducts);
|
39 |
+
$this->getModuleHelper()->addEcommerceData('impressions', $categoryProducts);
|
40 |
+
}
|
41 |
+
}
|
package.xml
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<package><name>yireo_googletagmanager</name><version>1.3.
|
1 |
<?xml version="1.0"?>
|
2 |
+
<package><name>yireo_googletagmanager</name><version>1.3.22</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>2016-07-10</date><time>0:13:59</time><compatible></compatible><dependencies><required><php><min>5.4.0</min><max>7.5.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Yireo_GoogleTagManager.xml" hash="c28dd4d6773115b840262bce9a0375c8"/></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="8ed9e3cadaa58ca7e41ad233736a112c"/><file name="custom.phtml" hash="b888cea900aba4a488968ca88a42813d"/><file name="customer.phtml" hash="3db76ba18473a1c7f664c1b50db622a4"/><file name="default.phtml" hash="ad392d0002b73bc5028c4d7704695dda"/><file name="ecommerce.phtml" hash="fcded48968e1b152f828c0b20766a948"/><file name="order.phtml" hash="5dadb37be8798f76651e9bbb55a9bf4a"/><file name="product.phtml" hash="e0b80aa2adf0c6c6c89d38e9ef7638aa"/><file name="product_addtocart.phtml" hash="ead689aa81c78ac9bb182b96a6edbe90"/><file name="product_click.phtml" hash="1946b2edbcd2295cc21031e72293f268"/><file name="product_removefromcart.phtml" hash="f743569a3c3e5aa3bf209b44fe4fcd51"/><file name="quote.phtml" hash="18c5352672c1b6ef704e60f8c3f035f2"/><file name="script.phtml" hash="5ad6b7dcbd3c8073b739e2fe4088dc58"/><file name="search.phtml" hash="ecacabcd592944211d68769dbd7d008d"/><file name="tag.phtml" hash="ecacabcd592944211d68769dbd7d008d"/></dir></dir><dir name="layout"><file name="googletagmanager.xml" hash="25ed262dbf3a851d6753ff92379f09d9"/></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="f3244208305ce598e1c74c2a68af89d7"/><file name="system.xml" hash="41c9ad0454073fde42c763bb6aef9175"/></dir><dir name="Model"><file name="Container.php" hash="2a57c7d0e901274854df57d36d6fea99"/><file name="Observer.php" hash="38f5e11fecfbddd9db9322cc59e02e8f"/><dir name="Backend"><dir name="Source"><file name="Method.php" hash="fddd987814dc7f7f4a880f0accd75cdc"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="1a543331c2c2d0dd17cbd4693d57947e"/></dir><dir name="Block"><file name="Category.php" hash="84e7717c94d57deac9b4afdac5b2d286"/><file name="Custom.php" hash="d8fbfada41ae6b0de6722aac4d4eb51b"/><file name="Customer.php" hash="8acd34cb6de2cf52999cb03c61816fd1"/><file name="Default.php" hash="c2541dfc7faea6dfd0ff6645d6084773"/><file name="Ecommerce.php" hash="3095463b7d90cd74dfab059c8fd0bb12"/><file name="Order.php" hash="fcfad1050e3250605002d4a983931bed"/><file name="Product.php" hash="26eed61e01ec7c54b7f49fafa71835dd"/><file name="Quote.php" hash="d6b73970c2dcd0d719517feb518614e2"/><file name="Script.php" hash="0b6b405d492ac4fe553b5f5c2fb7d7cd"/><file name="Search.php" hash="e3c45c1e9a6c64c73d8b58e77aee53fa"/><file name="Tag.php" hash="88c3f3c6d392dfe36e20009886b38a20"/></dir></dir></dir></dir></dir></dir></target></contents></package>
|