discountlayerfilter - Version 1.0.0

Version Notes

This module is useful to display Discount Field into Layer Filter.

Download this release

Release Info

Developer Praful Rajput
Extension discountlayerfilter
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Bdt/Discountlayerfilter/etc/config.xml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Bdt_Discountlayerfilter>
5
+ <version>0.1.0</version>
6
+ </Bdt_Discountlayerfilter>
7
+ </modules>
8
+ <global>
9
+ <resources>
10
+ <discountlayerfilter_setup>
11
+ <setup>
12
+ <module>Bdt_Discountlayerfilter</module>
13
+ <class>Mage_Catalog_Model_Resource_Setup</class>
14
+ </setup>
15
+ <connection>
16
+ <use>core_setup</use>
17
+ </connection>
18
+ </discountlayerfilter_setup>
19
+ </resources>
20
+
21
+ </global>
22
+ <adminhtml>
23
+ <layout>
24
+ <updates>
25
+ <discountlayerfilter>
26
+ <file>discountlayerfilter.xml</file>
27
+ </discountlayerfilter>
28
+ </updates>
29
+ </layout>
30
+ </adminhtml>
31
+ </config>
app/code/local/Bdt/Discountlayerfilter/sql/discountlayerfilter_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ try{
4
+ $productTypes = array(
5
+ Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
6
+ Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
7
+ );
8
+ $productTypes = join(',', $productTypes);
9
+
10
+ $installer->startSetup();
11
+ $installer->addAttribute('catalog_product', 'discount', array(
12
+ 'group' => 'Prices',
13
+ 'type' => Varien_Db_Ddl_Table::TYPE_VARCHAR,
14
+ 'backend' => '',
15
+ 'frontend' => '',
16
+ 'label' => 'Discount',
17
+ 'input' => 'price',
18
+ 'class' => '',
19
+ 'source' => '',
20
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
21
+ 'visible' => true,
22
+ 'required' => false,
23
+ 'user_defined' => true,
24
+ 'default' => '',
25
+ 'searchable' => false,
26
+ 'filterable' => true,
27
+ 'comparable' => false,
28
+ //'visible_on_front' => true,
29
+ 'unique' => false,
30
+ 'apply_to' => $productTypes,
31
+ 'is_configurable' => false
32
+ ));
33
+
34
+ $installer->endSetup();
35
+ }
36
+ catch(Exception $ex){
37
+ echo $ex->getMessage();
38
+ }
app/design/adminhtml/default/default/layout/discountlayerfilter.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <adminhtml_catalog_product_new>
4
+ <reference name="js">
5
+ <block type="adminhtml/catalog_product_edit_js" template="discountlayerfilter/catalog/product/js.phtml" name="discountlayerfilter_catalog_product_js"/>
6
+ </reference>
7
+ </adminhtml_catalog_product_new>
8
+ <adminhtml_catalog_product_edit>
9
+ <reference name="js">
10
+ <block type="adminhtml/catalog_product_edit_js" template="discountlayerfilter/catalog/product/js.phtml" name="discountlayerfilter_catalog_product_js"/>
11
+ </reference>
12
+ </adminhtml_catalog_product_edit>
13
+ </layout>
app/design/adminhtml/default/default/template/discountlayerfilter/catalog/product/js.phtml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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@magento.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.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <script type="text/javascript">
28
+ //<![CDATA[
29
+
30
+ Event.observe(window, 'load', setDescountReadonly);
31
+ function setDescountReadonly(){
32
+ $('discount').readOnly = true;
33
+ }
34
+ Event.observe('special_price', 'blur', function(event) {
35
+ $price = $('price').value;
36
+ $specialPrice = $('special_price').value;
37
+ if($specialPrice > 0){
38
+ $percentage = ($specialPrice / $price) * 100;
39
+ $('discount').value = $percentage ;
40
+ }else{
41
+ $('discount').value = '';
42
+ }
43
+
44
+ });
45
+
46
+ //]]>
47
+ </script>
app/etc/modules/Bdt_Discountlayerfilter.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Bdt_Discountlayerfilter>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Bdt_Discountlayerfilter>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>discountlayerfilter</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License </license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary> This module is useful to display Discount Field into Layer Filter. </summary>
10
+ <description> This module is useful to display Discount Field into Layer Filter. &#xD;
11
+ Added new Product Attribute 'discount'.&#xD;
12
+ Apply it to all attribute set under Prices group.&#xD;
13
+ This will calculate the discount percentage from Price &amp; Special Price.&#xD;
14
+ Discount field value will apply when you set Special Price value.&#xD;
15
+ Note: When you will import product from CSV, you have to add discount column with value. </description>
16
+ <notes>This module is useful to display Discount Field into Layer Filter. &#xD;
17
+ </notes>
18
+ <authors><author><name>Praful Rajput</name><user>vasuscoin</user><email>rajput.praful@gmail.com</email></author></authors>
19
+ <date>2015-07-09</date>
20
+ <time>12:36:31</time>
21
+ <contents><target name="magelocal"><dir name="Bdt"><dir name="Discountlayerfilter"><dir><dir name="etc"><file name="config.xml" hash="61874a3bd053e83bd527953c1c7522c7"/></dir><dir name="sql"><dir name="discountlayerfilter_setup"><file name="mysql4-install-0.1.0.php" hash="2aba8d6f99bcabe23214dc985e51deb3"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="discountlayerfilter.xml" hash="df70194ce670e4f498d3bf120dea7ec7"/></dir><dir name="template"><dir name="discountlayerfilter"><dir><dir name="catalog"><dir name="product"><file name="js.phtml" hash="01061849b9db527bc01babe71cb2a0aa"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bdt_Discountlayerfilter.xml" hash="77e3bd74bf932bf879744eec84308883"/></dir></target></contents>
22
+ <compatible/>
23
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
24
+ </package>