Version Notes
No notes
Download this release
Release Info
Developer | Yireo |
Extension | yireo_googletagmanager |
Version | 1.3.24 |
Comparing to | |
See all releases |
Code changes from version 1.3.22 to 1.3.24
- app/code/community/Yireo/GoogleTagManager/Block/Category.php +23 -3
- app/code/community/Yireo/GoogleTagManager/Block/Search.php +5 -1
- app/code/community/Yireo/GoogleTagManager/Block/Tag.php +5 -1
- app/code/community/Yireo/GoogleTagManager/Model/Backend/Category/Sorting.php +42 -0
- app/code/community/Yireo/GoogleTagManager/etc/config.xml +2 -1
- app/code/community/Yireo/GoogleTagManager/etc/system.xml +9 -0
- package.xml +1 -1
app/code/community/Yireo/GoogleTagManager/Block/Category.php
CHANGED
@@ -48,19 +48,39 @@ class Yireo_GoogleTagManager_Block_Category extends Yireo_GoogleTagManager_Block
|
|
48 |
$collection->setCurPage($this->getCurrentPage())->setPageSize($this->getLimit());
|
49 |
}
|
50 |
|
51 |
-
$this->
|
|
|
|
|
|
|
|
|
52 |
|
53 |
return $collection;
|
54 |
}
|
55 |
|
56 |
/**
|
57 |
* @param Mage_Eav_Model_Entity_Collection_Abstract $collection
|
|
|
58 |
*/
|
59 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
{
|
61 |
$order = $this->getCurrentOrder();
|
62 |
$dir = $this->getCurrentPosition();
|
63 |
-
|
|
|
64 |
if ($order) {
|
65 |
$sortingData = $this->catalogConfig->getAttributesUsedForSortBy();
|
66 |
|
48 |
$collection->setCurPage($this->getCurrentPage())->setPageSize($this->getLimit());
|
49 |
}
|
50 |
|
51 |
+
if ($this->moduleHelper->getConfigValue('category_sorting') == 'block') {
|
52 |
+
$this->applyBlockSorting($collection, $productListBlock);
|
53 |
+
} else {
|
54 |
+
$this->applyUrlSorting($collection);
|
55 |
+
}
|
56 |
|
57 |
return $collection;
|
58 |
}
|
59 |
|
60 |
/**
|
61 |
* @param Mage_Eav_Model_Entity_Collection_Abstract $collection
|
62 |
+
* @param Mage_Catalog_Block_Product_List $block
|
63 |
*/
|
64 |
+
public function applyBlockSorting(Mage_Eav_Model_Entity_Collection_Abstract &$collection, Mage_Catalog_Block_Product_List $block)
|
65 |
+
{
|
66 |
+
$toolbar = $block->getToolbarBlock();
|
67 |
+
$order = $toolbar->getCurrentOrder();
|
68 |
+
$dir = $toolbar->getCurrentDirection();
|
69 |
+
|
70 |
+
$collection->setOrder($order, $dir);
|
71 |
+
$block->toHtml();
|
72 |
+
//echo 'console.log("Block sorting: '.$order.' / '.$dir.'");';
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* @param Mage_Eav_Model_Entity_Collection_Abstract $collection
|
77 |
+
*/
|
78 |
+
public function applyUrlSorting(Mage_Eav_Model_Entity_Collection_Abstract &$collection)
|
79 |
{
|
80 |
$order = $this->getCurrentOrder();
|
81 |
$dir = $this->getCurrentPosition();
|
82 |
+
//echo 'console.log("Block sorting: '.$order.' / '.$dir.'");';
|
83 |
+
|
84 |
if ($order) {
|
85 |
$sortingData = $this->catalogConfig->getAttributesUsedForSortBy();
|
86 |
|
app/code/community/Yireo/GoogleTagManager/Block/Search.php
CHANGED
@@ -33,7 +33,11 @@ class Yireo_GoogleTagManager_Block_Search extends Yireo_GoogleTagManager_Block_C
|
|
33 |
$collection->setCurPage($this->getCurrentPage())->setPageSize($this->getLimit());
|
34 |
}
|
35 |
|
36 |
-
$this->
|
|
|
|
|
|
|
|
|
37 |
|
38 |
return $collection;
|
39 |
}
|
33 |
$collection->setCurPage($this->getCurrentPage())->setPageSize($this->getLimit());
|
34 |
}
|
35 |
|
36 |
+
if ($this->moduleHelper->getConfigValue('category_sorting') == 'block' && $searchListBlock->getSortBy()) {
|
37 |
+
$collection->setOrder($searchListBlock->getSortBy(), $searchListBlock->getDefaultDirection());
|
38 |
+
} else {
|
39 |
+
$this->applySorting($collection);
|
40 |
+
}
|
41 |
|
42 |
return $collection;
|
43 |
}
|
app/code/community/Yireo/GoogleTagManager/Block/Tag.php
CHANGED
@@ -33,7 +33,11 @@ class Yireo_GoogleTagManager_Block_Tag extends Yireo_GoogleTagManager_Block_Cate
|
|
33 |
$collection->setCurPage($this->getCurrentPage())->setPageSize($this->getLimit());
|
34 |
}
|
35 |
|
36 |
-
$this->
|
|
|
|
|
|
|
|
|
37 |
|
38 |
return $collection;
|
39 |
}
|
33 |
$collection->setCurPage($this->getCurrentPage())->setPageSize($this->getLimit());
|
34 |
}
|
35 |
|
36 |
+
if ($this->moduleHelper->getConfigValue('category_sorting') == 'block' && $taggedProductsBlock->getSortBy()) {
|
37 |
+
$collection->setOrder($taggedProductsBlock->getSortBy(), $taggedProductsBlock->getDefaultDirection());
|
38 |
+
} else {
|
39 |
+
$this->applySorting($collection);
|
40 |
+
}
|
41 |
|
42 |
return $collection;
|
43 |
}
|
app/code/community/Yireo/GoogleTagManager/Model/Backend/Category/Sorting.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Model_Backend_Category_Sorting
|
13 |
+
*/
|
14 |
+
class Yireo_GoogleTagManager_Model_Backend_Category_Sorting
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* @var Yireo_GoogleTagManager_Helper_Data
|
18 |
+
*/
|
19 |
+
protected $helper;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Yireo_GoogleTagManager_Model_Observer constructor.
|
23 |
+
*/
|
24 |
+
public function __construct()
|
25 |
+
{
|
26 |
+
$this->helper = Mage::helper('googletagmanager');
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Options getter
|
31 |
+
*
|
32 |
+
* @return array
|
33 |
+
*/
|
34 |
+
public function toOptionArray()
|
35 |
+
{
|
36 |
+
return array(
|
37 |
+
array('value' => 'url', 'label'=> $this->helper->__('URL interpretation')),
|
38 |
+
array('value' => 'block', 'label'=> $this->helper->__('Original block sorting')),
|
39 |
+
);
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
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 |
|
@@ -84,6 +84,7 @@
|
|
84 |
<active>1</active>
|
85 |
<method>1</method>
|
86 |
<category_products>3</category_products>
|
|
|
87 |
</settings>
|
88 |
</googletagmanager>
|
89 |
</default>
|
12 |
<config>
|
13 |
<modules>
|
14 |
<Yireo_GoogleTagManager>
|
15 |
+
<version>1.3.24</version>
|
16 |
</Yireo_GoogleTagManager>
|
17 |
</modules>
|
18 |
|
84 |
<active>1</active>
|
85 |
<method>1</method>
|
86 |
<category_products>3</category_products>
|
87 |
+
<category_sorting>url</category_sorting>
|
88 |
</settings>
|
89 |
</googletagmanager>
|
90 |
</default>
|
app/code/community/Yireo/GoogleTagManager/etc/system.xml
CHANGED
@@ -71,6 +71,15 @@
|
|
71 |
<show_in_website>1</show_in_website>
|
72 |
<show_in_store>1</show_in_store>
|
73 |
</debug>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
<category_products translate="label">
|
75 |
<label>Load Products in Category</label>
|
76 |
<comment><![CDATA[Number of products to load in a specific category overview. 0 to disable]]></comment>
|
71 |
<show_in_website>1</show_in_website>
|
72 |
<show_in_store>1</show_in_store>
|
73 |
</debug>
|
74 |
+
<category_sorting translate="label">
|
75 |
+
<label>Sorting method</label>
|
76 |
+
<frontend_type>select</frontend_type>
|
77 |
+
<source_model>googletagmanager/backend_category_sorting</source_model>
|
78 |
+
<sort_order>20</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>1</show_in_store>
|
82 |
+
</category_sorting>
|
83 |
<category_products translate="label">
|
84 |
<label>Load Products in Category</label>
|
85 |
<comment><![CDATA[Number of products to load in a specific category overview. 0 to disable]]></comment>
|
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.24</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-16</date><time>23:07:44</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="70857bddee590892ab60ca469cc4cfa0"/><file name="system.xml" hash="e6bd6c6556b2a3b346ac72724994a0f0"/></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 name="Category"><file name="Sorting.php" hash="0b3317d830f43e839de2ed997f87f7a0"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="1a543331c2c2d0dd17cbd4693d57947e"/></dir><dir name="Block"><file name="Category.php" hash="a9f56b114c258d49d867e8168ebdb713"/><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="b4bb0a58af91fec3142c5cc9a34a64e8"/><file name="Tag.php" hash="bcee9cb9acd47afc43a930d2bcdf88ff"/></dir></dir></dir></dir></dir></dir></target></contents></package>
|