Version Notes
Stable
Version 1.0.6
Fixed problems with using extension with 3rd-party templates
Version 1.0.5
Fixed Bug: File mis-named
Version 1.0.4
Changed codePool to community
Version 1.0.3
Fixed jQuery bug in Admin
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.6 |
Comparing to | |
See all releases |
Code changes from version 1.0.5 to 1.0.6
- app/code/community/Grasshopperpebbles/Configurablecolors/Catalog/Block/Product/View/Media.php +30 -0
- app/code/community/Grasshopperpebbles/Configurablecolors/Helper/Data.php +20 -1
- app/design/frontend/base/default/layout/grasshopperpebbles_configurablecolors.xml +5 -0
- app/design/frontend/base/default/template/configurablecolors/catalog/product/view/media.phtml +63 -0
- app/design/frontend/base/default/template/configurablecolors/settings.phtml +10 -3
- app/etc/modules/Grasshopperpebbles_Configurablecolors.xml +1 -1
- package.xml +7 -4
- skin/frontend/default/default/js/gpconfigurablecolors/jquery.gpConfigurableColors.min.js +1 -1
app/code/community/Grasshopperpebbles/Configurablecolors/Catalog/Block/Product/View/Media.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Moo Extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Moo
|
17 |
+
* @package Moo_Catalog
|
18 |
+
* @author Mohamed Alsharaf <mohamed.alsharaf@gmail.com>
|
19 |
+
* @copyright Copyright (c) 2010 Mohamed Alsharaf. (http://jamandcheese-on-phptoast.com)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Grasshopperpebbles_Configurablecolors_Catalog_Block_Product_View_Media extends Mage_Catalog_Block_Product_View_Media
|
23 |
+
{
|
24 |
+
|
25 |
+
public function layout()
|
26 |
+
{
|
27 |
+
return "Block loaded";
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
app/code/community/Grasshopperpebbles/Configurablecolors/Helper/Data.php
CHANGED
@@ -1,4 +1,23 @@
|
|
1 |
<?php
|
2 |
class Grasshopperpebbles_Configurablecolors_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
}
|
1 |
<?php
|
2 |
class Grasshopperpebbles_Configurablecolors_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
+
|
4 |
+
protected function _getConnection($type = 'core_read'){
|
5 |
+
return Mage::getSingleton('core/resource')->getConnection($type);
|
6 |
+
}
|
7 |
+
|
8 |
+
protected function _getTableName($tableName){
|
9 |
+
return Mage::getSingleton('core/resource')->getTableName($tableName);
|
10 |
+
}
|
11 |
+
|
12 |
+
public function _getAttributeId($attribute_code = 'price', $entity_type_id){
|
13 |
+
$connection = $this->_getConnection('core_read');
|
14 |
+
$sql = "SELECT attribute_id FROM " . $this->_getTableName('eav_attribute') . " WHERE entity_type_id = ? AND attribute_code = ?";
|
15 |
+
return $connection->fetchOne($sql, array($entity_type_id, $attribute_code));
|
16 |
+
}
|
17 |
+
|
18 |
+
public function _getEntityTypeId($entity_type_code = 'catalog_product'){
|
19 |
+
$connection = $this->_getConnection('core_read');
|
20 |
+
$sql = "SELECT entity_type_id FROM " . $this->_getTableName('eav_entity_type') . " WHERE entity_type_code = ?";
|
21 |
+
return $connection->fetchOne($sql, array($entity_type_code));
|
22 |
+
}
|
23 |
}
|
app/design/frontend/base/default/layout/grasshopperpebbles_configurablecolors.xml
CHANGED
@@ -10,6 +10,11 @@
|
|
10 |
<action method="addItem"><type>skin_js</type><name>js/gpconfigurablecolors/cloud-zoom.1.0.2.min.js</name></action>
|
11 |
<action method="addItem"><type>skin_js</type><name>js/gpconfigurablecolors/jquery.gpConfigurableColors.min.js</name></action>
|
12 |
</reference>
|
|
|
|
|
|
|
|
|
|
|
13 |
<reference name="product.info.options.wrapper"> <!-- product.info.extrahint -->
|
14 |
<block type="configurablecolors/settings" name="configurablecolors_settings" template="configurablecolors/settings.phtml" />
|
15 |
</reference>
|
10 |
<action method="addItem"><type>skin_js</type><name>js/gpconfigurablecolors/cloud-zoom.1.0.2.min.js</name></action>
|
11 |
<action method="addItem"><type>skin_js</type><name>js/gpconfigurablecolors/jquery.gpConfigurableColors.min.js</name></action>
|
12 |
</reference>
|
13 |
+
<reference name="product.info.media">
|
14 |
+
<action method="setTemplate">
|
15 |
+
<template>configurablecolors/catalog/product/view/media.phtml</template>
|
16 |
+
</action>
|
17 |
+
</reference>
|
18 |
<reference name="product.info.options.wrapper"> <!-- product.info.extrahint -->
|
19 |
<block type="configurablecolors/settings" name="configurablecolors_settings" template="configurablecolors/settings.phtml" />
|
20 |
</reference>
|
app/design/frontend/base/default/template/configurablecolors/catalog/product/view/media.phtml
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
/**
|
28 |
+
* Product media data template
|
29 |
+
*
|
30 |
+
* @see Mage_Catalog_Block_Product_View_Media
|
31 |
+
*/
|
32 |
+
?>
|
33 |
+
<?php
|
34 |
+
$_product = $this->getProduct();
|
35 |
+
$_helper = $this->helper('catalog/output');
|
36 |
+
?>
|
37 |
+
<?php if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?>
|
38 |
+
<p class="product-image product-image-zoom">
|
39 |
+
<?php
|
40 |
+
$_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image').'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
|
41 |
+
echo $_helper->productAttribute($_product, $_img, 'image');
|
42 |
+
?>
|
43 |
+
</p>
|
44 |
+
<?php else: ?>
|
45 |
+
<p class="product-image">
|
46 |
+
<?php
|
47 |
+
$_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
|
48 |
+
echo $_helper->productAttribute($_product, $_img, 'image');
|
49 |
+
?>
|
50 |
+
</p>
|
51 |
+
<?php endif; ?>
|
52 |
+
<?php if (count($this->getGalleryImages()) > 0): ?>
|
53 |
+
<div class="more-views">
|
54 |
+
<h2><?php echo $this->__('More Views') ?></h2>
|
55 |
+
<ul>
|
56 |
+
<?php foreach ($this->getGalleryImages() as $_image): ?>
|
57 |
+
<li>
|
58 |
+
<a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" width="56" height="56" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
|
59 |
+
</li>
|
60 |
+
<?php endforeach; ?>
|
61 |
+
</ul>
|
62 |
+
</div>
|
63 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/configurablecolors/settings.phtml
CHANGED
@@ -8,6 +8,9 @@ $swatch_selected_width = Mage::getStoreConfig('configurablecolors/swatch_setting
|
|
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');
|
@@ -22,8 +25,11 @@ function getConfigurableImageSizes($size_type, $setting_type='images/') {
|
|
22 |
<script type="text/javascript">
|
23 |
jQuery.noConflict();
|
24 |
jQuery(document).ready(function($) {
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
27 |
$(document.body).gpConfigurableColors({
|
28 |
product_id: '<?php echo Mage::registry('current_product')->getId(); ?>',
|
29 |
assoc_products_url: '<?php echo $this->getUrl('configurablecolors/configurablecolors/getassociatedproducts/'); ?>',
|
@@ -56,7 +62,8 @@ jQuery(document).ready(function($) {
|
|
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 |
-
|
|
|
60 |
color_map: c_map
|
61 |
});
|
62 |
});
|
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 |
+
$color_map = Mage::getStoreConfig('configurablecolors/color_options/color_map');
|
12 |
+
$entity_type_id = Mage::helper('configurablecolors/data')->_getEntityTypeId();
|
13 |
+
$color_attrib = Mage::helper('configurablecolors/data')->_getAttributeId('color', $entity_type_id);
|
14 |
|
15 |
function getConfigurableImageSizes($size_type, $setting_type='images/') {
|
16 |
$size = Mage::getStoreConfig('configurablecolors/'. $setting_type . $size_type .'_width');
|
25 |
<script type="text/javascript">
|
26 |
jQuery.noConflict();
|
27 |
jQuery(document).ready(function($) {
|
28 |
+
var c_map = '';
|
29 |
+
<?php if ($color_map) { ?>
|
30 |
+
c_map = <?php echo $color_map; ?>
|
31 |
+
c_map = c_map.color_map;
|
32 |
+
<?php } ?>
|
33 |
$(document.body).gpConfigurableColors({
|
34 |
product_id: '<?php echo Mage::registry('current_product')->getId(); ?>',
|
35 |
assoc_products_url: '<?php echo $this->getUrl('configurablecolors/configurablecolors/getassociatedproducts/'); ?>',
|
62 |
zoom_height: '<?php echo Mage::getStoreConfig('configurablecolors/zoom_settings/zoom_height'); ?>',
|
63 |
zoom_position: '<?php echo Mage::getStoreConfig('configurablecolors/zoom_settings/zoom_position'); ?>',
|
64 |
use_zoom: Boolean(<?php echo Mage::getStoreConfig('configurablecolors/zoom_settings/show_zoom'); ?>),
|
65 |
+
hide_color_dropdown: true,
|
66 |
+
color_attrib_id: '<?php echo $color_attrib; ?>',
|
67 |
color_map: c_map
|
68 |
});
|
69 |
});
|
app/etc/modules/Grasshopperpebbles_Configurablecolors.xml
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<modules>
|
4 |
<Grasshopperpebbles_Configurablecolors>
|
5 |
<active>true</active>
|
6 |
-
<codePool>
|
7 |
</Grasshopperpebbles_Configurablecolors>
|
8 |
</modules>
|
9 |
</config>
|
3 |
<modules>
|
4 |
<Grasshopperpebbles_Configurablecolors>
|
5 |
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
</Grasshopperpebbles_Configurablecolors>
|
8 |
</modules>
|
9 |
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Grasshopperpebbles_Configurablecolors</name>
|
4 |
-
<version>1.0.
|
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
|
16 |

|
|
|
|
|
|
|
17 |
Version 1.0.5
|
18 |
Fixed Bug: File mis-named
|
19 |

|
@@ -35,9 +38,9 @@ Stability: Stable
|
|
35 |
Compatibility: 1.5, 1.6, 1.6.1, 1.6.2.0, 1.7
|
36 |
</notes>
|
37 |
<authors><author><name>Les Green</name><user>lesgreen</user><email>lesgreen@grasshopperpebbles.com</email></author></authors>
|
38 |
-
<date>2014-
|
39 |
-
<time>
|
40 |
-
<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="
|
41 |
<compatible/>
|
42 |
<dependencies><required><php><min>5.2.0</min><max>5.5.7</max></php></required></dependencies>
|
43 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Grasshopperpebbles_Configurablecolors</name>
|
4 |
+
<version>1.0.6</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
|
16 |

|
17 |
+
Version 1.0.6
|
18 |
+
Fixed problems with using extension with 3rd-party templates 
|
19 |
+

|
20 |
Version 1.0.5
|
21 |
Fixed Bug: File mis-named
|
22 |

|
38 |
Compatibility: 1.5, 1.6, 1.6.1, 1.6.2.0, 1.7
|
39 |
</notes>
|
40 |
<authors><author><name>Les Green</name><user>lesgreen</user><email>lesgreen@grasshopperpebbles.com</email></author></authors>
|
41 |
+
<date>2014-05-05</date>
|
42 |
+
<time>15:45:24</time>
|
43 |
+
<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="Catalog"><dir name="Block"><dir name="Product"><dir name="View"><file name="Media.php" hash="c8ecb33955ef6c2048885ba60f0c95e4"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="8672fad39f74623d4e51decd7c4d0f61"/></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="3e75ad3b86a212fc10aff97da73a580b"/><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="15fb6699cc4f2de2d84de5de4b9194dd"/></dir><dir name="template"><dir name="configurablecolors"><dir name="catalog"><dir name="product"><dir name="view"><file name="media.phtml" hash="0ffbb76a4796c9ef44aad35e35d1dbfe"/></dir></dir></dir><file name="settings.phtml" hash="642eb5bc0f698448d65a76e935db6501"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Grasshopperpebbles_Configurablecolors.xml" hash="e76b2f951e1fdffe02974dd6d8bef064"/></dir></target><target name="magemedia"><dir name="grasshopperpebbles_configurablecolors"><file name="white.png" hash="515cb83c2ece7967ff8b82e43ccf080c"/></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="98f1d13b25a7e11dd3cfb1102d592696"/><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="8bdfa6220d86428346b5bd9cd291059d"/></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>
|
44 |
<compatible/>
|
45 |
<dependencies><required><php><min>5.2.0</min><max>5.5.7</max></php></required></dependencies>
|
46 |
</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);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("#
|
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("#attribute"+n.color_attrib_id).parent().parent();e("#"+n.swatch_container).appendTo(e(f));if(n.hide_color_dropdown){e("#attribute"+n.color_attrib_id).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,color_attrib_id:"",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)
|