Grasshopperpebbles_Configurablecolors - Version 1.0.2

Version Notes

Stable

Version 1.0.2
Added ability to change swatch sizes within admin.

Version Number 1.0.1
Updated Image Zoom Options
Fixed jQuery noConflict bug in admin

Version number: 1.0.0
Stability: Stable
Compatibility: 1.5, 1.6, 1.6.1, 1.6.2.0, 1.7

Download this release

Release Info

Developer Les Green
Extension Grasshopperpebbles_Configurablecolors
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/Grasshopperpebbles/Configurablecolors/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Grasshopperpebbles_Configurablecolors>
5
- <version>1.0.1</version>
6
  </Grasshopperpebbles_Configurablecolors>
7
  </modules>
8
  <adminhtml>
@@ -58,9 +58,6 @@
58
  <product_view_media>Grasshopperpebbles_Configurablecolors_Catalog_Block_Product_View_Media</product_view_media>
59
  </rewrite>
60
  </catalog>
61
- <!--<moo>
62
- <class>Moo_Catalog_Block</class>
63
- </moo> -->
64
  <configurablecolors>
65
  <class>Grasshopperpebbles_Configurablecolors_Block</class>
66
  </configurablecolors>
@@ -108,6 +105,14 @@
108
  <image_width>365</image_width>
109
  <image_height></image_height>
110
  </images>
 
 
 
 
 
 
 
 
111
  <zoom_settings>
112
  <show_zoom>1</show_zoom>
113
  <zoom_position>inside</zoom_position>
2
  <config>
3
  <modules>
4
  <Grasshopperpebbles_Configurablecolors>
5
+ <version>1.0.2</version>
6
  </Grasshopperpebbles_Configurablecolors>
7
  </modules>
8
  <adminhtml>
58
  <product_view_media>Grasshopperpebbles_Configurablecolors_Catalog_Block_Product_View_Media</product_view_media>
59
  </rewrite>
60
  </catalog>
 
 
 
61
  <configurablecolors>
62
  <class>Grasshopperpebbles_Configurablecolors_Block</class>
63
  </configurablecolors>
105
  <image_width>365</image_width>
106
  <image_height></image_height>
107
  </images>
108
+ <swatch_settings>
109
+ <swatch_width></swatch_width>
110
+ <swatch_height></swatch_height>
111
+ <swatch_selected_width></swatch_selected_width>
112
+ <swatch_selected_height></swatch_selected_height>
113
+ <swatch_selected_border_size></swatch_selected_border_size>
114
+ <swatch_selected_border_color></swatch_selected_border_color>
115
+ </swatch_settings>
116
  <zoom_settings>
117
  <show_zoom>1</show_zoom>
118
  <zoom_position>inside</zoom_position>
app/code/community/Grasshopperpebbles/Configurablecolors/etc/system.xml CHANGED
@@ -80,10 +80,75 @@
80
  </image_height>
81
  </fields>
82
  </images>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  <zoom_settings translate="label">
84
  <label>Zoom Settings</label>
85
  <frontend_type>text</frontend_type>
86
- <sort_order>2</sort_order>
87
  <show_in_default>1</show_in_default>
88
  <show_in_website>1</show_in_website>
89
  <show_in_store>1</show_in_store>
80
  </image_height>
81
  </fields>
82
  </images>
83
+ <swatch_settings translate="label">
84
+ <label>Swatch Settings</label>
85
+ <frontend_type>text</frontend_type>
86
+ <sort_order>2</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>1</show_in_website>
89
+ <show_in_store>1</show_in_store>
90
+ <fields>
91
+ <swatch_width translate="label">
92
+ <label>Swatch Width</label>
93
+ <frontend_type>text</frontend_type>
94
+ <sort_order>1</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ </swatch_width>
99
+ <swatch_height translate="label">
100
+ <label>Swatch Height</label>
101
+ <frontend_type>text</frontend_type>
102
+ <sort_order>2</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
+ </swatch_height>
107
+ <swatch_selected_width translate="label">
108
+ <label>Selected Swatch Width</label>
109
+ <comment>A border is displayed around the selected swatch. The width of the swatch is dependent upon the size of the border.</comment>
110
+ <frontend_type>text</frontend_type>
111
+ <sort_order>3</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ </swatch_selected_width>
116
+ <swatch_selected_height translate="label">
117
+ <label>Selected Swatch Height</label>
118
+ <comment>A border is displayed around the selected swatch. The height of the swatch is dependent upon the size of the border.</comment>
119
+ <frontend_type>text</frontend_type>
120
+ <sort_order>4</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ </swatch_selected_height>
125
+ <swatch_selected_border_size translate="label">
126
+ <label>Selected Swatch Border Size</label>
127
+ <frontend_type>text</frontend_type>
128
+ <sort_order>5</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>1</show_in_store>
132
+ </swatch_selected_border_size>
133
+ <swatch_selected_border_color translate="label">
134
+ <label>Selected Swatch Border Color</label>
135
+ <comment><![CDATA[
136
+ <p>Enter either a HTML Color Name
137
+ (Black, White, Navy, etc. - see <a href="http://www.w3schools.com/html/html_colornames.asp" target="_blank">HTML Color Names</a>) or a Hex value (#cccccc, etc). </p>
138
+ ]]></comment>
139
+ <frontend_type>text</frontend_type>
140
+ <sort_order>6</sort_order>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>1</show_in_store>
144
+ </swatch_selected_border_color>
145
+ </fields>
146
+ <comment>The Swatch Settings section is optional. The values are set using CSS and should be modified in the corresponding style sheet.</comment>
147
+ </swatch_settings>
148
  <zoom_settings translate="label">
149
  <label>Zoom Settings</label>
150
  <frontend_type>text</frontend_type>
151
+ <sort_order>3</sort_order>
152
  <show_in_default>1</show_in_default>
153
  <show_in_website>1</show_in_website>
154
  <show_in_store>1</show_in_store>
app/design/frontend/base/default/template/configurablecolors/settings.phtml CHANGED
@@ -1,11 +1,17 @@
1
  <?php
2
  $thumb_size = getConfigurableImageSizes('thumb');
3
  $large_size = getConfigurableImageSizes('image');
4
- $zoom_size = getConfigurableImageSizes('zoom_image');
 
 
 
 
 
 
5
 
6
- function getConfigurableImageSizes($size_type) {
7
- $size = Mage::getStoreConfig('configurablecolors/images/'. $size_type .'_width');
8
- $h = Mage::getStoreConfig('configurablecolors/images/'. $size_type .'_height');
9
  if ($h != '') {
10
  $size = $size . ',' . $h;
11
  }
@@ -25,13 +31,31 @@ jQuery(document).ready(function($) {
25
  swatch_class: 'gp-configurablecolors-swatch',
26
  swatch_class_selected: 'gp-configurablecolors-swatch-selected',
27
  swatch_image_url: '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA). "grasshopperpebbles_configurablecolors/"; ?>',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  thumb_size: '<?php echo $thumb_size; ?>',
29
  large_size: '<?php echo $large_size; ?>',
30
  zoom_image_size: '<?php echo $zoom_size; ?>',
31
  zoom_width: '<?php echo Mage::getStoreConfig('configurablecolors/zoom_settings/zoom_width'); ?>',
32
  zoom_height: '<?php echo Mage::getStoreConfig('configurablecolors/zoom_settings/zoom_height'); ?>',
33
  zoom_position: '<?php echo Mage::getStoreConfig('configurablecolors/zoom_settings/zoom_position'); ?>',
34
- use_zoom: Boolean(<?php echo Mage::getStoreConfig('configurablecolors/images/show_zoom'); ?>),
35
  //hide_color_dropdown: true,
36
  color_map: c_map
37
  });
1
  <?php
2
  $thumb_size = getConfigurableImageSizes('thumb');
3
  $large_size = getConfigurableImageSizes('image');
4
+ $zoom_size = getConfigurableImageSizes('zoom_image', 'zoom_settings/');
5
+ $swatch_width = Mage::getStoreConfig('configurablecolors/swatch_settings/swatch_width');
6
+ $swatch_height = Mage::getStoreConfig('configurablecolors/swatch_settings/swatch_height');
7
+ $swatch_selected_width = Mage::getStoreConfig('configurablecolors/swatch_settings/swatch_selected_width');
8
+ $swatch_selected_height = Mage::getStoreConfig('configurablecolors/swatch_settings/swatch_selected_height');
9
+ $swatch_selected_border_size = Mage::getStoreConfig('configurablecolors/swatch_settings/swatch_selected_border_size');
10
+ $swatch_selected_border_color = Mage::getStoreConfig('configurablecolors/swatch_settings/swatch_selected_border_color');
11
 
12
+ function getConfigurableImageSizes($size_type, $setting_type='images/') {
13
+ $size = Mage::getStoreConfig('configurablecolors/'. $setting_type . $size_type .'_width');
14
+ $h = Mage::getStoreConfig('configurablecolors/images/'.$setting_type . $size_type .'_height');
15
  if ($h != '') {
16
  $size = $size . ',' . $h;
17
  }
31
  swatch_class: 'gp-configurablecolors-swatch',
32
  swatch_class_selected: 'gp-configurablecolors-swatch-selected',
33
  swatch_image_url: '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA). "grasshopperpebbles_configurablecolors/"; ?>',
34
+ <?php if ($swatch_width) { ?>
35
+ swatch_width: '<?php echo $swatch_width; ?>',
36
+ <?php } ?>
37
+ <?php if ($swatch_height) { ?>
38
+ swatch_height: '<?php echo $swatch_height; ?>',
39
+ <?php } ?>
40
+ <?php if ($swatch_selected_width) { ?>
41
+ swatch_selected_width: '<?php echo $swatch_selected_width; ?>',
42
+ <?php } ?>
43
+ <?php if ($swatch_selected_height) { ?>
44
+ swatch_selected_height: '<?php echo $swatch_selected_height; ?>',
45
+ <?php } ?>
46
+ <?php if ($swatch_selected_border_size) { ?>
47
+ swatch_selected_border_size: '<?php echo $swatch_selected_border_size; ?>',
48
+ <?php } ?>
49
+ <?php if ($swatch_selected_border_color) { ?>
50
+ swatch_selected_border_color: '<?php echo $swatch_selected_border_color; ?>',
51
+ <?php } ?>
52
  thumb_size: '<?php echo $thumb_size; ?>',
53
  large_size: '<?php echo $large_size; ?>',
54
  zoom_image_size: '<?php echo $zoom_size; ?>',
55
  zoom_width: '<?php echo Mage::getStoreConfig('configurablecolors/zoom_settings/zoom_width'); ?>',
56
  zoom_height: '<?php echo Mage::getStoreConfig('configurablecolors/zoom_settings/zoom_height'); ?>',
57
  zoom_position: '<?php echo Mage::getStoreConfig('configurablecolors/zoom_settings/zoom_position'); ?>',
58
+ use_zoom: Boolean(<?php echo Mage::getStoreConfig('configurablecolors/zoom_settings/show_zoom'); ?>),
59
  //hide_color_dropdown: true,
60
  color_map: c_map
61
  });
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Grasshopperpebbles_Configurablecolors</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -14,6 +14,9 @@ The Configurable Colors extension also controls the display of the thumb and lar
14
  The Configurable Colors extension also comes with an image zoom component. The size of the zoom image is also configurable. </description>
15
  <notes>Stable&#xD;
16
  &#xD;
 
 
 
17
  Version Number 1.0.1&#xD;
18
  Updated Image Zoom Options&#xD;
19
  Fixed jQuery noConflict bug in admin&#xD;
@@ -23,9 +26,9 @@ Stability: Stable&#xD;
23
  Compatibility: 1.5, 1.6, 1.6.1, 1.6.2.0, 1.7&#xD;
24
  </notes>
25
  <authors><author><name>Les Green</name><user>lesgreen</user><email>lesgreen@grasshopperpebbles.com</email></author></authors>
26
- <date>2014-01-01</date>
27
- <time>21:53:56</time>
28
- <contents><target name="magecommunity"><dir name="Grasshopperpebbles"><dir name="Configurablecolors"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Zoomposition.php" hash="2883febb17ca83736fa9456c935a10dc"/></dir></dir></dir></dir></dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Colormap.php" hash="324bb5b9f058af0a7b7ed4fcf7ff277d"/></dir></dir></dir></dir></dir><file name="Settings.php" hash="9634c1ae39ebc33c4e81f12d47e4ceab"/></dir><dir name="Helper"><file name="Data.php" hash="4bc7051a030e42fef72ec56c76398c1f"/></dir><dir name="Model"><file name="Colormap.php" hash="789f595cc3c997c4b993a2a9ef7035ed"/><dir name="Resource"><file name="Setup.php" hash="97144fe5d6c87e4495c61ad0ef6a0c2c"/></dir></dir><dir name="controllers"><file name="ConfigurablecolorsController.php" hash="3da6cc0eb203a20047a2eb13f5a22202"/></dir><dir name="etc"><file name="config.xml" hash="a1b09a52d65a473db760765af7a0b122"/><file name="system.xml" hash="e9802c30c3682d9f002fac0420b47652"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="grasshopperpebbles_configurablecolors.xml" hash="68fb5f93bf72b1fd345ba0fdbff3c1f3"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="grasshopperpebbles_configurablecolors.xml" hash="de9b1df2e20d0b828513c636244ca7aa"/></dir><dir name="template"><dir name="configurablecolors"><file name="settings.phtml" hash="904d722a291a029bac5d8ff422834290"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Grasshopperpebbles_Configurablecolors.xml" hash="f1129be87d78650f72d6634d9e1b7786"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="grasshopperpebbles_configurablecolors"><file name="adminhtml.css" hash="a17f9528ed9dffe4af3d4551672467ba"/><file name="adminhtml.js" hash="3f467bf7d21d6b223520fcf337aa0617"/><file name="jquery-1.7.1.min.js" hash="a582795ee2a7189a8b9f616685944e5e"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="grasshopperpebbles_configurablecolors"><file name="cloud-zoom.css" hash="c38ebaa2cece30139d7f120d719c079a"/><file name="grasshopperpebbles_configurablecolors.css" hash="a634c8b47b31c93f760ad69c3487a745"/></dir></dir><dir name="js"><dir name="gpconfigurablecolors"><file name="cloud-zoom.1.0.2.min.js" hash="e233d9a799550d0f58248d6eee669590"/><file name="jquery.gpConfigurableColors-min.js" hash="a0dacf8252020062e4427a0730991751"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="frontend"><dir name="default"><dir name="default"><dir name="js"><file name="jquery-1.7.1.min.js" hash=""/></dir></dir></dir></dir></target></contents>
29
  <compatible/>
30
  <dependencies><required><php><min>5.2.0</min><max>5.5.7</max></php></required></dependencies>
31
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Grasshopperpebbles_Configurablecolors</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
14
  The Configurable Colors extension also comes with an image zoom component. The size of the zoom image is also configurable. </description>
15
  <notes>Stable&#xD;
16
  &#xD;
17
+ Version 1.0.2&#xD;
18
+ Added ability to change swatch sizes within admin.&#xD;
19
+ &#xD;
20
  Version Number 1.0.1&#xD;
21
  Updated Image Zoom Options&#xD;
22
  Fixed jQuery noConflict bug in admin&#xD;
26
  Compatibility: 1.5, 1.6, 1.6.1, 1.6.2.0, 1.7&#xD;
27
  </notes>
28
  <authors><author><name>Les Green</name><user>lesgreen</user><email>lesgreen@grasshopperpebbles.com</email></author></authors>
29
+ <date>2014-01-05</date>
30
+ <time>14:27:42</time>
31
+ <contents><target name="magecommunity"><dir name="Grasshopperpebbles"><dir name="Configurablecolors"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Zoomposition.php" hash="2883febb17ca83736fa9456c935a10dc"/></dir></dir></dir></dir></dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Colormap.php" hash="324bb5b9f058af0a7b7ed4fcf7ff277d"/></dir></dir></dir></dir></dir><file name="Settings.php" hash="9634c1ae39ebc33c4e81f12d47e4ceab"/></dir><dir name="Helper"><file name="Data.php" hash="4bc7051a030e42fef72ec56c76398c1f"/></dir><dir name="Model"><file name="Colormap.php" hash="789f595cc3c997c4b993a2a9ef7035ed"/><dir name="Resource"><file name="Setup.php" hash="97144fe5d6c87e4495c61ad0ef6a0c2c"/></dir></dir><dir name="controllers"><file name="ConfigurablecolorsController.php" hash="3da6cc0eb203a20047a2eb13f5a22202"/></dir><dir name="etc"><file name="config.xml" hash="a6a85b88dcb493227bbdc72753e58c98"/><file name="system.xml" hash="c61b121936adc5ad0d3f0fac9e438ed8"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="grasshopperpebbles_configurablecolors.xml" hash="68fb5f93bf72b1fd345ba0fdbff3c1f3"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="grasshopperpebbles_configurablecolors.xml" hash="de9b1df2e20d0b828513c636244ca7aa"/></dir><dir name="template"><dir name="configurablecolors"><file name="settings.phtml" hash="0aadc1fe8e6a9ef184332c8442b7e596"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Grasshopperpebbles_Configurablecolors.xml" hash="f1129be87d78650f72d6634d9e1b7786"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="grasshopperpebbles_configurablecolors"><file name="adminhtml.css" hash="a17f9528ed9dffe4af3d4551672467ba"/><file name="adminhtml.js" hash="3f467bf7d21d6b223520fcf337aa0617"/><file name="jquery-1.7.1.min.js" hash="a582795ee2a7189a8b9f616685944e5e"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="grasshopperpebbles_configurablecolors"><file name="cloud-zoom.css" hash="c38ebaa2cece30139d7f120d719c079a"/><file name="grasshopperpebbles_configurablecolors.css" hash="a634c8b47b31c93f760ad69c3487a745"/></dir></dir><dir name="js"><dir name="gpconfigurablecolors"><file name="cloud-zoom.1.0.2.min.js" hash="e233d9a799550d0f58248d6eee669590"/><file name="jquery.gpConfigurableColors-min.js" hash="98702ead817953d0b82efb0054ddab4d"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="frontend"><dir name="default"><dir name="default"><dir name="js"><file name="jquery-1.7.1.min.js" hash=""/></dir></dir></dir></dir></target></contents>
32
  <compatible/>
33
  <dependencies><required><php><min>5.2.0</min><max>5.5.7</max></php></required></dependencies>
34
  </package>
skin/frontend/default/default/js/gpconfigurablecolors/jquery.gpConfigurableColors-min.js CHANGED
@@ -1 +1 @@
1
- (function(e){e.fn.extend({gpConfigurableColors:function(t){opts=e.extend({},e.configurableColors.defaults,t);return this.each(function(){new e.configurableColors(this,opts)})}});e.configurableColors=function(t,n){function h(t){var r=e.parseJSON(t);u=r.hasGender==""?false:true;var i=p(r.items);i=d(0);var s=e("#"+n.swatch_container+" a")[0];g(e(s))}function p(t){var n=[];if(u){var r=[];e.each(t,function(n,i){if(r.indexOf(i.gender)==-1){r.push(i.gender);o[o.length]=e(t).filter(function(){return this.gender==i.gender})}})}else{var i=[];e.each(t,function(n,r){if(i.indexOf(r.item_size)==-1){i.push(r.item_size);o[o.length]=e(t).filter(function(){return this.item_size==r.item_size})}})}return true}function d(t){var r=n.color_map;var i,s,u,a,f;e.each(o[t],function(t,o){i=o.color_name;a=false;u=e("<a />").addClass(n.swatch_class);if(r.length>0){s=e(r).filter(function(){return this.color_name==o.color_name});if(s.length>0){if("color_hex"in s[0]){e(u).css("background-color",s[0]["color_hex"])}else if("color_class"in s[0]){a=true;e(u).addClass(s[0]["color_class"])}else if("color_image"in s[0]){e(u).append(e("<img />").attr("src",n.swatch_image_url+s[0]["color_image"]))}}else{e(u).css("background-color",i)}}else{e(u).css("background-color",i)}e(u).attr("title",o.color_name).appendTo(e("#"+n.swatch_container)).data("settings",{color_id:o.color_id,color:i,isClass:a,assoc_id:o.assoc_id,large_src:o.large_src,zoom_src:o.zoom_src,thumbs:o.thumbs}).click(function(){g(e(this))})});return true}function v(t){var n=spConfig.settings[s];e(n).val(t);var r=e(n).prop("selectedIndex");spConfig.settings[s].selectedIndex=r;var i=spConfig.settings[s];++s;Event.observe(i,"change",function(){});m(i,"change");if(u&&!a){a=true;setTimeout(function(){v(t)},1)}}function m(e,t){if(document.createEvent){var n=document.createEvent("HTMLEvents");n.initEvent(t,true,true);return!e.dispatchEvent(n)}else{var n=document.createEventObject();return e.fireEvent("on"+t,n)}}function g(t){if(i){e(i).removeClass(n.swatch_class_selected)}i=t;var r=e(t).data("settings").isClass;if(!r){e(i).addClass(n.swatch_class_selected)}spConfig.reloadPrice();e(l).children("span").remove();e(l).append(e("<span></span>").html(" "+e(t).data("settings").color));if(n.use_zoom){e("p.product-image img").remove();e("p.product-image").append(e("<a></a>").attr({href:e(t).data("settings").zoom_src,"class":"cloud-zoom",id:"cloudZoom",rel:"zoomWidth: '"+n.zoom_width+"',zoomHeight: '"+n.zoom_height+"',position: '"+n.zoom_position+"',smoothMove: 3,showTitle: true,titleOpacity: 0,lensOpacity: 0,tintOpacity: 0,softFocus: false"}).append(e("<img />").attr("src",e(t).data("settings").large_src)))}else{e("p.product-image img").attr("src",e(t).data("settings").large_src)}s=0;v(e(t).data("settings").color_id);y(t)}function y(t){var r,i;var s=e(t).data("settings").thumbs;e(".more-views ul").remove();var o=e("<ul></ul>").appendTo(".more-views");if(n.use_zoom){e.each(s,function(t,n){e(o).append(e("<li></li>").append(e("<a></a>").attr({rel:"useZoom: 'cloudZoom', smallImage: '"+n.large_src+"'",href:n.zoom_src}).addClass("cloud-zoom-gallery").append(e("<img />").attr("src",n.thumb_src))))});e(".cloud-zoom, .cloud-zoom-gallery").CloudZoom()}else{e.each(s,function(t,n){e(o).append(e("<li></li>").append(e("<a></a>").attr("href","#").append(e("<img />").attr("src",n.thumb_src)).click(function(){e("p.product-image img").attr("src",n.large_src)})))})}}function b(t,n,r,i,s,o){e.ajax({type:t,url:n,data:r,dataType:i,beforeSend:s,success:o,error:w})}function w(e,t,n){console.log(t)}function E(e){var t=0;for(elem in o){if(t==e){return elem}t++}}var r=e(t);var i="";var s=0;var o=[];var u=true;var a=false;var f=e("#attribute272").parent().parent();e("#"+n.swatch_container).appendTo(e(f));if(n.hide_color_dropdown){e("#attribute272").hide()}var l=e(f).siblings("dt")[0];if(n.assoc_products_url){var c={product_id:n.product_id,thumb_size:n.thumb_size,large_size:n.large_size,zoom_size:n.zoom_image_size};b("GET",n.assoc_products_url,c,"text","",h)}};e.configurableColors.defaults={product_id:"",sp_config:"",assoc_products_url:"",swatch_container:"",swatch_class:"",swatch_class_selected:"",hide_color_dropdown:true,swatch_image_url:"",thumb_size:"",large_size:"",zoom_image_size:"",zoom_width:"",zoom_height:"",zoom_position:"",use_zoom:true}})(jQuery)
1
+ (function(e){e.fn.extend({gpConfigurableColors:function(t){opts=e.extend({},e.configurableColors.defaults,t);return this.each(function(){new e.configurableColors(this,opts)})}});e.configurableColors=function(t,n){function h(t){var r=e.parseJSON(t);u=r.hasGender==""?false:true;var i=p(r.items);i=d(0);var s=e("#"+n.swatch_container+" a")[0];g(e(s))}function p(t){var n=[];if(u){var r=[];e.each(t,function(n,i){if(r.indexOf(i.gender)==-1){r.push(i.gender);o[o.length]=e(t).filter(function(){return this.gender==i.gender})}})}else{var i=[];e.each(t,function(n,r){if(i.indexOf(r.item_size)==-1){i.push(r.item_size);o[o.length]=e(t).filter(function(){return this.item_size==r.item_size})}})}return true}function d(t){var r=n.color_map;var i,s,u,a,f;e.each(o[t],function(t,o){i=o.color_name;a=false;u=e("<a />").addClass(n.swatch_class);var f=S(u,false);if(r.length>0){s=e(r).filter(function(){return this.color_name==o.color_name});if(s.length>0){if("color_hex"in s[0]){e(u).css("background-color",s[0]["color_hex"])}else if("color_class"in s[0]){a=true;e(u).addClass(s[0]["color_class"])}else if("color_image"in s[0]){e(u).append(e("<img />").attr("src",n.swatch_image_url+s[0]["color_image"]))}}else{e(u).css("background-color",i)}}else{e(u).css("background-color",i)}e(u).attr("title",o.color_name).appendTo(e("#"+n.swatch_container)).data("settings",{color_id:o.color_id,color:i,isClass:a,assoc_id:o.assoc_id,large_src:o.large_src,zoom_src:o.zoom_src,thumbs:o.thumbs}).click(function(){g(e(this))})});return true}function v(t){var n=spConfig.settings[s];e(n).val(t);var r=e(n).prop("selectedIndex");spConfig.settings[s].selectedIndex=r;var i=spConfig.settings[s];++s;Event.observe(i,"change",function(){});m(i,"change");if(u&&!a){a=true;setTimeout(function(){v(t)},1)}}function m(e,t){if(document.createEvent){var n=document.createEvent("HTMLEvents");n.initEvent(t,true,true);return!e.dispatchEvent(n)}else{var n=document.createEventObject();return e.fireEvent("on"+t,n)}}function g(t){if(i){e(i).removeClass(n.swatch_class_selected);var r=S(e(i),false)}i=t;var o=e(t).data("settings").isClass;if(!o){e(i).addClass(n.swatch_class_selected);var r=S(e(i),true)}spConfig.reloadPrice();e(l).children("span").remove();e(l).append(e("<span></span>").html(" "+e(t).data("settings").color));if(n.use_zoom){e("p.product-image img").remove();e("p.product-image").append(e("<a></a>").attr({href:e(t).data("settings").zoom_src,"class":"cloud-zoom",id:"cloudZoom",rel:"zoomWidth: '"+n.zoom_width+"',zoomHeight: '"+n.zoom_height+"',position: '"+n.zoom_position+"',smoothMove: 3,showTitle: true,titleOpacity: 0,lensOpacity: 0,tintOpacity: 0,softFocus: false"}).append(e("<img />").attr("src",e(t).data("settings").large_src)))}else{e("p.product-image img").attr("src",e(t).data("settings").large_src)}s=0;v(e(t).data("settings").color_id);y(t)}function y(t){var r,i;var s=e(t).data("settings").thumbs;e(".more-views ul").remove();var o=e("<ul></ul>").appendTo(".more-views");if(n.use_zoom){e.each(s,function(t,n){e(o).append(e("<li></li>").append(e("<a></a>").attr({rel:"useZoom: 'cloudZoom', smallImage: '"+n.large_src+"'",href:n.zoom_src}).addClass("cloud-zoom-gallery").append(e("<img />").attr("src",n.thumb_src))))});e(".cloud-zoom, .cloud-zoom-gallery").CloudZoom()}else{e.each(s,function(t,n){e(o).append(e("<li></li>").append(e("<a></a>").attr("href","#").append(e("<img />").attr("src",n.thumb_src)).click(function(){e("p.product-image img").attr("src",n.large_src)})))})}}function b(t,n,r,i,s,o){e.ajax({type:t,url:n,data:r,dataType:i,beforeSend:s,success:o,error:w})}function w(e,t,n){console.log(t)}function E(e){var t=0;for(elem in o){if(t==e){return elem}t++}}function S(t,r){if(r){if(n.swatch_selected_width){e(t).css("width",n.swatch_selected_width+"px")}if(n.swatch_selected_height){e(t).css("height",n.swatch_selected_height+"px")}if(n.swatch_selected_border_size){e(t).css("border-width",n.swatch_selected_border_size+"px")}if(n.swatch_selected_border_color){e(t).css("border-color",n.swatch_selected_border_color)}}else{if(n.swatch_width){e(t).css("width",n.swatch_width+"px")}if(n.swatch_height){e(t).css("height",n.swatch_height+"px")}if(n.swatch_selected_border_size){e(t).css("border","none")}}return true}var r=e(t);var i="";var s=0;var o=[];var u=true;var a=false;var f=e("#attribute272").parent().parent();e("#"+n.swatch_container).appendTo(e(f));if(n.hide_color_dropdown){e("#attribute272").hide()}var l=e(f).siblings("dt")[0];if(n.assoc_products_url){var c={product_id:n.product_id,thumb_size:n.thumb_size,large_size:n.large_size,zoom_size:n.zoom_image_size};b("GET",n.assoc_products_url,c,"text","",h)}};e.configurableColors.defaults={product_id:"",sp_config:"",assoc_products_url:"",swatch_container:"",swatch_class:"",swatch_class_selected:"",hide_color_dropdown:true,swatch_image_url:"",swatch_width:"",swatch_height:"",swatch_selected_width:"",swatch_selected_height:"",swatch_selected_border_size:"",swatch_selected_border_color:"",thumb_size:"",large_size:"",zoom_image_size:"",zoom_width:"",zoom_height:"",zoom_position:"",use_zoom:true}})(jQuery)