ET_AdvancedCompare - Version 0.5.0

Version Notes

stable release

Download this release

Release Info

Developer Magento Core Team
Extension ET_AdvancedCompare
Version 0.5.0
Comparing to
See all releases


Version 0.5.0

app/code/community/ET/AdvancedCompare/Block/List.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ET Web Solutions
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade to newer
12
+ * versions in the future.
13
+ *
14
+ * @category ET
15
+ * @package ET_AdvancedCompare
16
+ * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
+ */
20
+
21
+ class ET_AdvancedCompare_Block_List extends Mage_Catalog_Block_Product_Compare_List
22
+ {
23
+ public function setTemplate($template)
24
+ {
25
+ $replacetemplate = Mage::getStoreConfig('advancedcompare/popup/replacetemplate');
26
+
27
+ if ($replacetemplate)
28
+ {
29
+ $version = substr(Mage::getVersion(),0,3);
30
+
31
+ switch ($version)
32
+ {
33
+ case '1.3':
34
+ $template = 'et_advancedcompare/list_13x.phtml';
35
+ break;
36
+
37
+ default:
38
+ $template = 'et_advancedcompare/list_15x.phtml';
39
+
40
+ }
41
+ }
42
+
43
+ return parent::setTemplate($template);
44
+ }
45
+ }
app/code/community/ET/AdvancedCompare/Helper/Data.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ET Web Solutions
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade to newer
12
+ * versions in the future.
13
+ *
14
+ * @category ET
15
+ * @package ET_AdvancedCompare
16
+ * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
+ */
20
+
21
+ class ET_AdvancedCompare_Helper_Data extends Mage_Catalog_Helper_Product_Compare
22
+ {
23
+ /**
24
+ * Retrieve url for adding product to conpare list
25
+ *
26
+ * @param Mage_Catalog_Model_Product $product
27
+ * @return string
28
+ */
29
+ public function getAddUrl($product)
30
+ {
31
+ $config = Mage::getStoreConfig('advancedcompare/general');
32
+
33
+ if (($config['removecompare']) || (($config['removelink']) && ((bool)($product->getData('remove_compare_link')))))
34
+ return false;
35
+ else
36
+ return parent::getAddUrl($product);
37
+ }
38
+ }
app/code/community/ET/AdvancedCompare/Model/Resource/Eav/Mysql4/Product/Compare/Item/Collection.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ET Web Solutions
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade to newer
12
+ * versions in the future.
13
+ *
14
+ * @category ET
15
+ * @package ET_AdvancedCompare
16
+ * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
+ */
20
+
21
+ // for attribute sorting in compare window
22
+
23
+ //class Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
24
+ class ET_AdvancedCompare_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection
25
+ {
26
+
27
+ public function getComparableAttributes()
28
+ {
29
+ // 1.3.2.3, 1.3.2.4, 1.4.0.0, 1.4.0.1, 1.4.1.1, 1.4.2.0, 1.5.0.1
30
+ // проблема с сортировкой точно существовала до версии 1411, дальше надо проверять.
31
+ // так как функция менялась в разных версиях, то для 13х и для 14х надо разные функции.
32
+
33
+ $sortattributes = Mage::getStoreConfig('advancedcompare/popup/sortattributes');
34
+ if ($sortattributes)
35
+ $version = substr(Mage::getVersion(),0,3);
36
+ else
37
+ $version = 'disabled';
38
+
39
+ switch ($version)
40
+ {
41
+ case '1.3':
42
+ return $this->getComparableAttributes13x();
43
+ break;
44
+
45
+ case '1.4':
46
+ case '1.5':
47
+ return $this->getComparableAttributes14x();
48
+ break;
49
+
50
+ default:
51
+ return parent::getComparableAttributes();
52
+ }
53
+
54
+
55
+
56
+ }
57
+
58
+ public function getComparableAttributes13x()
59
+ {
60
+ if (is_null($this->_comparableAttributes)) {
61
+ $setIds = $this->_getAttributeSetIds();
62
+ if ($setIds) {
63
+ //$attributeIds = $this->_getAttributeIdsBySetIds($setIds);
64
+
65
+ $select = $this->getConnection()->select()
66
+ ->from(array('t1' => $this->getTable('eav/attribute')))
67
+ ->where('t1.is_comparable=?', 1)
68
+ ->joinLeft(array('t2' => $this->getTable('eav/entity_attribute')), 't2.attribute_id=t1.attribute_id')
69
+ //->where('t1.attribute_id IN(?)', $attributeIds);
70
+ ->where('t2.attribute_set_id IN(?)', $setIds)
71
+ ->order(array('t2.attribute_group_id ASC', 't2.sort_order ASC'));
72
+
73
+ $attributesData = $this->getConnection()->fetchAll($select);
74
+
75
+ if ($attributesData) {
76
+ $entityType = 'catalog_product';
77
+ Mage::getSingleton('eav/config')
78
+ ->importAttributesData($entityType, $attributesData);
79
+ foreach ($attributesData as $data) {
80
+ $attribute = Mage::getSingleton('eav/config')
81
+ ->getAttribute($entityType, $data['attribute_code']);
82
+ $this->_comparableAttributes[$attribute->getAttributeCode()] = $attribute;
83
+ }
84
+ unset($attributesData);
85
+ }
86
+ }
87
+ else {
88
+ $this->_comparableAttributes = array();
89
+ }
90
+ }
91
+ return $this->_comparableAttributes;
92
+ }
93
+
94
+
95
+ public function getComparableAttributes14x()
96
+ {
97
+ if (is_null($this->_comparableAttributes)) {
98
+ $this->_comparableAttributes = array();
99
+ $setIds = $this->_getAttributeSetIds();
100
+ if ($setIds) {
101
+ $attributeIds = $this->_getAttributeIdsBySetIds($setIds);
102
+
103
+ $select = $this->getConnection()->select()
104
+ ->from(array('main_table' => $this->getTable('eav/attribute')))
105
+ ->join(
106
+ array('additional_table' => $this->getTable('catalog/eav_attribute')),
107
+ 'additional_table.attribute_id=main_table.attribute_id'
108
+ )
109
+ ->joinLeft(
110
+ array('al' => $this->getTable('eav/attribute_label')),
111
+ 'al.attribute_id = main_table.attribute_id AND al.store_id = ' . (int) $this->getStoreId(),
112
+ array('store_label' => new Zend_Db_Expr('IFNULL(al.value, main_table.frontend_label)'))
113
+ )
114
+ ->joinLeft(
115
+ array('ai' => $this->getTable('eav/entity_attribute')),
116
+ 'ai.attribute_id = main_table.attribute_id'
117
+ )
118
+
119
+ ->where('additional_table.is_comparable=?', 1)
120
+ ->where('main_table.attribute_id IN(?)', $attributeIds)
121
+ ->order(array('ai.attribute_group_id ASC', 'ai.sort_order ASC'));
122
+
123
+ $attributesData = $this->getConnection()->fetchAll($select);
124
+ if ($attributesData) {
125
+ $entityType = 'catalog_product';
126
+ Mage::getSingleton('eav/config')
127
+ ->importAttributesData($entityType, $attributesData);
128
+ foreach ($attributesData as $data) {
129
+ $attribute = Mage::getSingleton('eav/config')
130
+ ->getAttribute($entityType, $data['attribute_code']);
131
+ $this->_comparableAttributes[$attribute->getAttributeCode()] = $attribute;
132
+ }
133
+ unset($attributesData);
134
+ }
135
+ }
136
+ }
137
+ return $this->_comparableAttributes;
138
+ }
139
+
140
+ }
app/code/community/ET/AdvancedCompare/controllers/IndexController.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ET Web Solutions
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade to newer
12
+ * versions in the future.
13
+ *
14
+ * @category ET
15
+ * @package ET_AdvancedCompare
16
+ * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
+ */
20
+
21
+ require_once 'Mage/Catalog/controllers/Product/CompareController.php';
22
+
23
+ class ET_AdvancedCompare_IndexController extends Mage_Catalog_Product_CompareController
24
+ {
25
+
26
+ public function redrawsidebarAction()
27
+ {
28
+ $layout=Mage::getSingleton('core/layout');
29
+
30
+ $update = $layout->getUpdate();
31
+ $renderer=$layout->createBlock('catalog/product_compare_sidebar');
32
+ $renderer->setTemplate("catalog/product/compare/sidebar.phtml");
33
+
34
+ Mage::getSingleton('catalog/session')->getMessages(true);
35
+ $rendererhtml=$renderer->toHtml();
36
+
37
+ $this->getResponse()->setBody(Zend_Json::encode($rendererhtml));
38
+ }
39
+
40
+ public function silentaddAction()
41
+ {
42
+ return $this->addAction();
43
+ }
44
+
45
+ public function silentremoveAction()
46
+ {
47
+ return $this->removeAction();
48
+ }
49
+
50
+ public function silentclearAction()
51
+ {
52
+ return $this->clearAction();
53
+ }
54
+
55
+ protected function _redirectReferer($defaultUrl=null)
56
+ {
57
+ if(($this->getRequest()->getModuleName()=="advancedcompare")&(in_array($this->getRequest()->getActionName(),array("silentadd","silentremove","silentclear"))))
58
+ {
59
+ $this->redrawsidebarAction();
60
+ }
61
+ else
62
+ {
63
+ parent::_redirectReferer($defaultUrl);
64
+ }
65
+ }
66
+
67
+ }
app/code/community/ET/AdvancedCompare/etc/config.xml ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * ET Web Solutions
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade to newer
13
+ * versions in the future.
14
+ *
15
+ * @category ET
16
+ * @package ET_advancedcompare
17
+ * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
18
+ * @contacts support@etwebsolutions.com
19
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <modules>
24
+ <ET_AdvancedCompare>
25
+ <version>0.5.0</version>
26
+ <descr>
27
+ <ru_RU>
28
+ Модуль позволяет отключать возможность добавления товара в список сравнения для каждого товара в отдельности.
29
+ Для определения используется значение атрибута remove_compare_link
30
+ </ru_RU>
31
+ <en_US>
32
+ Allows admin to switch off possibility to add product to compare list for each specific product.
33
+ Uses attribute remove_compare_link.
34
+ </en_US>
35
+ </descr>
36
+ </ET_AdvancedCompare>
37
+ </modules>
38
+
39
+ <global>
40
+ <rewrite>
41
+ <advancedcompare_index>
42
+ <from><![CDATA[#^/catalog/product_compare/#]]></from>
43
+ <to>/advancedcompare/index/</to>
44
+ </advancedcompare_index>
45
+ </rewrite>
46
+
47
+ <helpers>
48
+ <advancedcompare>
49
+ <class>ET_AdvancedCompare_Helper</class>
50
+ </advancedcompare>
51
+ <catalog>
52
+ <rewrite>
53
+ <product_compare>ET_AdvancedCompare_Helper_Data</product_compare>
54
+ </rewrite>
55
+ </catalog>
56
+ </helpers>
57
+
58
+ <blocks>
59
+ <advancedcompare>
60
+ <class>ET_AdvancedCompare_Block</class>
61
+ </advancedcompare>
62
+ <catalog>
63
+ <rewrite>
64
+ <product_compare_list>ET_AdvancedCompare_Block_List</product_compare_list>
65
+ </rewrite>
66
+ </catalog>
67
+ </blocks>
68
+
69
+
70
+ <models>
71
+ <advancedcompare>
72
+ <class>ET_AdvancedCompare_Model</class>
73
+ </advancedcompare>
74
+ <catalog_resource_eav_mysql4>
75
+ <rewrite>
76
+ <product_compare_item_collection>ET_AdvancedCompare_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection</product_compare_item_collection>
77
+ </rewrite>
78
+ </catalog_resource_eav_mysql4>
79
+ </models>
80
+
81
+ <resources>
82
+ <advancedcompare_setup>
83
+ <setup>
84
+ <module>ET_AdvancedCompare</module>
85
+ <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
86
+ </setup>
87
+ <connection>
88
+ <use>core_setup</use>
89
+ </connection>
90
+ </advancedcompare_setup>
91
+ <advancedcompare_write>
92
+ <connection>
93
+ <use>core_write</use>
94
+ </connection>
95
+ </advancedcompare_write>
96
+ <advancedcompare_read>
97
+ <connection>
98
+ <use>core_read</use>
99
+ </connection>
100
+ </advancedcompare_read>
101
+ </resources>
102
+ </global>
103
+
104
+ <default>
105
+ <advancedcompare>
106
+ <general>
107
+ <removecompare>0</removecompare>
108
+ <removelink>1</removelink>
109
+ </general>
110
+ <noreload>
111
+ <enablenorealod>1</enablenorealod>
112
+ </noreload>
113
+ <popup>
114
+ <replacetemplate>0</replacetemplate>
115
+ <showlabelafter>3</showlabelafter>
116
+ <sortattributes>0</sortattributes>
117
+ </popup>
118
+ </advancedcompare>
119
+ </default>
120
+
121
+ <frontend>
122
+ <layout>
123
+ <updates>
124
+ <advancedcompare>
125
+ <file>et_advancedcompare.xml</file>
126
+ </advancedcompare>
127
+ </updates>
128
+ </layout>
129
+ <routers>
130
+ <advancedcompare>
131
+ <use>standard</use>
132
+ <args>
133
+ <module>ET_AdvancedCompare</module>
134
+ <frontName>advancedcompare</frontName>
135
+ </args>
136
+ </advancedcompare>
137
+ </routers>
138
+ <translate>
139
+ <modules>
140
+ <ET_AdvancedCompare>
141
+ <files>
142
+ <default>ET_AdvancedCompare.csv</default>
143
+ </files>
144
+ </ET_AdvancedCompare>
145
+ </modules>
146
+ </translate>
147
+ </frontend>
148
+
149
+ <adminhtml>
150
+ <acl>
151
+ <resources>
152
+ <admin>
153
+ <children>
154
+ <system>
155
+ <children>
156
+ <config>
157
+ <children>
158
+ <advancedcompare translate="title" module="advancedcompare">
159
+ <title>ET Advanced Compare Section</title>
160
+ <sort_order>400</sort_order>
161
+ </advancedcompare>
162
+ </children>
163
+ </config>
164
+ </children>
165
+ </system>
166
+ </children>
167
+ </admin>
168
+ </resources>
169
+ </acl>
170
+ <translate>
171
+ <modules>
172
+ <ET_AdvancedCompare>
173
+ <files>
174
+ <default>ET_AdvancedCompare.csv</default>
175
+ </files>
176
+ </ET_AdvancedCompare>
177
+ </modules>
178
+ </translate>
179
+ </adminhtml>
180
+
181
+ </config>
app/code/community/ET/AdvancedCompare/etc/system.xml ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * ET Web Solutions
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade to newer
13
+ * versions in the future.
14
+ *
15
+ * @category ET
16
+ * @package ET_AdvancedCompare
17
+ * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
18
+ * @contacts support@etwebsolutions.com
19
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <tabs>
24
+ <etall translate="label">
25
+ <label>ET Extensions</label>
26
+ <sort_order>400</sort_order>
27
+ </etall>
28
+ </tabs>
29
+
30
+ <sections>
31
+ <advancedcompare translate="label" module="advancedcompare">
32
+ <label>Advanced Compare</label>
33
+ <tab>etall</tab>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>300</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <groups>
40
+ <info translate="label">
41
+ <label>Advanced Compare information</label>
42
+ <comment><![CDATA[Support by support@etwebsolutions.com<br/>You can hire our team to customize this extension to your theme. Contact us at sales@etwebsolutions.com]]></comment>
43
+ <frontend_type>text</frontend_type>
44
+ <sort_order>1</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ </info>
49
+ <general translate="label">
50
+ <label>Remove Compare Options</label>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>10</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ <fields>
57
+ <removecompare translate="label comment">
58
+ <label>Remove Compare function</label>
59
+ <comment>If Yes - Removes all Add to compare links and compare blok left or right.</comment>
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>adminhtml/system_config_source_yesno</source_model>
62
+ <sort_order>10</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </removecompare>
67
+ <removelink translate="label comment">
68
+ <label>Remove selected links</label>
69
+ <comment>If Yes - Add to compare link will be removed for products with attribute remove_compare_link=Yes</comment>
70
+ <frontend_type>select</frontend_type>
71
+ <source_model>adminhtml/system_config_source_yesno</source_model>
72
+ <sort_order>20</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </removelink>
77
+ </fields>
78
+ </general>
79
+ <noreload translate="label">
80
+ <label>Compare No Reload Options</label>
81
+ <frontend_type>text</frontend_type>
82
+ <sort_order>20</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ <fields>
87
+ <enablenorealod translate="label comment">
88
+ <label>Enable No Reload function</label>
89
+ <comment>If Yes - add to compare, remove from compare and clear compare list will work without reloading page.</comment>
90
+ <frontend_type>select</frontend_type>
91
+ <source_model>adminhtml/system_config_source_yesno</source_model>
92
+ <sort_order>10</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </enablenorealod>
97
+ </fields>
98
+ </noreload>
99
+ <popup translate="label">
100
+ <label>Compare Popup Window Options</label>
101
+ <frontend_type>text</frontend_type>
102
+ <sort_order>30</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ <fields>
107
+ <replacetemplate translate="label comment">
108
+ <label>Replace Popup template</label>
109
+ <comment>If Yes - advanced template will be used. Added ability to hide attributes that does not differs.</comment>
110
+ <frontend_type>select</frontend_type>
111
+ <source_model>adminhtml/system_config_source_yesno</source_model>
112
+ <sort_order>10</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <show_in_store>1</show_in_store>
116
+ </replacetemplate>
117
+ <showlabelafter translate="label comment">
118
+ <label>Show label after</label>
119
+ <comment>Shows attribute labels after X products. Default: 3.</comment>
120
+ <frontend_type>text</frontend_type>
121
+ <sort_order>20</sort_order>
122
+ <show_in_default>1</show_in_default>
123
+ <show_in_website>1</show_in_website>
124
+ <show_in_store>1</show_in_store>
125
+ </showlabelafter>
126
+ <sortattributes translate="label comment">
127
+ <label>Sort attributes</label>
128
+ <comment>If Yes - attributes in compare window will be sorted like in attribute set (in some Magento versions there is no sorting by default).</comment>
129
+ <frontend_type>select</frontend_type>
130
+ <source_model>adminhtml/system_config_source_yesno</source_model>
131
+ <sort_order>30</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>1</show_in_store>
135
+ </sortattributes>
136
+ </fields>
137
+ </popup>
138
+ </groups>
139
+ </advancedcompare>
140
+ </sections>
141
+ </config>
app/code/community/ET/AdvancedCompare/sql/advancedcompare_setup/mysql4-install-0.1.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ET Web Solutions
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade to newer
12
+ * versions in the future.
13
+ *
14
+ * @category ET
15
+ * @package ET_AdvancedCompare
16
+ * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
+ */
20
+
21
+ $installer = $this;
22
+ /* $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
23
+
24
+ $installer->startSetup();
25
+ $setup = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('core_setup');
26
+
27
+ $setup->addAttribute('catalog_product', 'remove_compare_link', array(
28
+ 'group' => 'General',
29
+ 'type' => 'int',
30
+ 'backend' => '',
31
+ 'frontend' => '',
32
+ 'label' => 'Remove Compare Link',
33
+ 'note' => '',
34
+ 'input' => 'boolean',
35
+ 'class' => '',
36
+ 'source' => 'eav/entity_attribute_source_boolean',
37
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
38
+ 'visible' => true,
39
+ 'required' => true,
40
+ 'user_defined' => true,
41
+ 'default' => '0',
42
+ 'searchable' => false,
43
+ 'filterable' => false,
44
+ 'comparable' => false,
45
+ 'visible_on_front' => false,
46
+ 'is_configurable' => false,
47
+ 'used_in_product_listing' => true,
48
+ 'unique' => false
49
+ ));
50
+
51
+ $installer->endSetup();
app/code/community/ET/ET_AdvancedCompare_ChangeLog.txt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ =====================================
2
+ This file describes changes between versions of module ET_AdvancedCompare for Magento.
3
+
4
+ Legend:
5
+ * bug fix
6
+ + added functionality
7
+ - removed functionality
8
+
9
+ =====================================
10
+ TODO:
11
+
12
+ =====================================
13
+
14
+ ver. 0.5.0
15
+ + Added ability to add products to compare list without reloading page (AJAX)
16
+ + Added advanced compare product template (only for default design)
17
+ + Added attribute sorting in compare window
18
+
19
+ ver. 0.1.0
20
+ + stable release
app/code/community/ET/ET_AdvancedCompare_Description.txt ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ==== Description / Для чего этот модуль? ====
2
+
3
+ EN:
4
+ This extension adds some freedom in product comparison management feature.
5
+
6
+ Extension features:
7
+ 1. Extension allows to disable comparation on your shop (everywhere or on specified store view)
8
+ 2. Extension adds attribute remove_compare_link. Depending on its value (Yes/No) the link for adding product to compare is shown or not shown (for example, if you want to forbid adding to compare for products with small attribute amounts - books, video games, etc.)
9
+ 3. Extension increases shop performance by allowing customers to work with list of products for comparison without reloading page (add/remove product to list, clear list).
10
+ 4. Extension contains advanced template for product comparison page. By default it doesn't display attributes, which values are the same for every product on the page. Customer can switch this feature off and on without reloading the page.
11
+ 5. Extension adds sorting by attribute to product compare window (as in attribute set edit form in admin panel).
12
+
13
+
14
+ RU:
15
+ Модуль расширяет возможности владельца магазина по управлению функцией сравнения товара.
16
+
17
+ Функции модуля:
18
+ 1. Модуль позволяет отключать функцию сравнения на сайте (везде или на конкретном представлении магазина)
19
+ 2. Модуль добавляет атрибут remove_compare_link.
20
+ В зависимости от значения этого атрибута (Да/Нет) у товара показывается или нет ссылка на добавление товара в список сравнения (если надо запретить добавлять в сравнение только часть товаров, у которых мало атрибутов. Например книги, компьютерные игры и т.п.)
21
+
22
+ 3. Модуль может ускорять работу сайта, так как позволяет работать со списком сравнения без перезагрузки страницы (добавление, удаление и очистка списка)
23
+ 4. В комплекте присутствует расширенный шаблон для страницы сравнения
24
+ (По умолчанию не показывает атрибуты, значения которых у всех товаров на странице сравнения одинаковое. Пользователь может без перезагрузки страницы включить их просмотр.)
25
+ 5. Добавляет сортировку атрибутов в окне сравнения товаров (сортирует как в наборе атрибутов)
26
+
27
+
28
+ ====Features / Особенности модуля====
29
+
30
+ * Open source code (no encryption and obfuscation)
31
+ * Code follows Magento development standards
32
+ * Extension is available on 2 languages (ru_RU, en_US) and you can easy add your own
33
+ * All extension settings are available on admin panel
34
+
35
+ * Открытый исходный код
36
+ * Код написан придерживаясь принятых стандартов в разработке для Магенто
37
+ * Доступен на 2-ух языках (ru_RU, en_US) и легко добавляются новые переводы
38
+ * Все настройки модуля доступны в панели администрирования
39
+
40
+
41
+
42
+
43
+ ====Version Compatibility / Совместимость версий====
44
+ 1.3.х (tested in 1.3.2.4.)
45
+ 1.4.x (tested in 1.4.1.1.)
46
+ 1.5.x (tested in 1.5.0.1. 1.5.1.0.)
47
+
48
+
49
+ ====Module tags====
50
+ disable compare, compare product, remove link, add to cart no reload
51
+ ajax add to cart
52
+
53
+
54
+
55
+
56
+ ====Установка/Installation====
57
+
58
+ * Disable Compiler, if it is enabled (System -> Tools -> Compilation)
59
+ * Disable cache, if it is enabled (System -> Cache Management)
60
+ * Install the extension
61
+ * Log off admin panel (Log Out)
62
+ * Log into admin panel (enter your login and password)
63
+ * Set Advanced Compare parameters (System -> Configuration -> Advanced Compare)
64
+ * Enable compilation and cache if needed
65
+ * Rebuild "Rebuild Flat Catalog Product" (actual for versions 1.3.x)
66
+
67
+
68
+ * Отключите компиляцию, если включена (Система -> Инструменты -> Компиляция)
69
+ * Отключите кэш, если включён (Система -> Управление кэшем)
70
+ * Установите модуль
71
+ * Выйдите из панели администрирования (Выйти)
72
+ * Войдите в панель администрирования (введите логин/пароль)
73
+ * Настройте параметры отображения модуля (Система -> Конфигурация -> Advanced Compare)
74
+ * Если необходимо включите компиляцию и кэш
75
+ * Перестройте "Rebuild Flat Catalog Product" (актуально для версий 1.3.x)
app/code/community/ET/ET_AdvancedCompare_LICENSE.txt ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ http://opensource.org/licenses/afl-3.0.php
2
+
3
+ Academic Free License ("AFL") v. 3.0
4
+ This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
5
+
6
+ Licensed under the Academic Free License version 3.0
7
+
8
+ 1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
9
+
10
+ a) to reproduce the Original Work in copies, either alone or as part of a collective work;
11
+
12
+ b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
13
+
14
+ c) to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
15
+
16
+ d) to perform the Original Work publicly; and
17
+
18
+ e) to display the Original Work publicly.
19
+
20
+ 2) Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
21
+
22
+ 3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
23
+
24
+ 4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
25
+
26
+ 5) External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
27
+
28
+ 6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
29
+
30
+ 7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
31
+
32
+ 8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
33
+
34
+ 9) Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
35
+
36
+ 10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
37
+
38
+ 11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
39
+
40
+ 12) Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
41
+
42
+ 13) Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
43
+
44
+ 14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
45
+
46
+ 15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
47
+
48
+ 16) Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
app/design/frontend/default/default/layout/et_advancedcompare.xml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * ET Web Solutions
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade to newer
13
+ * versions in the future.
14
+ *
15
+ * @category ET
16
+ * @package ET_AdvancedCompare
17
+ * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
18
+ * @contacts support@etwebsolutions.com
19
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
+ */
21
+ -->
22
+
23
+ <layout version="0.1.0">
24
+ <default>
25
+ <reference name="head">
26
+ <action method="addItem" ifconfig="advancedcompare/noreload/enablenorealod"><type>skin_js</type><name>js/noreload.js</name></action>
27
+ <action method="addItem" ifconfig="advancedcompare/noreload/enablenorealod"><type>skin_css</type><name>css/noreload.css</name></action>
28
+ </reference>
29
+
30
+ <reference name="right">
31
+ <action method="unsetChild" ifconfig="advancedcompare/general/removecompare"><name>catalog.compare.sidebar</name></action>
32
+ </reference>
33
+ <reference name="left">
34
+ <action method="unsetChild" ifconfig="advancedcompare/general/removecompare"><name>catalog.compare.sidebar</name></action>
35
+ </reference>
36
+ </default>
37
+
38
+ <customer_account>
39
+ <reference name="left">
40
+ <action method="unsetChild" ifconfig="advancedcompare/general/removecompare"><name>catalog.compare.sidebar</name></action>
41
+ </reference>
42
+ <reference name="right">
43
+ <action method="unsetChild" ifconfig="advancedcompare/general/removecompare"><name>catalog.compare.sidebar</name></action>
44
+ </reference>
45
+ </customer_account>
46
+
47
+ </layout>
app/design/frontend/default/default/template/et_advancedcompare/list_13x.phtml ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ET Web Solutions
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade to newer
12
+ * versions in the future.
13
+ *
14
+ * @category ET
15
+ * @package ET_AdvancedCompare
16
+ * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
+ */
20
+
21
+ $show_labels_after = (int)Mage::getStoreConfig('advancedcompare/popup/showlabelafter');
22
+ if ($show_labels_after < 1) $show_labels_after = 3;
23
+ $checkbox_label = Mage::helper('advancedcompare')->__('Show similar rows');
24
+
25
+
26
+ $rows = array();
27
+ foreach ($this->getAttributes() as $_attribute) {
28
+ $row_data = array();
29
+ $row_data['have_different_values'] = false;
30
+ $row_data['html'] = '';
31
+
32
+ $first_value = '';
33
+ $first_value_set = false;
34
+
35
+ $_i = 0;
36
+
37
+ foreach($this->getItems() as $_item) {
38
+ if($_i++%$show_labels_after==0) {
39
+ $row_data['html'] .= '<td class="label">'.$this->__($_attribute->getFrontendLabel()).'</td>';
40
+ }
41
+ $row_data['html'] .= '<td>';
42
+ switch ($_attribute->getAttributeCode()) {
43
+ case "price":
44
+ $row_data['html'] .= $this->getPriceHtml($_item, true);
45
+ break;
46
+ case "small_image":
47
+ $row_data['html'] .= '<img src="'.$this->helper('catalog/image')->init($_item, 'small_image')->resize(125, 125).'" width="125" height="125" alt="'.$this->htmlEscape($_item->getName()).'" />';
48
+ break;
49
+ default:
50
+ $value = nl2br($this->getProductAttributeValue($_item, $_attribute));
51
+ $row_data['html'] .= $value;
52
+
53
+ if (!$first_value_set) {
54
+ $first_value_set = true;
55
+ $first_value = $value;
56
+ }
57
+
58
+ if ($value != $first_value) {
59
+ $row_data['have_different_values'] = true;
60
+ }
61
+
62
+ break;
63
+ }
64
+ $row_data['html'] .= '</td>';
65
+ }
66
+
67
+ $rows[] = $row_data;
68
+ }
69
+
70
+ ?>
71
+
72
+ <style type="text/css">
73
+ html { overflow-x:auto !important; }
74
+ .diff td { color:black; }
75
+ .similar * { color:#838081; }
76
+
77
+ .hiddenRow { display:none; }
78
+ .visibleRow { }
79
+
80
+ .topcheckbox { position:absolute; top:55px; left:30px; }
81
+ .bottomcheckbox { padding-top:10px; }
82
+ </style>
83
+
84
+ <div class="topcheckbox">
85
+ <input type="checkbox" id="chb" onclick="toggleSimilarRows(this.checked);"> <label for="chb"><?=$checkbox_label;?></label>
86
+ </div>
87
+ <div class="page-head button-level">
88
+ <h3><?php echo $this->__('Compare Products') ?></h3>
89
+ <a href="#" class="link-print right" onclick="print();"><?php echo $this->__('Print This Page') ?></a>
90
+ </div>
91
+ <?php $_total=$this->getItems()->getSize() ?>
92
+ <?php if($_total): ?>
93
+ <div class="compare-products">
94
+ <table cellspacing="0" class="data-table box-table catalog-listing" id="product_comparison">
95
+ <?php if ($_total>2): ?>
96
+ <tbody class="remove-buttons">
97
+ <tr>
98
+ <?php $_i=0 ?>
99
+ <?php foreach($this->getItems() as $_item): ?>
100
+ <?php if($_i++%$show_labels_after==0): ?>
101
+ <td>&nbsp;</td>
102
+ <?php endif; ?>
103
+ <td><a href="#" onclick="setLocation('<?php echo $this->helper('catalog/product_compare')->getRemoveUrl($_item) ?>');window.opener.location.reload();"><img src="<?php echo $this->getSkinUrl('images/chart_remove.gif') ?>" alt="<?php echo $this->__('Remove Product') ?>" /></a></td>
104
+ <?php endforeach; ?>
105
+ </tr>
106
+ </tbody>
107
+ <?php endif ?>
108
+ <tbody>
109
+ <tr class="first">
110
+ <?php $_i=0 ?>
111
+ <?php foreach($this->getItems() as $_item): ?>
112
+ <?php if($_i++%$show_labels_after==0): ?>
113
+ <td class="label">&nbsp;</td>
114
+ <?php endif; ?>
115
+ <td>
116
+ <a href="#" onclick="setPLocation('<?php echo $_item->getProductUrl() ?>', true)" title="<?php echo $this->htmlEscape($_item->getName()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(125, 125); ?>" width="125" height="125" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" /></a>
117
+ <h5><a href="#" onclick="setPLocation('<?php echo $_item->getProductUrl() ?>', true)" title="<?php echo $this->htmlEscape($_item->getName()) ?>"><?php echo $this->htmlEscape($_item->getName()) ?></a></h5>
118
+ <?php echo $this->getReviewsSummaryHtml($_item, 'short') ?>
119
+ <?php echo $this->getPriceHtml($_item, true) ?>
120
+ <?php if($_item->isSaleable()): ?>
121
+ <button class="form-button" onclick="setPLocation('<?php echo $this->helper('catalog/product_compare')->getAddToCartUrl($_item) ?>', true)"><span><?php echo $this->__('Add to Cart') ?></span></button><br/>
122
+ <?php else: ?>
123
+ <div class="out-of-stock"><?php echo $this->__('Out of stock') ?></div>
124
+ <?php endif; ?>
125
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
126
+ <a href="#" onclick="setPLocation('<?php echo $this->helper('catalog/product_compare')->getAddToWishlistUrl($_item) ?>', true)" class="link-cart"><small><?php echo $this->__('Add to Wishlist') ?></small></a>
127
+ <?php endif; ?>
128
+ </td>
129
+ <?php endforeach; ?>
130
+ </tr>
131
+ </tbody>
132
+ <tbody id="full" class="hiddenRow">
133
+ <? foreach ($rows as $row) : ?>
134
+ <? if ($row['have_different_values']) :?>
135
+ <tr class="diff">
136
+ <? else: ?>
137
+ <tr class="similar">
138
+ <? endif;?>
139
+ <?=$row['html'];?>
140
+ </tr>
141
+ <? endforeach; ?>
142
+ </tbody>
143
+ <tbody id="short" class="visibleRow">
144
+ <? foreach ($rows as $row) : ?>
145
+ <? if ($row['have_different_values']) :?>
146
+ <tr>
147
+ <?=$row['html'];?>
148
+ </tr>
149
+ <? endif;?>
150
+ <? endforeach; ?>
151
+ </tbody>
152
+ <tbody class="attribute-cart">
153
+ <tr>
154
+ <?php $_i=0 ?>
155
+ <?php foreach($this->getItems() as $_item): ?>
156
+ <?php if($_i++%$show_labels_after==0): ?>
157
+ <td class="label">&nbsp;</td>
158
+ <?php endif; ?>
159
+ <td>
160
+ <?php echo $this->getPriceHtml($_item, true) ?>
161
+ <?php if($_item->isSaleable()): ?>
162
+ <button class="form-button" onclick="setPLocation('<?php echo $this->helper('catalog/product_compare')->getAddToCartUrl($_item) ?>', true)"><span><?php echo $this->__('Add to Cart') ?></span></button><br/>
163
+ <?php else: ?>
164
+ <div class="out-of-stock"><?php echo $this->__('Out of stock') ?></div>
165
+ <?php endif; ?>
166
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
167
+ <a href="#" onclick="setPLocation('<?php echo $this->helper('catalog/product_compare')->getAddToWishlistUrl($_item) ?>', true)" class="link-cart"><small><?php echo $this->__('Add to Wishlist') ?></small></a>
168
+ <?php endif; ?>
169
+ </td>
170
+ <?php endforeach; ?>
171
+ </tr>
172
+ </tbody>
173
+ </table>
174
+
175
+ <div class="bottomcheckbox">
176
+ <input type="checkbox" id="chb2" onclick="toggleSimilarRows(this.checked);"> <label for="chb2"><?=$checkbox_label;?></label>
177
+ </div>
178
+
179
+ <div class="button-set">
180
+ <button class="form-button" onclick="window.close();"><span><?php echo $this->__('Close Window') ?></span></button>
181
+ </div>
182
+ </div>
183
+ <script type="text/javascript">
184
+ decorateTable('product_comparison');
185
+
186
+ function toggleSimilarRows(show) {
187
+ if (show == true) {
188
+ document.getElementById('full').className = 'visibleRow';
189
+ document.getElementById('short').className = 'hiddenRow';
190
+ document.getElementById('chb').checked = true;
191
+ document.getElementById('chb2').checked = true;
192
+ } else {
193
+ document.getElementById('full').className = 'hiddenRow';
194
+ document.getElementById('short').className = 'visibleRow';
195
+ document.getElementById('chb').checked = false;
196
+ document.getElementById('chb2').checked = false;
197
+ }
198
+ }
199
+ </script>
200
+ <?php else: ?>
201
+ <script type="text/javascript">window.close();</script>
202
+ <?php endif; ?>
app/design/frontend/default/default/template/et_advancedcompare/list_15x.phtml ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ET Web Solutions
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade to newer
12
+ * versions in the future.
13
+ *
14
+ * @category ET
15
+ * @package ET_AdvancedCompare
16
+ * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
+ */
20
+
21
+ /* @var $this Mage_Catalog_Block_Product_Compare_List */
22
+
23
+ $show_labels_after = (int)Mage::getStoreConfig('advancedcompare/popup/showlabelafter');
24
+ if ($show_labels_after < 1) $show_labels_after = 3;
25
+ $checkbox_label = Mage::helper('advancedcompare')->__('Show similar rows');
26
+
27
+
28
+ $rows = array();
29
+ foreach ($this->getAttributes() as $_attribute) {
30
+ $row_data = array();
31
+ $row_data['have_different_values'] = false;
32
+ $row_data['html'] = '';
33
+
34
+ $first_value = '';
35
+ $first_value_set = false;
36
+
37
+ $_i = 0;
38
+
39
+ foreach($this->getItems() as $_item) {
40
+ if($_i++%$show_labels_after==0) {
41
+ $row_data['html'] .= '<th><span class="nobr">'.$_attribute->getStoreLabel().'</span></th>';
42
+ }
43
+ $row_data['html'] .= '<td>';
44
+ switch ($_attribute->getAttributeCode()) {
45
+ case "price":
46
+ $row_data['html'] .= $this->getPriceHtml($_item, true, '-compare-list-' . $_attribute->getCode());
47
+ break;
48
+ case "small_image":
49
+ $row_data['html'] .= '<img src="'.$this->helper('catalog/image')->init($_item, 'small_image')->resize(125, 125).'" width="125" height="125" alt="'.$this->htmlEscape($_item->getName()).'" title="'.$this->htmlEscape($_item->getName()).'" />';
50
+ break;
51
+ case "date":
52
+ $row_data['html'] .= substr($this->getProductAttributeValue($_item, $_attribute),0,10);
53
+ break;
54
+ default:
55
+ $value = $this->helper('catalog/output')->productAttribute($_item, $this->getProductAttributeValue($_item, $_attribute), $_attribute->getCode());
56
+ $row_data['html'] .= $value;
57
+
58
+ if (!$first_value_set) {
59
+ $first_value_set = true;
60
+ $first_value = $value;
61
+ }
62
+
63
+ if ($value != $first_value) {
64
+ $row_data['have_different_values'] = true;
65
+ }
66
+
67
+ break;
68
+ }
69
+ $row_data['html'] .= '</td>';
70
+ }
71
+
72
+ $rows[] = $row_data;
73
+ }
74
+
75
+ ?>
76
+
77
+
78
+ <style type="text/css">
79
+ html { overflow-x:auto !important; }
80
+ .diff td { color:black; }
81
+ .similar * { color:#838081; }
82
+
83
+ .hiddenRow { display:none; }
84
+ .visibleRow { }
85
+
86
+ .topcheckbox { position:absolute; top:55px; left:30px; }
87
+ .bottomcheckbox { padding-top:10px; }
88
+ </style>
89
+
90
+
91
+ <div class="topcheckbox">
92
+ <input type="checkbox" id="chb" onclick="toggleSimilarRows(this.checked);"> <label for="chb"><?=$checkbox_label;?></label>
93
+ </div>
94
+ <div class="page-title title-buttons">
95
+ <h1><?php echo $this->__('Compare Products') ?></h1>
96
+ <a href="#" onclick="window.print(); return false;" class="link-print"><?php echo $this->__('Print This Page') ?></a>
97
+ </div>
98
+
99
+ <?php $_total=$this->getItems()->getSize() ?>
100
+ <?php if($_total): ?>
101
+ <table class="data-table compare-table" id="product_comparison">
102
+ <?php $_i=0 ?>
103
+ <?php foreach($this->getItems() as $_item): ?>
104
+ <?php if($_i++%$show_labels_after==0): ?>
105
+ <col width="1" />
106
+ <?php endif; ?>
107
+ <col width="<?php echo floor(100/$_total); ?>%" />
108
+ <?php endforeach; ?>
109
+ <?php if ($_total>2): ?>
110
+ <thead>
111
+ <tr>
112
+ <?php $_i=0 ?>
113
+ <?php foreach($this->getItems() as $_item): ?>
114
+ <?php if($_i++%$show_labels_after==0): ?>
115
+ <th>&nbsp;</th>
116
+ <?php endif; ?>
117
+ <td class="a-right"><a href="#" class="btn-remove" onclick="removeItem('<?php echo $this->helper('catalog/product_compare')->getRemoveUrl($_item) ?>');" title="<?php echo $this->__('Remove This Item') ?>"><?php echo $this->__('Remove This Item') ?></a></td>
118
+ <?php endforeach; ?>
119
+ </tr>
120
+ </thead>
121
+ <?php endif ?>
122
+ <tbody>
123
+ <tr class="product-shop-row">
124
+ <?php $_i=0 ?>
125
+ <?php foreach($this->getItems() as $_item): ?>
126
+ <?php if($_i++%$show_labels_after==0): ?>
127
+ <th>&nbsp;</th>
128
+ <?php endif; ?>
129
+ <td>
130
+ <a class="product-image" href="#" onclick="setPLocation('<?php echo $this->getProductUrl($_item) ?>', true)" title="<?php echo $this->stripTags($_item->getName(), null, true) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(125, 125); ?>" width="125" height="125" alt="<?php echo $this->stripTags($_item->getName(), null, true) ?>" /></a>
131
+ <h2 class="product-name"><a href="#" onclick="setPLocation('<?php echo $this->getProductUrl($_item) ?>', true)" title="<?php echo $this->stripTags($_item->getName(), null, true) ?>"><?php echo $this->helper('catalog/output')->productAttribute($_item, $_item->getName(), 'name') ?></a></h2>
132
+ <?php echo $this->getReviewsSummaryHtml($_item, 'short') ?>
133
+ <?php echo $this->getPriceHtml($_item, true, '-compare-list-top') ?>
134
+ <?php if($_item->isSaleable()): ?>
135
+ <p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setPLocation('<?php echo $this->helper('catalog/product_compare')->getAddToCartUrl($_item) ?>', true)"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
136
+ <?php else: ?>
137
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
138
+ <?php endif; ?>
139
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
140
+ <ul class="add-to-links">
141
+ <li><a href="#" class="link-wishlist" onclick="setPLocation('<?php echo $this->getAddToWishlistUrl($_item) ?>', true)"><?php echo $this->__('Add to Wishlist') ?></a></li>
142
+ </ul>
143
+ <?php endif; ?>
144
+ </td>
145
+ <?php endforeach; ?>
146
+ </tr>
147
+ </tbody>
148
+ <tbody id="full" class="hiddenRow">
149
+ <? foreach ($rows as $row) : ?>
150
+ <? if ($row['have_different_values']) :?>
151
+ <tr class="diff">
152
+ <? else: ?>
153
+ <tr class="similar">
154
+ <? endif;?>
155
+ <?=$row['html'];?>
156
+ </tr>
157
+ <? endforeach; ?>
158
+ </tbody>
159
+ <tbody id="short" class="visibleRow">
160
+ <? foreach ($rows as $row) : ?>
161
+ <? if ($row['have_different_values']) :?>
162
+ <tr>
163
+ <?=$row['html'];?>
164
+ </tr>
165
+ <? endif;?>
166
+ <? endforeach; ?>
167
+ </tbody>
168
+ <tbody>
169
+ <tr class="add-to-row">
170
+ <?php $_i=0 ?>
171
+ <?php foreach($this->getItems() as $_item): ?>
172
+ <?php if($_i++%$show_labels_after==0): ?>
173
+ <th>&nbsp;</th>
174
+ <?php endif; ?>
175
+ <td>
176
+ <?php echo $this->getPriceHtml($_item, true, '-compare-list-bottom') ?>
177
+ <?php if($_item->isSaleable()): ?>
178
+ <p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setPLocation('<?php echo $this->helper('catalog/product_compare')->getAddToCartUrl($_item) ?>', true)"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
179
+ <?php else: ?>
180
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
181
+ <?php endif; ?>
182
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
183
+ <ul class="add-to-links">
184
+ <li><a href="#" class="link-wishlist" onclick="setPLocation('<?php echo $this->getAddToWishlistUrl($_item) ?>', true)"><?php echo $this->__('Add to Wishlist') ?></a></li>
185
+ </ul>
186
+ <?php endif; ?>
187
+ </td>
188
+ <?php endforeach; ?>
189
+ </tr>
190
+ </tbody>
191
+ </table>
192
+ <div class="bottomcheckbox">
193
+ <input type="checkbox" id="chb2" onclick="toggleSimilarRows(this.checked);"> <label for="chb2"><?=$checkbox_label;?></label>
194
+ </div>
195
+ <div class="buttons-set">
196
+ <button type="button" title="<?php echo $this->__('Close Window') ?>" class="button" onclick="window.close();"><span><span><?php echo $this->__('Close Window') ?></span></span></button>
197
+ <span class="please-wait" id="compare-list-please-wait" style="display:none;">
198
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Please wait...') ?>" title="<?php echo $this->__('Please wait...') ?>" class="v-middle" /> <?php echo $this->__('Please wait...') ?>
199
+ </span>
200
+ </div>
201
+
202
+
203
+ <script type="text/javascript">
204
+ decorateTable('product_comparison');
205
+
206
+ /**
207
+ * Send remove item request, after that reload windows
208
+ */
209
+ function removeItem(url)
210
+ {
211
+ new Ajax.Request(url, {
212
+ parameters: {isAjax: 1, method: 'POST'},
213
+ onLoading: function(){$('compare-list-please-wait').show();},
214
+ onSuccess: function(transport) {
215
+ $('compare-list-please-wait').hide();
216
+ window.location.reload();
217
+ window.opener.location.reload();
218
+ }
219
+ });
220
+ }
221
+
222
+ function toggleSimilarRows(show) {
223
+ if (show == true) {
224
+ document.getElementById('full').className = 'visibleRow';
225
+ document.getElementById('short').className = 'hiddenRow';
226
+ document.getElementById('chb').checked = true;
227
+ document.getElementById('chb2').checked = true;
228
+ } else {
229
+ document.getElementById('full').className = 'hiddenRow';
230
+ document.getElementById('short').className = 'visibleRow';
231
+ document.getElementById('chb').checked = false;
232
+ document.getElementById('chb2').checked = false;
233
+ }
234
+ }
235
+ </script>
236
+ <?php else: ?>
237
+ <script type="text/javascript">window.close();</script>
238
+ <?php endif; ?>
app/etc/modules/ET_AdvancedCompare.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * ET Web Solutions
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ *
10
+ * DISCLAIMER
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade to newer
13
+ * versions in the future.
14
+ *
15
+ * @category ET
16
+ * @package ET_AdvancedCompare
17
+ * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
18
+ * @contacts support@etwebsolutions.com
19
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
+ */
21
+ -->
22
+
23
+ <config>
24
+ <modules>
25
+ <ET_AdvancedCompare>
26
+ <active>true</active>
27
+ <codePool>community</codePool>
28
+ <depends>
29
+ <Mage_Catalog/>
30
+ </depends>
31
+ </ET_AdvancedCompare>
32
+ </modules>
33
+ </config>
app/locale/en_US/ET_AdvancedCompare.csv ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Advanced Compare information","Advanced Compare information"
2
+ "Support by support@etwebsolutions.com<br/>You can hire our team to customize this extension to your theme. Write to sales@etwebsolutions.com","Support by support@etwebsolutions.com<br/>You can hire our team to customize this extension to your theme. Write to sales@etwebsolutions.com"
3
+ "Remove Compare Options","Remove Compare Options"
4
+ "Remove Compare function","Remove Compare feature"
5
+ "If Yes - Removes all Add to compare links and compare blok left or right.","If Yes - Removes all Add to compare links and compare block from left or right."
6
+ "Remove selected links","Remove selected links"
7
+ "If Yes - Add to compare link will be removed for products with attribute remove_compare_link=Yes","If Yes - Add to compare link will be removed for products with attribute remove_compare_link=Yes"
8
+ "Compare No Reload Options","Compare No Reload Options"
9
+ "Enable No Reload function","Enable No Reload function"
10
+ "If Yes - add to compare, remove from compare and clear compare list will work without reloading page.","If Yes - add to compare, remove from compare and clear compare list will work without reloading page."
11
+ "Compare Popup Window Options","Compare Popup Window Options"
12
+ "Replace Popup template","Replace Popup template"
13
+ "If Yes - advanced template will be used. Added ability to hide attributes that does not differs.","If Yes - advanced template will be used. Added ability to hide attributes that do not differ."
14
+ "Show similar rows","Show similar rows"
15
+ "Show label after","Show label after"
16
+ "Shows attribute labels after X products. Default: 3.","Shows attribute labels after X products. Default: 3."
17
+ "Sort attributes","Sort attributes"
18
+ "If Yes - attributes in compare window will be sorted like in attribute set (in some Magento versions there is no sorting by default).","If Yes - attributes in compare window will be sorted like in attribute set (in some Magento versions there is no sorting by default)."
app/locale/lv_LV/ET_AdvancedCompare.csv ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Advanced Compare information","Informācija par Advanced Compare"
2
+ "Support by support@etwebsolutions.com<br/>You can hire our team to customize this extension to your theme. Write to sales@etwebsolutions.com","Atbalsts - support@etwebsolutions.com<br/>Jūs varat nolīgt mūsu komandu šī moduļa pielāgošanai Jūsu tēmai. Rakstiet uz sales@etwebsolutions.com"
3
+ "Remove Compare Options","Nerādīt salīdzināšanu. Opcijas"
4
+ "Remove Compare function","Nerādīt salīdzināšanas funkcionalitāti"
5
+ "If Yes - Removes all Add to compare links and compare blok left or right.","Jā - netiks rādītas visas saites pievienot salīdzināšanai un bloks ar precēm, kas pievienotas salīdzināšanai labajā un kreisajā pusē."
6
+ "Remove selected links","Nerādīt izvēlētās saites"
7
+ "If Yes - Add to compare link will be removed for products with attribute remove_compare_link=Yes","Jā - netiks rādītas saites pievienot salīdzināšanai precēm, kam atribūta remove_compare_link vērtība vienāda jā"
8
+ "Compare No Reload Options","Salīdzināšana bez lapas pārlādes. Opcijas"
9
+ "Enable No Reload function","Ieslēgt salīdzināšanu bez pārlādes"
10
+ "If Yes - add to compare, remove from compare and clear compare list will work without reloading page.","Jā - pievienot salīdzināšanai, izslēgt no salīdzināšanas un dzēst salīdzināšanas sarakstu darbosies bez lapas pārlādes."
11
+ "Compare Popup Window Options","Preču salīdzināšanas logs. Opcijas"
12
+ "Replace Popup template","Aizvietot salīdzināšanas šablonu"
13
+ "If Yes - advanced template will be used. Added ability to hide attributes that does not differs.","Jā - tiks izmantots paplašinātais preču salīdzināšanas šablons. Īpašība - iespēja slēpt atribūtus, kuriem neatšķirās vērtības."
14
+ "Show similar rows","Parādīt vienādos parametrus"
15
+ "Show label after","Parādīt atribūta nosaukumus pēc"
16
+ "Shows attribute labels after X products. Default: 3.","Parādīt kolonnu ar atribūta nosaukumiem pēc katrām Х precēm. Pēc noklusēšanas: 3."
17
+ "Sort attributes","Sortēt atribūtus"
18
+ "If Yes - attributes in compare window will be sorted like in attribute set (in some Magento versions there is no sorting by default).","Jā - atribūti salīzināšanas logā tiks sortēti kā atribūtu kopumā (dažās Magento versijās atribūti netiek sortēti)."
app/locale/ru_RU/ET_AdvancedCompare.csv ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Advanced Compare information","Информация об Advanced Compare"
2
+ "Support by support@etwebsolutions.com<br/>You can hire our team to customize this extension to your theme. Write to sales@etwebsolutions.com","Поддержка - support@etwebsolutions.com<br/>Вы можете нанять нашу команду для изменения этого модуля под вашу тему. Пишите на sales@etwebsolutions.com"
3
+ "Remove Compare Options","Удаление сравнения. Параметры"
4
+ "Remove Compare function","Удалить функцию сравнения"
5
+ "If Yes - Removes all Add to compare links and compare blok left or right.","Если Да - будут скрыты все ссылки Добавить в сравнение и блок со списком товаров для сравнения слева или справа."
6
+ "Remove selected links","Удалить выбранные ссылки"
7
+ "If Yes - Add to compare link will be removed for products with attribute remove_compare_link=Yes","Если Да - будут скрыты ссылки Добавить в сравнение для товаров, у которых значение атрибута remove_compare_link=Да"
8
+ "Compare No Reload Options","Сравнение без перезагрузки. Параметры"
9
+ "Enable No Reload function","Включить Сравнение без перезагрузки"
10
+ "If Yes - add to compare, remove from compare and clear compare list will work without reloading page.","Если Да - функции Добавить в сравнение, Удалить из сравнения и очистить список сравнения будут работать без перезагрузки страницы."
11
+ "Compare Popup Window Options","Окно сравнения товаров. Параметры"
12
+ "Replace Popup template","Заменить шаблон сравнения"
13
+ "If Yes - advanced template will be used. Added ability to hide attributes that does not differs.","Если Да - будет использоваться расширенный шаблон сравнения товаров. Особенность - возможность скрывать атрибуты, значения которых не отличаются."
14
+ "Show similar rows","Показывать совпадающие параметры"
15
+ "Show label after","Показывать названия атрибутов после"
16
+ "Shows attribute labels after X products. Default: 3.","Показывает колонку с названиями атрибутов после каждых Х товаров. По умолчанию: 3."
17
+ "Sort attributes","Сортировать атрибуты"
18
+ "If Yes - attributes in compare window will be sorted like in attribute set (in some Magento versions there is no sorting by default).","Если Да - атрибуты в окне сравнения будут отсортированы как в наборе атрибутов (в некоторых версиях Мадженто сортировка отсутствует)."
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>ET_AdvancedCompare</name>
4
+ <version>0.5.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/afl-3.0.php">AFL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension adds some freedom in product comparison management feature.</summary>
10
+ <description>1. Extension allows to disable comparation on your shop (everywhere or on specified store view)
11
+ 2. Extension adds attribute remove_compare_link. Depending on its value (Yes/No) the link for adding product to compare is shown or not shown (for example, if you want to forbid adding to compare for products with small attribute amounts - books, video games, etc.)
12
+ 3. Extension increases shop performance by allowing customers to work with list of products for comparison without reloading page (add/remove product to list, clear list).
13
+ 4. Extension contains advanced template for product comparison page. By default it doesn't display attributes, which values are the same for every product on the page. Customer can switch this feature off and on without reloading the page.
14
+ 5. Extension adds sorting by attribute to product compare window (as in attribute set edit form in admin panel).</description>
15
+ <notes>stable release</notes>
16
+ <authors><author><name>Jurij</name><user>auto-converted</user><email>support@etwebsolutions.com</email></author><author><name>Andrej</name><user>auto-converted</user><email>support@etwebsolutions.com</email></author></authors>
17
+ <date>2011-04-27</date>
18
+ <time>20:41:37</time>
19
+ <contents><target name="magelocale"><dir name="en_US"><file name="ET_AdvancedCompare.csv" hash="d8ceead0f69e65a160b62c44d79f7b5a"/></dir><dir name="lv_LV"><file name="ET_AdvancedCompare.csv" hash="ad6bd23540ed502e590ffcae331296c6"/></dir><dir name="ru_RU"><file name="ET_AdvancedCompare.csv" hash="d55d6404886ef889d6fe150ef116cee6"/></dir></target><target name="magecommunity"><dir name="ET"><dir name="AdvancedCompare"><dir name="Block"><file name="List.php" hash="37ea3ff13c17c21b9af9d88f88ac9399"/></dir><dir name="controllers"><file name="IndexController.php" hash="0ac917b6a71a76e7e051a383e13b9a6a"/></dir><dir name="etc"><file name="config.xml" hash="5842bc305a855f2f8ffec0ef155320d4"/><file name="system.xml" hash="59ccd30dcf22322fc91b3a1f7ea9b941"/></dir><dir name="Helper"><file name="Data.php" hash="afa1b38a67cd187c44bdfcbe5e3536cf"/></dir><dir name="Model"><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><dir name="Product"><dir name="Compare"><dir name="Item"><file name="Collection.php" hash="39a146c86ea05e251af463276452a392"/></dir></dir></dir></dir></dir></dir></dir><dir name="sql"><dir name="advancedcompare_setup"><file name="mysql4-install-0.1.php" hash="94e38151b4da2cb96ae168e778aa71cf"/></dir></dir></dir><file name="ET_AdvancedCompare_ChangeLog.txt" hash="d3e0b1d8767b25ce24d72d1ad6ebdd40"/><file name="ET_AdvancedCompare_Description.txt" hash="b7bc2dd38960ec5e39f130c931867cb8"/><file name="ET_AdvancedCompare_LICENSE.txt" hash="b799504264c23c11a941473d7a3e3ab7"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="noreload.css" hash="31cfd073e4404ab1c325abe9de1928af"/></dir><dir name="js"><file name="noreload.js" hash="1e7a2aa3f7dea33f4a6f412565839266"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="et_advancedcompare.xml" hash="f00891d2b2b927e9eb18e46c84a92b11"/></dir><dir name="template"><dir name="et_advancedcompare"><file name="list_13x.phtml" hash="6bd2f354e79812359db38ca124bc90d7"/><file name="list_15x.phtml" hash="cf3f719878c4e79f90c013040fb052b5"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ET_AdvancedCompare.xml" hash="37ca83e0b75f274fa0300dadf934bc97"/></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies/>
22
+ </package>
skin/frontend/default/default/css/noreload.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ #animated_div {
2
+ border: #ADADAD 1px double;
3
+ background: #E9E9E9;
4
+ }
skin/frontend/default/default/js/noreload.js ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //**
2
+ // * ET Web Solutions
3
+ // *
4
+ // * NOTICE OF LICENSE
5
+ // *
6
+ // * This source file is subject to the Academic Free License (AFL 3.0)
7
+ // *
8
+ // * DISCLAIMER
9
+ // *
10
+ // * Do not edit or add to this file if you wish to upgrade to newer
11
+ // * versions in the future.
12
+ // *
13
+ // * @category ET
14
+ // * @package ET_AdvancedCompare
15
+ // * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
16
+ // * @contacts support@etwebsolutions.com
17
+ // * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
18
+ // */
19
+
20
+
21
+ var CompareNoReload = {
22
+
23
+ compareAnimationCount: 0,
24
+
25
+
26
+ compareRemoveFromListSilent: function(removeUrl)
27
+ {
28
+ new Ajax.Request(removeUrl, {
29
+ onSuccess: function(response) {
30
+ CompareNoReload.compareUpdateSidebarHtml(response.responseText);
31
+ CompareNoReload.rescanForNewCompare();
32
+ }
33
+ });
34
+ },
35
+
36
+
37
+ compareClearList: function (clearUrl,textAlert)
38
+ {
39
+ new Ajax.Request(clearUrl, {
40
+ onSuccess: function(response) {
41
+ CompareNoReload.compareUpdateSidebarHtml(response.responseText);
42
+ CompareNoReload.rescanForNewCompare();
43
+ }
44
+ });
45
+ },
46
+
47
+
48
+ compareAddToList: function (addUrl,id2Animate)
49
+ {
50
+ this.startAnimation(id2Animate);
51
+ new Ajax.Request(addUrl, {
52
+ onSuccess: function(response) {
53
+ CompareNoReload.compareUpdateSidebarHtml(response.responseText);
54
+ CompareNoReload.rescanForNewCompare();
55
+ }
56
+ });
57
+ return false;
58
+ },
59
+
60
+ /*
61
+ compareUpdateSidebar: function ()
62
+ {
63
+ if(typeof($("compareUpdateUrl")) !== 'undefined')
64
+ new Ajax.Request($("compareUpdateUrl").value, {
65
+ method: 'post',
66
+ parameters: $('shipping-type').serialize(true),
67
+ onSuccess: function(response) {
68
+ this.getCompareSideBlock().update(response.responseText);
69
+ this.rescanForNewCompare();
70
+ }
71
+ });
72
+ },
73
+ */
74
+
75
+ compareUpdateSidebarHtml: function (updateText)
76
+ {
77
+ if(typeof(this.getCompareSideBlock()) != 'undefined'){
78
+ //compareAnimationText=eval(updateText);
79
+ this.getCompareSideBlock().replace(eval(updateText));
80
+ }
81
+ },
82
+
83
+
84
+ startAnimation: function (id2Animate)
85
+ {
86
+
87
+ if(typeof(id2Animate)!= 'undefined')if((typeof(this.getCompareSideBlock()) != 'undefined')&($(id2Animate) != null))
88
+ {
89
+
90
+ var xy=this.getCompareSideBlock().cumulativeOffset();
91
+ var dmnsns = this.getCompareSideBlock().getDimensions();
92
+ var endPosition={
93
+ top :xy[1]+dmnsns.height-5-22,
94
+ left :xy[0]+dmnsns.width-5-79,
95
+ width :79,
96
+ height :22
97
+ };
98
+ var animatedSteps=10;
99
+ var animatedTime=0.75;
100
+ var xy=$(id2Animate).cumulativeOffset();
101
+ var dmnsns = $(id2Animate).getDimensions();
102
+
103
+ var startPosition={
104
+ top :xy[1],
105
+ left :xy[0],
106
+ width :dmnsns.width,
107
+ height :dmnsns.height
108
+ };
109
+
110
+ var accelerationX=(endPosition.left-startPosition.left)*2/animatedSteps/animatedSteps;
111
+ var accelerationY=(endPosition.top-startPosition.top)*2/animatedSteps/animatedSteps;
112
+
113
+ if($('animated_div')==null)
114
+ {
115
+ $$('div.wrapper')[0].insert({bottom:'<div id="animated_div"></div>'});
116
+ }
117
+
118
+ $('animated_div').setStyle({
119
+ "position" :"absolute",
120
+ "left" :startPosition.left+"px",
121
+ "top" :startPosition.top+'px',
122
+ "width" :startPosition.width+'px',
123
+ "height" :startPosition.height+'px',
124
+ "display" :""
125
+ });
126
+ $('animated_div').setOpacity(0.7);
127
+
128
+ for(var i=0;i<animatedSteps;i++)
129
+ {
130
+
131
+ Element.setStyle.delay(animatedTime/animatedSteps*i, "animated_div",
132
+ {
133
+ "top" :(startPosition.top+parseInt(accelerationY*i*i/2))+"px",
134
+ "left" :(startPosition.left+parseInt(accelerationX*i*i/2))+"px",
135
+ "width" :(startPosition.width-parseInt((startPosition.width-endPosition.width)/animatedSteps*i))+"px",
136
+ "height" :(startPosition.height-parseInt((startPosition.height-endPosition.height)/animatedSteps*i))+"px"
137
+ });
138
+
139
+ }
140
+
141
+ Element.setStyle.delay(animatedTime/animatedSteps*(animatedSteps+1), "animated_div",
142
+ {
143
+ "display" :"none"
144
+ });
145
+
146
+
147
+ }
148
+
149
+ },
150
+
151
+ compareAnimationMove: function()
152
+ {
153
+ new PeriodicalExecuter(function(pe) {
154
+ this.compareAnimationCount++;
155
+ }, 0.2);
156
+
157
+ },
158
+
159
+
160
+ rescanForNewCompare: function()
161
+ {
162
+ var allOldLinks=$$("a[href*=product_compare/add/product]");
163
+ for(var i=0;i<allOldLinks.length;i++)
164
+ if(allOldLinks[i].readAttribute("oldlink")==null)
165
+ {
166
+ var tmpHref=allOldLinks[i].href;
167
+ allOldLinks[i].href="#";
168
+ allOldLinks[i].writeAttribute("oldlink",tmpHref);
169
+ var fparent=this.findParentByCss(allOldLinks[i],"li.item");
170
+ if(fparent==null)fparent=this.findParentByCss(allOldLinks[i],"li");
171
+ if(fparent.id=="")
172
+ {
173
+ fparent.id="divforcomparing"+i;
174
+ }
175
+
176
+ var myString = new String(tmpHref)
177
+ rExp = /\/add\//gi;
178
+ tmpHref = myString.replace(rExp, "/silentadd/");
179
+
180
+ allOldLinks[i]['onclick']=new Function("return CompareNoReload.compareAddToList('"+tmpHref+"','"+fparent.id+"')");
181
+ }
182
+
183
+
184
+ var allOldLinks=$$("a[href*=product_compare/clear]");
185
+ for(var i=0;i<allOldLinks.length;i++)
186
+ if(allOldLinks[i].readAttribute("oldlink")==null)
187
+ {
188
+ var tmpHref=allOldLinks[i].href;
189
+ allOldLinks[i].writeAttribute("oldlink",tmpHref);
190
+
191
+ var myString = new String(tmpHref)
192
+ rExp = /\/clear\//gi;
193
+ tmpHref = myString.replace(rExp, "/silentclear/");
194
+
195
+ allOldLinks[i].href="javascript:CompareNoReload.compareClearList('"+tmpHref+"')";
196
+ }
197
+
198
+ var allOldLinks=$$("a[href*=product_compare/remove]");
199
+ for(var i=0;i<allOldLinks.length;i++)
200
+ if(allOldLinks[i].readAttribute("oldlink")==null)
201
+ {
202
+ var tmpHref=allOldLinks[i].href;
203
+ allOldLinks[i].writeAttribute("oldlink",tmpHref);
204
+
205
+ var myString = new String(tmpHref)
206
+ rExp = /\/remove\//gi;
207
+ tmpHref = myString.replace(rExp, "/silentremove/");
208
+
209
+ allOldLinks[i].href="javascript:CompareNoReload.compareRemoveFromListSilent('"+tmpHref+"')";
210
+ }
211
+ },
212
+
213
+
214
+ findParentByCss: function(element,rule)
215
+ {
216
+ var el2ret=element.parentNode;
217
+ if(el2ret.tagName=="body")return null;
218
+ if(el2ret.tagName=="BODY")return null;
219
+ if($(el2ret).match(rule)) return el2ret;
220
+ else return this.findParentByCss(element.parentNode,rule);
221
+ },
222
+
223
+ getCompareSideBlock: function ()
224
+ { //1.3.x.x
225
+ if($$("div.mini-compare-products").length>0)return $$("div.mini-compare-products")[0];
226
+ //1.4+
227
+ return $$("div.block-compare")[0];
228
+ }
229
+ }
230
+
231
+
232
+
233
+ Event.observe(window, 'load', function()
234
+ {
235
+
236
+ //redefining click
237
+ CompareNoReload.rescanForNewCompare();
238
+
239
+ if(CompareNoReload.getCompareSideBlock() == null)
240
+ {
241
+ if($$('div.col-left').length>0)$$('div.col-left')[0].insert({bottom:'<div class="block-compare"></div>'});
242
+ else if($$('div.col-right').length>0)$$('div.col-right')[0].insert({bottom:'<div class="block-compare"></div>'});
243
+ }
244
+ });