customtoolbar_module - Version 0.1.0

Version Notes

-New Release

Download this release

Release Info

Developer Biztech
Extension customtoolbar_module
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/local/Biztech/Customtoolbar/Block/Catalog/Product/Attribute/Edit/Tab/Main.php ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Product attribute add/edit form main tab
30
+ *
31
+ * @category Mage
32
+ * @package Mage_Adminhtml
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Biztech_Customtoolbar_Block_Catalog_Product_Attribute_Edit_Tab_Main extends Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract
36
+ {
37
+ /**
38
+ * Adding product form elements for editing attribute
39
+ *
40
+ * @return Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Main
41
+ */
42
+ protected function _prepareForm()
43
+ {
44
+ parent::_prepareForm();
45
+ $attributeObject = $this->getAttributeObject();
46
+ /* @var $form Varien_Data_Form */
47
+ $form = $this->getForm();
48
+ /* @var $fieldset Varien_Data_Form_Element_Fieldset */
49
+ $fieldset = $form->getElement('base_fieldset');
50
+
51
+ $frontendInputElm = $form->getElement('frontend_input');
52
+ $additionalTypes = array(
53
+ array(
54
+ 'value' => 'price',
55
+ 'label' => Mage::helper('catalog')->__('Price')
56
+ ),
57
+ array(
58
+ 'value' => 'media_image',
59
+ 'label' => Mage::helper('catalog')->__('Media Image')
60
+ )
61
+ );
62
+ if ($attributeObject->getFrontendInput() == 'gallery') {
63
+ $additionalTypes[] = array(
64
+ 'value' => 'gallery',
65
+ 'label' => Mage::helper('catalog')->__('Gallery')
66
+ );
67
+ }
68
+
69
+ $response = new Varien_Object();
70
+ $response->setTypes(array());
71
+ Mage::dispatchEvent('adminhtml_product_attribute_types', array('response'=>$response));
72
+ $_disabledTypes = array();
73
+ $_hiddenFields = array();
74
+ foreach ($response->getTypes() as $type) {
75
+ $additionalTypes[] = $type;
76
+ if (isset($type['hide_fields'])) {
77
+ $_hiddenFields[$type['value']] = $type['hide_fields'];
78
+ }
79
+ if (isset($type['disabled_types'])) {
80
+ $_disabledTypes[$type['value']] = $type['disabled_types'];
81
+ }
82
+ }
83
+ Mage::register('attribute_type_hidden_fields', $_hiddenFields);
84
+ Mage::register('attribute_type_disabled_types', $_disabledTypes);
85
+
86
+ $frontendInputValues = array_merge($frontendInputElm->getValues(), $additionalTypes);
87
+ $frontendInputElm->setValues($frontendInputValues);
88
+
89
+ $yesnoSource = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
90
+
91
+ $scopes = array(
92
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE =>Mage::helper('catalog')->__('Store View'),
93
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE =>Mage::helper('catalog')->__('Website'),
94
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL =>Mage::helper('catalog')->__('Global'),
95
+ );
96
+
97
+ if ($attributeObject->getAttributeCode() == 'status' || $attributeObject->getAttributeCode() == 'tax_class_id') {
98
+ unset($scopes[Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE]);
99
+ }
100
+
101
+ $fieldset->addField('is_global', 'select', array(
102
+ 'name' => 'is_global',
103
+ 'label' => Mage::helper('catalog')->__('Scope'),
104
+ 'title' => Mage::helper('catalog')->__('Scope'),
105
+ 'note' => Mage::helper('catalog')->__('Declare attribute value saving scope'),
106
+ 'values'=> $scopes
107
+ ), 'attribute_code');
108
+
109
+ $fieldset->addField('apply_to', 'apply', array(
110
+ 'name' => 'apply_to[]',
111
+ 'label' => Mage::helper('catalog')->__('Apply To'),
112
+ 'values' => Mage_Catalog_Model_Product_Type::getOptions(),
113
+ 'mode_labels' => array(
114
+ 'all' => Mage::helper('catalog')->__('All Product Types'),
115
+ 'custom' => Mage::helper('catalog')->__('Selected Product Types')
116
+ ),
117
+ 'required' => true
118
+ ), 'frontend_class');
119
+
120
+ $fieldset->addField('is_configurable', 'select', array(
121
+ 'name' => 'is_configurable',
122
+ 'label' => Mage::helper('catalog')->__('Use To Create Configurable Product'),
123
+ 'values' => $yesnoSource,
124
+ ), 'apply_to');
125
+
126
+ // frontend properties fieldset
127
+ $fieldset = $form->addFieldset('front_fieldset', array('legend'=>Mage::helper('catalog')->__('Frontend Properties')));
128
+
129
+ $fieldset->addField('is_searchable', 'select', array(
130
+ 'name' => 'is_searchable',
131
+ 'label' => Mage::helper('catalog')->__('Use in Quick Search'),
132
+ 'title' => Mage::helper('catalog')->__('Use in Quick Search'),
133
+ 'values' => $yesnoSource,
134
+ ));
135
+
136
+ $fieldset->addField('is_visible_in_advanced_search', 'select', array(
137
+ 'name' => 'is_visible_in_advanced_search',
138
+ 'label' => Mage::helper('catalog')->__('Use in Advanced Search'),
139
+ 'title' => Mage::helper('catalog')->__('Use in Advanced Search'),
140
+ 'values' => $yesnoSource,
141
+ ));
142
+
143
+ $fieldset->addField('is_comparable', 'select', array(
144
+ 'name' => 'is_comparable',
145
+ 'label' => Mage::helper('catalog')->__('Comparable on Front-end'),
146
+ 'title' => Mage::helper('catalog')->__('Comparable on Front-end'),
147
+ 'values' => $yesnoSource,
148
+ ));
149
+
150
+ $fieldset->addField('is_filterable', 'select', array(
151
+ 'name' => 'is_filterable',
152
+ 'label' => Mage::helper('catalog')->__("Use In Layered Navigation"),
153
+ 'title' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'),
154
+ 'note' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'),
155
+ 'values' => array(
156
+ array('value' => '0', 'label' => Mage::helper('catalog')->__('No')),
157
+ array('value' => '1', 'label' => Mage::helper('catalog')->__('Filterable (with results)')),
158
+ array('value' => '2', 'label' => Mage::helper('catalog')->__('Filterable (no results)')),
159
+ ),
160
+ ));
161
+
162
+ $fieldset->addField('is_filterable_in_search', 'select', array(
163
+ 'name' => 'is_filterable_in_search',
164
+ 'label' => Mage::helper('catalog')->__("Use In Search Results Layered Navigation"),
165
+ 'title' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'),
166
+ 'note' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'),
167
+ 'values' => $yesnoSource,
168
+ ));
169
+
170
+ $fieldset->addField('is_used_for_promo_rules', 'select', array(
171
+ 'name' => 'is_used_for_promo_rules',
172
+ 'label' => Mage::helper('catalog')->__('Use for Promo Rule Conditions'),
173
+ 'title' => Mage::helper('catalog')->__('Use for Promo Rule Conditions'),
174
+ 'values' => $yesnoSource,
175
+ ));
176
+
177
+ $fieldset->addField('position', 'text', array(
178
+ 'name' => 'position',
179
+ 'label' => Mage::helper('catalog')->__('Position'),
180
+ 'title' => Mage::helper('catalog')->__('Position in Layered Navigation'),
181
+ 'note' => Mage::helper('catalog')->__('Position of attribute in layered navigation block'),
182
+ 'class' => 'validate-digits',
183
+ ));
184
+
185
+ $fieldset->addField('is_wysiwyg_enabled', 'select', array(
186
+ 'name' => 'is_wysiwyg_enabled',
187
+ 'label' => Mage::helper('catalog')->__('Enable WYSIWYG'),
188
+ 'title' => Mage::helper('catalog')->__('Enable WYSIWYG'),
189
+ 'values' => $yesnoSource,
190
+ ));
191
+
192
+ $htmlAllowed = $fieldset->addField('is_html_allowed_on_front', 'select', array(
193
+ 'name' => 'is_html_allowed_on_front',
194
+ 'label' => Mage::helper('catalog')->__('Allow HTML Tags on Frontend'),
195
+ 'title' => Mage::helper('catalog')->__('Allow HTML Tags on Frontend'),
196
+ 'values' => $yesnoSource,
197
+ ));
198
+ if (!$attributeObject->getId() || $attributeObject->getIsWysiwygEnabled()) {
199
+ $attributeObject->setIsHtmlAllowedOnFront(1);
200
+ }
201
+
202
+ $fieldset->addField('is_visible_on_front', 'select', array(
203
+ 'name' => 'is_visible_on_front',
204
+ 'label' => Mage::helper('catalog')->__('Visible on Product View Page on Front-end'),
205
+ 'title' => Mage::helper('catalog')->__('Visible on Product View Page on Front-end'),
206
+ 'values' => $yesnoSource,
207
+ ));
208
+
209
+ $fieldset->addField('used_in_product_listing', 'select', array(
210
+ 'name' => 'used_in_product_listing',
211
+ 'label' => Mage::helper('catalog')->__('Used in Product Listing'),
212
+ 'title' => Mage::helper('catalog')->__('Used in Product Listing'),
213
+ 'note' => Mage::helper('catalog')->__('Depends on design theme'),
214
+ 'values' => $yesnoSource,
215
+ ));
216
+ $fieldset->addField('used_for_sort_by', 'select', array(
217
+ 'name' => 'used_for_sort_by',
218
+ 'label' => Mage::helper('catalog')->__('Used for Sorting in Product Listing'),
219
+ 'title' => Mage::helper('catalog')->__('Used for Sorting in Product Listing'),
220
+ 'note' => Mage::helper('catalog')->__('Depends on design theme'),
221
+ 'values' => $yesnoSource,
222
+ ));
223
+ /* Add for customtoolbar module */
224
+ if(Mage::getStoreConfig('customtoolbar/customtoolbar_general/enabled') == 1){
225
+ $fieldset->addField('used_for_filter_by', 'select', array(
226
+ 'name' => 'used_for_filter_by',
227
+ 'label' => Mage::helper('catalog')->__('Used for Filter Products in Frontend'),
228
+ 'title' => Mage::helper('catalog')->__('Used for Filter Products in Frontend'),
229
+ 'note' => Mage::helper('catalog')->__('Select yes to filter products by this attribute and Layered Navigation should be filterable'),
230
+ 'values' => $yesnoSource,
231
+ ));
232
+ }
233
+ /*End*/
234
+ $form->getElement('apply_to')->setSize(5);
235
+
236
+ if ($applyTo = $attributeObject->getApplyTo()) {
237
+ $applyTo = is_array($applyTo) ? $applyTo : explode(',', $applyTo);
238
+ $form->getElement('apply_to')->setValue($applyTo);
239
+ } else {
240
+ $form->getElement('apply_to')->addClass('no-display ignore-validate');
241
+ }
242
+
243
+ // define field dependencies
244
+ $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
245
+ ->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled')
246
+ ->addFieldMap("is_html_allowed_on_front", 'html_allowed_on_front')
247
+ ->addFieldMap("frontend_input", 'frontend_input_type')
248
+ ->addFieldDependence('wysiwyg_enabled', 'frontend_input_type', 'textarea')
249
+ ->addFieldDependence('html_allowed_on_front', 'wysiwyg_enabled', '0')
250
+ );
251
+
252
+ Mage::dispatchEvent('adminhtml_catalog_product_attribute_edit_prepare_form', array(
253
+ 'form' => $form,
254
+ 'attribute' => $attributeObject
255
+ ));
256
+
257
+ return $this;
258
+ }
259
+
260
+ /**
261
+ * Retrieve additional element types for product attributes
262
+ *
263
+ * @return array
264
+ */
265
+ protected function _getAdditionalElementTypes()
266
+ {
267
+ return array(
268
+ 'apply' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_apply'),
269
+ );
270
+ }
271
+ }
app/code/local/Biztech/Customtoolbar/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Biztech_Customtoolbar_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/local/Biztech/Customtoolbar/controllers/IndexController.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Biztech_Customtoolbar_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->renderLayout();
8
+ }
9
+ public function fillattvaluesAction()
10
+ {
11
+ $att_code = $this->getRequest()->getParam('att_code');
12
+ $json = array();
13
+ $att = Mage::getSingleton('eav/config')->getAttribute('catalog_product', $att_code);
14
+ $options = $att->getSource()->getAllOptions();
15
+
16
+ foreach($options as $option)
17
+ {
18
+ $json[] = array(
19
+ 'lable' => $option['label'],
20
+ 'value' => $option['value']
21
+ );
22
+ }
23
+ $this->getResponse()->setBody(Zend_Json::encode($json));
24
+ }
25
+
26
+
27
+ }
app/code/local/Biztech/Customtoolbar/etc/config.xml ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <modules>
5
+ <Biztech_Customtoolbar>
6
+ <version>0.1.0</version>
7
+ </Biztech_Customtoolbar>
8
+ </modules>
9
+ <frontend>
10
+ <routers>
11
+ <customtoolbar>
12
+ <use>standard</use>
13
+ <args>
14
+ <module>Biztech_Customtoolbar</module>
15
+ <frontName>customtoolbar</frontName>
16
+ </args>
17
+ </customtoolbar>
18
+ </routers>
19
+ <layout>
20
+ <updates>
21
+ <customtoolbar>
22
+ <file>customtoolbar.xml</file>
23
+ </customtoolbar>
24
+ </updates>
25
+ </layout>
26
+ </frontend>
27
+ <admin>
28
+ <routers>
29
+ <customtoolbar>
30
+ <use>admin</use>
31
+ <args>
32
+ <module>Biztech_Customtoolbar</module>
33
+ <frontName>customtoolbar</frontName>
34
+ </args>
35
+ </customtoolbar>
36
+ </routers>
37
+ </admin>
38
+ <adminhtml>
39
+ <acl>
40
+ <resources>
41
+ <all>
42
+ <title>Allow Everything</title>
43
+ </all>
44
+ <admin>
45
+ <children>
46
+ <Biztech_Customtoolbar>
47
+ <title>Customtoolbar Module</title>
48
+ <sort_order>10</sort_order>
49
+ </Biztech_Customtoolbar>
50
+ <system>
51
+ <children>
52
+ <config>
53
+ <children>
54
+ <customtoolbar>
55
+ <title>Custom Toolbar</title>
56
+ </customtoolbar>
57
+ </children>
58
+ </config>
59
+ </children>
60
+ </system>
61
+ </children>
62
+ </admin>
63
+ </resources>
64
+ </acl>
65
+ <layout>
66
+ <updates>
67
+ <customtoolbar>
68
+ <file>customtoolbar.xml</file>
69
+ </customtoolbar>
70
+ </updates>
71
+ </layout>
72
+ </adminhtml>
73
+ <global>
74
+ <models>
75
+ <customtoolbar>
76
+ <class>Biztech_Customtoolbar_Model</class>
77
+ <resourceModel>customtoolbar_mysql4</resourceModel>
78
+ </customtoolbar>
79
+ <customtoolbar_mysql4>
80
+ <class>Biztech_Customtoolbar_Model_Mysql4</class>
81
+ <entities>
82
+ <customtoolbar>
83
+ <table>customtoolbar</table>
84
+ </customtoolbar>
85
+ </entities>
86
+ </customtoolbar_mysql4>
87
+ </models>
88
+ <resources>
89
+ <customtoolbar_setup>
90
+ <setup>
91
+ <module>Biztech_Customtoolbar</module>
92
+ </setup>
93
+ <connection>
94
+ <use>core_setup</use>
95
+ </connection>
96
+ </customtoolbar_setup>
97
+ <customtoolbar_write>
98
+ <connection>
99
+ <use>core_write</use>
100
+ </connection>
101
+ </customtoolbar_write>
102
+ <customtoolbar_read>
103
+ <connection>
104
+ <use>core_read</use>
105
+ </connection>
106
+ </customtoolbar_read>
107
+ </resources>
108
+ <blocks>
109
+ <customtoolbar>
110
+ <class>Biztech_Customtoolbar_Block</class>
111
+ </customtoolbar>
112
+
113
+ <adminhtml>
114
+ <rewrite>
115
+ <catalog_product_attribute_edit_tab_main>Biztech_Customtoolbar_Block_Catalog_Product_Attribute_Edit_Tab_Main</catalog_product_attribute_edit_tab_main>
116
+ </rewrite>
117
+ </adminhtml>
118
+ </blocks>
119
+ <helpers>
120
+ <customtoolbar>
121
+ <class>Biztech_Customtoolbar_Helper</class>
122
+ </customtoolbar>
123
+ </helpers>
124
+ </global>
125
+ </config>
app/code/local/Biztech/Customtoolbar/etc/system.xml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <config>
3
+ <tabs>
4
+ <biztech translate="label" module="customtoolbar">
5
+ <label>Biztech Extensions</label>
6
+ <sort_order>400</sort_order>
7
+ </biztech>
8
+ </tabs>
9
+ <sections>
10
+ <customtoolbar translate="label" module="customtoolbar">
11
+ <label>Custom Toolbar</label>
12
+ <tab>biztech</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>10</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <customtoolbar_general translate="label">
20
+ <label>General</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <enabled translate="label">
28
+ <label>Enabled</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>1</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <comment>Select Yes to enable this feature.</comment>
36
+ </enabled>
37
+ </fields>
38
+ </customtoolbar_general>
39
+
40
+ </groups>
41
+ </customtoolbar>
42
+ </sections>
43
+ </config>
app/code/local/Biztech/Customtoolbar/sql/customtoolbar_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $this->_conn->addColumn($this->getTable('catalog_eav_attribute'), 'used_for_filter_by', 'smallint');
8
+
9
+
10
+ $installer->endSetup();
app/design/frontend/default/default/layout/customtoolbar.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <customtoolbar_index_index>
6
+ <reference name="content">
7
+ <block type="customtoolbar/customtoolbar" name="customtoolbar" template="customtoolbar/customtoolbar.phtml" />
8
+ </reference>
9
+ </customtoolbar_index_index>
10
+ <catalog_category_default>
11
+ <reference name="product_list_toolbar">
12
+ <action method="setTemplate"><template>customtoolbar/toolbar.phtml</template></action>
13
+ </reference>
14
+ </catalog_category_default>
15
+
16
+ <catalog_category_layered>
17
+ <reference name="product_list_toolbar">
18
+ <action method="setTemplate"><template>customtoolbar/toolbar.phtml</template></action>
19
+ </reference>
20
+ </catalog_category_layered>
21
+
22
+ <catalogsearch_result_index>
23
+ <reference name="product_list_toolbar">
24
+ <action method="setTemplate"><template>customtoolbar/toolbar.phtml</template></action>
25
+ </reference>
26
+ </catalogsearch_result_index>
27
+ </layout>
app/design/frontend/default/default/template/customtoolbar/toolbar.phtml ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Product list toolbar
30
+ *
31
+ * @see Mage_Catalog_Block_Product_List_Toolbar
32
+ */
33
+ ?>
34
+ <style type="text/css" >
35
+ #loading-mask .update-popup { position:fixed; top:45%; left:45%; width:300px; margin-left:-105px; padding:15px 30px; background:#fff; color:#d85909; font-weight:bold; text-align:center; z-index:400; webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px;}
36
+ </style>
37
+ <?php
38
+ if($this->getCollection()->getSize()): ?>
39
+ <div class="toolbar">
40
+ <div class="pager">
41
+ <p class="amount">
42
+ <?php if($this->getLastPageNum()>1): ?>
43
+ <?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
44
+ <?php else: ?>
45
+ <strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
46
+ <?php endif; ?>
47
+ </p>
48
+
49
+ <div class="limiter">
50
+ <label><?php echo $this->__('Show') ?></label>
51
+ <select onchange="setLocation(this.value)">
52
+ <?php foreach ($this->getAvailableLimit() as $_key=>$_limit): ?>
53
+ <option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
54
+ <?php echo $_limit ?>
55
+ </option>
56
+ <?php endforeach; ?>
57
+ </select> <?php echo $this->__('per page') ?>
58
+ </div>
59
+
60
+
61
+ <?php echo $this->getPagerHtml() ?>
62
+
63
+ </div>
64
+
65
+ <?php if( $this->isExpanded() ): ?>
66
+ <div class="sorter">
67
+ <?php if( $this->isEnabledViewSwitcher() ): ?>
68
+ <p class="view-mode">
69
+ <?php $_modes = $this->getModes(); ?>
70
+ <?php if($_modes && count($_modes)>1): ?>
71
+ <label><?php echo $this->__('View as') ?>:</label>
72
+ <?php foreach ($this->getModes() as $_code=>$_label): ?>
73
+ <?php if($this->isModeActive($_code)): ?>
74
+ <strong title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></strong>&nbsp;
75
+ <?php else: ?>
76
+ <a href="<?php echo $this->getModeUrl($_code) ?>" title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></a>&nbsp;
77
+ <?php endif; ?>
78
+ <?php endforeach; ?>
79
+ <?php endif; ?>
80
+ </p>
81
+ <?php endif; ?>
82
+
83
+ <div class="sort-by" style="padding-right: 0px;">
84
+ <label><?php echo $this->__('Sort By') ?></label>
85
+ <select onchange="setLocation(this.value)">
86
+ <?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
87
+ <option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
88
+ <?php echo $this->__($_order) ?>
89
+ </option>
90
+ <?php endforeach; ?>
91
+ </select>
92
+ <?php if($this->getCurrentDirection() == 'desc'): ?>
93
+ <a href="<?php echo $this->getOrderUrl(null, 'asc') ?>" title="<?php echo $this->__('Set Ascending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_desc_arrow.gif') ?>" alt="<?php echo $this->__('Set Ascending Direction') ?>" class="v-middle" /></a>
94
+ <?php else: ?>
95
+ <a href="<?php echo $this->getOrderUrl(null, 'desc') ?>" title="<?php echo $this->__('Set Descending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_asc_arrow.gif') ?>" alt="<?php echo $this->__('Set Descending Direction') ?>" class="v-middle" /></a>
96
+ <?php endif; ?>
97
+ </div>
98
+
99
+
100
+
101
+ <?php
102
+ if(Mage::getStoreConfig('customtoolbar/customtoolbar_general/enabled') == 1):
103
+ ?>
104
+ <div class="filter-by" style="float: left; padding-left: 10px;">
105
+ <?php
106
+ $entity_type_id = 4;
107
+ $attributes = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter($entity_type_id)->addFieldToFilter("backend_type",array("eq"=>'int'))->addFieldToFilter("frontend_input",array("eq"=>'select'))->addFieldToFilter("used_for_filter_by",array("eq"=>'1'));
108
+ ?>
109
+ <table><tr><td>
110
+ <label><?php echo $this->__('Filter By') ?></label></td>
111
+ <td>
112
+ <select onchange="fillattvalue(this.value)" id="attributes" style="width: 82px;">
113
+ <option value="select"><?php echo $this->__('Please Select') ?></option>
114
+ <?php foreach($attributes as $attribute): ?>
115
+ <option value="<?php echo $attribute->getAttributeCode(); ?>">
116
+ <?php echo $attribute->getAttributeCode() ?>
117
+ </option>
118
+ <?php endforeach; ?>
119
+ </select></td>
120
+ <td id="attvalue" style="display: none; padding-left: 10px; "></td>
121
+ </tr></table>
122
+ </div>
123
+ <?php endif ?>
124
+ </div>
125
+ <?php endif; ?>
126
+ </div>
127
+ <?php endif ?>
128
+
129
+
130
+ <script language ="javascript" type="text/javascript">
131
+ function fillattvalue(item)
132
+ {
133
+ var parameters = {att_code : item }
134
+ var url = '<?php echo Mage::helper('adminhtml')->getUrl('customtoolbar/index/fillattvalues'); ?>';
135
+ var e = document.getElementById("attributes");
136
+ var select_index = e.options[e.selectedIndex].value;
137
+ if(select_index == "select")
138
+ {
139
+ document.getElementById('attvalue').style.display='none';
140
+ }
141
+ else
142
+ {
143
+ document.getElementById('loading-mask').style.display = 'block';
144
+ new Ajax.Request(url, {
145
+ method: 'post',
146
+ //asynchronous: false,
147
+ onSuccess: function(transport) {
148
+ document.getElementById('loading-mask').style.display='block';
149
+ if(transport.responseText) {
150
+ var response = transport.responseText;
151
+ response = response.evalJSON();
152
+ var total_length = response.length;
153
+ var html='';
154
+ var cur_url = location.href;
155
+ var cur_att = document.getElementById("attributes").value;
156
+ var cur_cat_url ='<?php echo Mage::getBaseUrl().Mage::getModel('catalog/layer')->getCurrentCategory()->getUrlPath() ?>'
157
+ html+= '<select onchange="setLocation(this.value)" style="width:82px">';
158
+ html+= '<option value="">Please Select</option>';
159
+ for (var i=1;i<total_length;i++){
160
+ var inner_parameters = {
161
+ lable : response[i]['lable'],
162
+ value : response[i]['value']
163
+ }
164
+ <?php $is_anchor = Mage::getModel('catalog/layer')->getCurrentCategory()->getIsAnchor();
165
+ if($is_anchor == 1){ ?>
166
+ var baseURL = cur_cat_url + "?" + cur_att +"=" + response[i]['value'];
167
+ <?php } else { ?>
168
+ //var baseURL = cur_url.substring(0, cur_url.indexOf('/', 14))+ "/index.php/catalogsearch/result/?q=" + response[i]['lable'];
169
+ var baseURL = '<?php echo Mage::getBaseUrl() ?>' + "catalogsearch/result/?q=" + response[i]['lable'];
170
+ <?php } ?>
171
+ html+= '<option value="'+baseURL+'">';
172
+ html+= response[i]['lable'];
173
+ html+='</option>';
174
+ }
175
+ html+='</select>'
176
+ document.getElementById('attvalue').innerHTML=html;
177
+ document.getElementById('loading-mask').style.display='none';
178
+ document.getElementById('attvalue').style.display='inline-block';
179
+ }
180
+ },
181
+ parameters:parameters
182
+ });
183
+ }
184
+ }
185
+
186
+ </script>
187
+
188
+ <div id="loading-mask" class="update-box" style="display:none;">
189
+ <div class="update-popup" style="background: url(<?php echo $this->getSkinUrl('images/main-bg.png') ?>) repeat;">
190
+ <p><?php echo $this->__('Please wait....') ?></p>
191
+ </div>
192
+ </div>
app/etc/modules/Biztech_Customtoolbar.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Biztech
5
+ * @package Biztech_Customtoolbar
6
+ * @author ModuleCreator
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Biztech_Customtoolbar>
13
+ <active>true</active>
14
+ <codePool>local</codePool>
15
+ </Biztech_Customtoolbar>
16
+ </modules>
17
+ </config>
package.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>customtoolbar_module</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Custom toolbar allows the users to filter the products based on the attributes of products. </summary>
10
+ <description>Custom toolbar allows the users to filter the products based on the attributes of products. This is very convenient tool both for the purchaser and the customers.&#xD;
11
+ Online store owners who deal with huge bulk of products, can drive the maximum out of this extension. They can easily organize their products so that their clients don&#x2019;t face any difficulty in finding the specific products with specific quality.&#xD;
12
+ You can filter your products based on any attribute as per your choice. For instance you can provide elements such as color, size, manufacturer, category etc to filter the products. When customers select any of these attributes, another drop down box appears to allow them to finish their selection. For e.g. if a client wants to filter some product based on color, then when he/she choose color from the filter drop down box, another drop down box appears from where they can select any color of their choice.&#xD;
13
+ Advantages&#xD;
14
+ &#x2022; This Magento module allows you to provide layered navigation for your products for the ease of visitors. This layered navigation facility saves lot of time of customer&#x2019;s required in shopping. Thus they become returning customers and the sale improves automatically.&#xD;
15
+ &#x2022; Instead of going deep down the navigation system to find the availability of some product fulfilling certain requirement, this extension helps viewers to filter products right from the beginning. This toolbar is present on category list page for the convenience of the clients.&#xD;
16
+ &#x2022; The custom Toolbar module allows your customers to get quick access to regularly used product with specific characteristics.&#xD;
17
+ &#x2022; The extension consists of friendly user interface making it easier to use. It can be installed quickly and with ease. &#xD;
18
+ </description>
19
+ <notes>-New Release</notes>
20
+ <authors><author><name>Biztech</name><user>biztechcon</user><email>sales@biztechconsultancy.com</email></author></authors>
21
+ <date>2013-07-01</date>
22
+ <time>12:17:04</time>
23
+ <contents><target name="mageetc"><dir name="modules"><file name="Biztech_Customtoolbar.xml" hash="6cd053117e062b8334759941b84c7806"/></dir></target><target name="magelocal"><dir name="Biztech"><dir name="Customtoolbar"><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="Attribute"><dir name="Edit"><dir name="Tab"><file name="Main.php" hash="46b5eac785f0f40e551b8a43eb71f4ed"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="82893973976fdab398b0d061e8426390"/></dir><dir name="controllers"><file name="IndexController.php" hash="19b0c174b4ee577fa83122e20da6ac79"/></dir><dir name="etc"><file name="config.xml" hash="86e9f7045261bacd5c6f4a2cf80ada9a"/><file name="system.xml" hash="3ccc36394334e30115890a5edffba211"/></dir><dir name="sql"><dir name="customtoolbar_setup"><file name="mysql4-install-0.1.0.php" hash="127973676228a67a8600437da0d08866"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="customtoolbar.xml" hash="33b5081676020676c9e374f54a6da200"/></dir><dir name="template"><dir name="customtoolbar"><file name="toolbar.phtml" hash="f62ff114be87cda12debf90c6196005e"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><file name="main-bg.png" hash="615e539beac7fc4ad7b6aa7e519ca2ee"/></dir></dir></dir></dir></target></contents>
24
+ <compatible/>
25
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
26
+ </package>
skin/frontend/base/default/images/main-bg.png ADDED
Binary file