HK_Optionswatches - Version 1.1.1

Version Notes

Version 1.1.1 added enable/disable function for list page and product details page.

Download this release

Release Info

Developer Hardik
Extension HK_Optionswatches
Version 1.1.1
Comparing to
See all releases


Code changes from version 1.0.1 to 1.1.1

app/code/community/HK/Optionswatches/etc/system.xml CHANGED
@@ -19,10 +19,30 @@
19
  <show_in_website>1</show_in_website>
20
  <show_in_store>1</show_in_store>
21
  <fields>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  <option_swatches translate="label comment">
23
  <label>Custom Option Swatches</label>
24
  <frontend_type>textarea</frontend_type>
25
- <sort_order>26</sort_order>
26
  <show_in_default>1</show_in_default>
27
  <show_in_website>1</show_in_website>
28
  <show_in_store>1</show_in_store>
19
  <show_in_website>1</show_in_website>
20
  <show_in_store>1</show_in_store>
21
  <fields>
22
+ <enabled>
23
+ <label>Enable on list page</label>
24
+ <frontend_type>select</frontend_type>
25
+ <source_model>adminhtml/system_config_source_yesno</source_model>
26
+ <sort_order>1</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ <comment>Enable Custom Option Swatches module on product list page</comment>
31
+ </enabled>
32
+ <view_enabled>
33
+ <label>Enable on view page</label>
34
+ <frontend_type>select</frontend_type>
35
+ <source_model>adminhtml/system_config_source_yesno</source_model>
36
+ <sort_order>2</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ <comment>Enable Custom Option Swatches module on product details page</comment>
41
+ </view_enabled>
42
  <option_swatches translate="label comment">
43
  <label>Custom Option Swatches</label>
44
  <frontend_type>textarea</frontend_type>
45
+ <sort_order>3</sort_order>
46
  <show_in_default>1</show_in_default>
47
  <show_in_website>1</show_in_website>
48
  <show_in_store>1</show_in_store>
app/design/frontend/base/default/layout/optionswatches.xml CHANGED
@@ -3,40 +3,40 @@
3
  <layout version="0.1.0">
4
  <catalog_product_view translate="label">
5
  <reference name="head">
6
- <action method="addCss"><stylesheet>css/hk_optionswatches.css</stylesheet></action>
7
  </reference>
8
  <reference name="product.info.options.wrapper">
9
  <block type="optionswatches/index" name="optionswatches_index" template="optionswatches/option_js.phtml"/>
10
  </reference>
11
  </catalog_product_view>
12
 
13
- <catalog_category_default translate="label">
14
  <reference name="head">
15
- <action method="addCss"><stylesheet>css/hk_optionswatches.css</stylesheet></action>
16
  </reference>
17
  <reference name="product_list">
18
  <block type="optionswatches/index" name="optionswatches_index" template="optionswatches/option_js.phtml"/>
19
  </reference>
20
- <reference name="product_list">
21
- <action method="setTemplate">
22
- <template>optionswatches/list.phtml</template>
23
- </action>
24
- </reference>
 
25
  </catalog_category_default>
26
 
27
  <catalog_category_layered translate="label">
28
  <reference name="head">
29
- <action method="addCss"><stylesheet>css/hk_optionswatches.css</stylesheet></action>
30
  </reference>
31
  <reference name="product_list">
32
  <block type="optionswatches/index" name="optionswatches_index" template="optionswatches/option_js.phtml"/>
33
  </reference>
34
  <reference name="product_list">
35
- <action method="setTemplate">
36
  <template>optionswatches/list.phtml</template>
37
  </action>
38
  </reference>
39
  </catalog_category_layered>
40
 
41
- </layout>
42
-
3
  <layout version="0.1.0">
4
  <catalog_product_view translate="label">
5
  <reference name="head">
6
+ <action method="addCss" ifconfig="optionswatches/image/view_enabled"><stylesheet>css/hk_optionswatches.css</stylesheet></action>
7
  </reference>
8
  <reference name="product.info.options.wrapper">
9
  <block type="optionswatches/index" name="optionswatches_index" template="optionswatches/option_js.phtml"/>
10
  </reference>
11
  </catalog_product_view>
12
 
13
+ <catalog_category_default translate="label">
14
  <reference name="head">
15
+ <action method="addCss" ifconfig="optionswatches/image/enabled"><stylesheet>css/hk_optionswatches.css</stylesheet></action>
16
  </reference>
17
  <reference name="product_list">
18
  <block type="optionswatches/index" name="optionswatches_index" template="optionswatches/option_js.phtml"/>
19
  </reference>
20
+
21
+ <reference name="product_list">
22
+ <action method="setTemplate" ifconfig="optionswatches/image/enabled">
23
+ <template>optionswatches/list.phtml</template>
24
+ </action>
25
+ </reference>
26
  </catalog_category_default>
27
 
28
  <catalog_category_layered translate="label">
29
  <reference name="head">
30
+ <action method="addCss" ifconfig="optionswatches/image/enabled"><stylesheet>css/hk_optionswatches.css</stylesheet></action>
31
  </reference>
32
  <reference name="product_list">
33
  <block type="optionswatches/index" name="optionswatches_index" template="optionswatches/option_js.phtml"/>
34
  </reference>
35
  <reference name="product_list">
36
+ <action method="setTemplate" ifconfig="optionswatches/image/enabled">
37
  <template>optionswatches/list.phtml</template>
38
  </action>
39
  </reference>
40
  </catalog_category_layered>
41
 
42
+ </layout>
 
app/design/frontend/base/default/template/optionswatches/option_js.phtml CHANGED
@@ -1,5 +1,17 @@
1
- <?php
2
- $hkswatches = $this->get_option_swatches();
 
 
 
 
 
 
 
 
 
 
 
 
3
  ?>
4
 
5
  <script type="text/javascript">
@@ -123,4 +135,5 @@ $hkswatches = $this->get_option_swatches();
123
  alert("Option Swatches javascript error. Please report this error to hkpatel201@gmail.com. Error:" + e.message);
124
  }
125
  });
126
- </script>
 
1
+ <?php
2
+ $pageName = $this->getRequest()->getControllerName();
3
+ if($pageName=="category")
4
+ {
5
+ $isEnabled = Mage::getStoreConfig('optionswatches/image/enabled',Mage::app()->getStore() == 1);
6
+ }
7
+ if($pageName=="product")
8
+ {
9
+ $isEnabled = Mage::getStoreConfig('optionswatches/image/view_enabled',Mage::app()->getStore() == 1);
10
+ }
11
+
12
+ if($isEnabled == 1)
13
+ {
14
+ $hkswatches = $this->get_option_swatches();
15
  ?>
16
 
17
  <script type="text/javascript">
135
  alert("Option Swatches javascript error. Please report this error to hkpatel201@gmail.com. Error:" + e.message);
136
  }
137
  });
138
+ </script>
139
+ <?php } ?>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>HK_Optionswatches</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OLS v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>HK Option Swatches Magento Extension</summary>
10
  <description>HK Option Swatches Magento Extensions, create drop-down custom options to swatches.</description>
11
- <notes>Version 1.0.1 first Release</notes>
12
  <authors><author><name>Hardik</name><user>khpatel201</user><email>hkpatel201@gmail.com</email></author></authors>
13
- <date>2015-01-07</date>
14
- <time>07:44:42</time>
15
- <contents><target name="magecommunity"><dir name="HK"><dir name="Optionswatches"><dir name="Block"><file name="Index.php" hash="c917b7a36eddba3a9ee7f2ea7a22c617"/></dir><dir name="Helper"><file name="Data.php" hash="c8f049e1475d5456829afcd9b604c873"/></dir><dir name="etc"><file name="config.xml" hash="975061ac6672ea2d143ca7229754af7a"/><file name="system.xml" hash="f8cf65d1d16a067d56c4803a78dd0a82"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="optionswatches.xml" hash="7f65b4ee9d80319c4564e7fc1c700cd7"/></dir><dir name="template"><dir name="optionswatches"><file name="list.phtml" hash="e93e0e340c9b8a3f1ab2fe529ddd45ce"/><file name="option_js.phtml" hash="784ea246407b7a2770594b42df034ff9"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="HK_Optionswatches.xml" hash="c024476a3337515e1128c3b78d53104f"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="hk_optionswatches.css" hash="d5a7bb3cbff765ae560869fd88c18471"/></dir></dir></dir></dir></target><target name="magemedia"><dir name="hk_option_swatches"><file name="black.png" hash="f05c5386e416e53ec2b10060f5837b47"/><file name="blue.png" hash="e254da06b5e924011035ede292b9ffdd"/><file name="l.png" hash="77f053586eba95833b4bc05515c302a9"/><file name="m.png" hash="ad4e90ef4577452856c3c15534913d84"/><file name="red.png" hash="9223706248b9b63bc6a4751809bb2781"/><file name="s.png" hash="44eeeee15a7bff5459276de4eb64d496"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>HK_Optionswatches</name>
4
+ <version>1.1.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OLS v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>HK Option Swatches Magento Extension</summary>
10
  <description>HK Option Swatches Magento Extensions, create drop-down custom options to swatches.</description>
11
+ <notes>Version 1.1.1 added enable/disable function for list page and product details page.</notes>
12
  <authors><author><name>Hardik</name><user>khpatel201</user><email>hkpatel201@gmail.com</email></author></authors>
13
+ <date>2015-01-27</date>
14
+ <time>12:57:40</time>
15
+ <contents><target name="magecommunity"><dir name="HK"><dir name="Optionswatches"><dir name="Block"><file name="Index.php" hash="c917b7a36eddba3a9ee7f2ea7a22c617"/></dir><dir name="Helper"><file name="Data.php" hash="c8f049e1475d5456829afcd9b604c873"/></dir><dir name="etc"><file name="config.xml" hash="975061ac6672ea2d143ca7229754af7a"/><file name="system.xml" hash="85f964ab28280fe291b9d07bbb193a7e"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="optionswatches.xml" hash="29c9be05e0ea33d932d9e985141428aa"/></dir><dir name="template"><dir name="optionswatches"><file name="list.phtml" hash="e93e0e340c9b8a3f1ab2fe529ddd45ce"/><file name="option_js.phtml" hash="7c9a309c3cf9882aa72c8c94650a12d4"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="HK_Optionswatches.xml" hash="c024476a3337515e1128c3b78d53104f"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="hk_optionswatches.css" hash="d5a7bb3cbff765ae560869fd88c18471"/></dir></dir></dir></dir></target><target name="magemedia"><dir name="hk_option_swatches"><file name="black.png" hash="f05c5386e416e53ec2b10060f5837b47"/><file name="blue.png" hash="e254da06b5e924011035ede292b9ffdd"/><file name="l.png" hash="77f053586eba95833b4bc05515c302a9"/><file name="m.png" hash="ad4e90ef4577452856c3c15534913d84"/><file name="red.png" hash="9223706248b9b63bc6a4751809bb2781"/><file name="s.png" hash="44eeeee15a7bff5459276de4eb64d496"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>