Version Notes
After installation of the Color Swatches plug-in, please clear the cache.
Download this release
Release Info
Developer | Cybage Software Pvt. Ltd. |
Extension | Cybage_Swatches |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Cybage/Swatches/Block/Adminhtml/Catalog/Product/Attribute/Edit/Form.php +43 -0
- app/code/community/Cybage/Swatches/Block/Adminhtml/Catalog/Product/Attribute/Edit/Tab/Main.php +56 -0
- app/code/community/Cybage/Swatches/Block/Adminhtml/Catalog/Product/Attribute/Edit/Tab/Options.php +98 -0
- app/code/community/Cybage/Swatches/Block/Adminhtml/Catalog/Product/Edit/Tab/Super/Config.php +77 -0
- app/code/community/Cybage/Swatches/Block/Catalog/Product/View/Type/Configurable.php +114 -0
- app/code/community/Cybage/Swatches/Block/Catalog/Product/View/Type/ConfigurableList.php +133 -0
- app/code/community/Cybage/Swatches/Helper/Data.php +95 -0
- app/code/community/Cybage/Swatches/Helper/Product.php +67 -0
- app/code/community/Cybage/Swatches/Model/Attribute.php +27 -0
- app/code/community/Cybage/Swatches/Model/Mysql4/Attribute.php +27 -0
- app/code/community/Cybage/Swatches/Model/Mysql4/Attribute/Collection.php +27 -0
- app/code/community/Cybage/Swatches/Model/Observer.php +144 -0
- app/code/community/Cybage/Swatches/etc/adminhtml.xml +45 -0
- app/code/community/Cybage/Swatches/etc/config.xml +150 -0
- app/code/community/Cybage/Swatches/etc/system.xml +108 -0
- app/code/community/Cybage/Swatches/sql/swatches_setup/mysql4-install-1.0.0.php +33 -0
- app/design/adminhtml/default/default/layout/cybage_swatches.xml +28 -0
- app/design/adminhtml/default/default/template/cybage/catalog/product/edit/super/config.phtml +185 -0
- app/design/adminhtml/default/default/template/cybage/swatches/options.phtml +243 -0
- app/design/frontend/base/default/layout/cybage_swatches.xml +60 -0
- app/design/frontend/base/default/template/cybage/swatches/configurable.phtml +51 -0
- app/etc/modules/Cybage_Swatches.xml +29 -0
- media/swatches/.htaccess +25 -0
- media/swatches/images/.htaccess +25 -0
- media/swatches/products/.htaccess +25 -0
- package.xml +32 -0
- skin/frontend/base/default/js/cybage/swatches/configurable.js +241 -0
- skin/frontend/base/default/js/cybage/swatches/configurableList.js +340 -0
- skin/frontend/base/default/js/cybage/swatches/css/swatches.css +53 -0
app/code/community/Cybage/Swatches/Block/Adminhtml/Catalog/Product/Attribute/Edit/Form.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Cybage_Swatches_Block_Adminhtml_Catalog_Product_Attribute_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* Prepare form before rendering HTML
|
25 |
+
*
|
26 |
+
* @return Mage_Adminhtml_Block_Widget_Form
|
27 |
+
*/
|
28 |
+
protected function _prepareForm()
|
29 |
+
{
|
30 |
+
$form = new Varien_Data_Form(
|
31 |
+
array(
|
32 |
+
'id' => 'edit_form',
|
33 |
+
'action' => $this->getData('action'),
|
34 |
+
'method' => 'post',
|
35 |
+
'enctype' => "multipart/form-data"
|
36 |
+
)
|
37 |
+
);
|
38 |
+
$form->setUseContainer(true);
|
39 |
+
$this->setForm($form);
|
40 |
+
|
41 |
+
return parent::_prepareForm();
|
42 |
+
}
|
43 |
+
}
|
app/code/community/Cybage/Swatches/Block/Adminhtml/Catalog/Product/Attribute/Edit/Tab/Main.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Cybage_Swatches_Block_Adminhtml_Catalog_Product_Attribute_Edit_Tab_Main extends Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Main
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* Preparing default form elements for editing attribute
|
25 |
+
*
|
26 |
+
* @return Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract
|
27 |
+
*/
|
28 |
+
protected function _prepareForm()
|
29 |
+
{
|
30 |
+
parent::_prepareForm();
|
31 |
+
|
32 |
+
if (Mage::registry('entity_attribute')->getIsGlobal() && Mage::registry('entity_attribute')->getIsConfigurable()) {
|
33 |
+
$attributeId = Mage::app()->getRequest()->getParams();
|
34 |
+
/* @var $form Varien_Data_Form */
|
35 |
+
$form = $this->getForm();
|
36 |
+
/* @var $fieldset Varien_Data_Form_Element_Fieldset */
|
37 |
+
$fieldset = $form->addFieldset('swatches_fieldset',
|
38 |
+
array('legend'=>Mage::helper('eav')->__('Swatches Properties'))
|
39 |
+
);
|
40 |
+
|
41 |
+
|
42 |
+
//$fieldset = $form->getElement('base_fieldset');
|
43 |
+
$fieldset->addField(
|
44 |
+
'useSwatches', 'select', array(
|
45 |
+
'name' => 'useSwatches',
|
46 |
+
'label' => $this->__('Use Swatches'),
|
47 |
+
'title' => $this->__('Use Swatches'),
|
48 |
+
'note' => $this->__('Keeping this yes will replace dropdowns to swatches for configurable products'),
|
49 |
+
'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
|
50 |
+
'value' => Mage::helper('swatches')->getUseSwatches($attributeId['attribute_id'])
|
51 |
+
));
|
52 |
+
|
53 |
+
}
|
54 |
+
return $this;
|
55 |
+
}
|
56 |
+
}
|
app/code/community/Cybage/Swatches/Block/Adminhtml/Catalog/Product/Attribute/Edit/Tab/Options.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Cybage_Swatches_Block_Adminhtml_Catalog_Product_Attribute_Edit_Tab_Options extends Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Options
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* Class constructor
|
25 |
+
*
|
26 |
+
*/
|
27 |
+
|
28 |
+
public function __construct()
|
29 |
+
{
|
30 |
+
if (Mage::registry('entity_attribute')->getIsGlobal() && Mage::registry('entity_attribute')->getIsConfigurable()){
|
31 |
+
$this->setTemplate('cybage/swatches/options.phtml');
|
32 |
+
}else{
|
33 |
+
$this->setTemplate('eav/attribute/options.phtml');
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Retrieve attribute option values if attribute input type select or multiselect
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
*/
|
42 |
+
public function getOptionValues()
|
43 |
+
{
|
44 |
+
$attributeType = $this->getAttributeObject()->getFrontendInput();
|
45 |
+
$defaultValues = $this->getAttributeObject()->getDefaultValue();
|
46 |
+
if ($attributeType == 'select' || $attributeType == 'multiselect') {
|
47 |
+
$defaultValues = explode(',', $defaultValues);
|
48 |
+
} else {
|
49 |
+
$defaultValues = array();
|
50 |
+
}
|
51 |
+
|
52 |
+
switch ($attributeType) {
|
53 |
+
case 'select':
|
54 |
+
$inputType = 'radio';
|
55 |
+
break;
|
56 |
+
case 'multiselect':
|
57 |
+
$inputType = 'checkbox';
|
58 |
+
break;
|
59 |
+
default:
|
60 |
+
$inputType = '';
|
61 |
+
break;
|
62 |
+
}
|
63 |
+
|
64 |
+
$values = $this->getData('option_values');
|
65 |
+
if (is_null($values)) {
|
66 |
+
$values = array();
|
67 |
+
$optionCollection = Mage::getResourceModel('eav/entity_attribute_option_collection')
|
68 |
+
->setAttributeFilter($this->getAttributeObject()->getId())
|
69 |
+
->setPositionOrder('desc', true)
|
70 |
+
->load();
|
71 |
+
|
72 |
+
$helper = Mage::helper('core');
|
73 |
+
foreach ($optionCollection as $option) {
|
74 |
+
$value = array();
|
75 |
+
if (in_array($option->getId(), $defaultValues)) {
|
76 |
+
$value['checked'] = 'checked="checked"';
|
77 |
+
} else {
|
78 |
+
$value['checked'] = '';
|
79 |
+
}
|
80 |
+
|
81 |
+
$value['intype'] = $inputType;
|
82 |
+
$value['id'] = $option->getId();
|
83 |
+
$value['sort_order'] = $option->getSortOrder();
|
84 |
+
$value['option_img'] = Mage::helper('swatches')->getUploadedImageUrl($option->getId());
|
85 |
+
|
86 |
+
foreach ($this->getStores() as $store) {
|
87 |
+
$storeValues = $this->getStoreOptionValues($store->getId());
|
88 |
+
$value['store' . $store->getId()] = isset($storeValues[$option->getId()])
|
89 |
+
? $helper->escapeHtml($storeValues[$option->getId()]) : '';
|
90 |
+
}
|
91 |
+
$values[] = new Varien_Object($value);
|
92 |
+
}
|
93 |
+
$this->setData('option_values', $values);
|
94 |
+
}
|
95 |
+
|
96 |
+
return $values;
|
97 |
+
}
|
98 |
+
}
|
app/code/community/Cybage/Swatches/Block/Adminhtml/Catalog/Product/Edit/Tab/Super/Config.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Cybage_Swatches_Block_Adminhtml_Catalog_Product_Edit_Tab_Super_Config extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* Class constructor
|
25 |
+
*
|
26 |
+
*/
|
27 |
+
public function __construct()
|
28 |
+
{
|
29 |
+
parent::__construct();
|
30 |
+
$this->setProductId($this->getRequest()->getParam('id'));
|
31 |
+
$this->setTemplate('cybage/catalog/product/edit/super/config.phtml');
|
32 |
+
$this->setId('config_super_product');
|
33 |
+
$this->setCanEditPrice(true);
|
34 |
+
$this->setCanReadPrice(true);
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Retrieve attributes data in JSON format
|
39 |
+
*
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
public function getAttributesJson()
|
43 |
+
{
|
44 |
+
$attributes = $this->_getProduct()->getTypeInstance(true)
|
45 |
+
->getConfigurableAttributesAsArray($this->_getProduct());
|
46 |
+
|
47 |
+
if(!$attributes) {
|
48 |
+
return '[]';
|
49 |
+
} else {
|
50 |
+
// Hide price if needed
|
51 |
+
foreach ($attributes as &$attribute) {
|
52 |
+
if (isset($attribute['values']) && is_array($attribute['values'])) {
|
53 |
+
foreach ($attribute['values'] as &$attributeValue) {
|
54 |
+
if (!$this->getCanReadPrice()) {
|
55 |
+
$attributeValue['pricing_value'] = '';
|
56 |
+
$attributeValue['is_percent'] = 0;
|
57 |
+
}
|
58 |
+
$attributeValue['can_edit_price'] = $this->getCanEditPrice();
|
59 |
+
$attributeValue['can_read_price'] = $this->getCanReadPrice();
|
60 |
+
$attributeValue['option_id'] = $this->getAttributeOptionId($attribute['attribute_code'],$attributeValue['label']);
|
61 |
+
$optionImg = Mage::helper('swatches')->getProductImageUrl($this->getRequest()->getParam('id'),$attributeValue['option_id']);
|
62 |
+
$attributeValue['option_img'] = $optionImg ? $optionImg : Mage::helper('swatches')->getUploadedImageUrl($attributeValue['option_id']);
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
return Mage::helper('core')->jsonEncode($attributes);
|
69 |
+
}
|
70 |
+
|
71 |
+
public function getAttributeOptionId($attributeCode,$optionValue){
|
72 |
+
$attr = Mage::getModel('catalog/product')->getResource()->getAttribute($attributeCode);
|
73 |
+
if ($attr->usesSource()){
|
74 |
+
return $attr->getSource()->getOptionId($optionValue);
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
app/code/community/Cybage/Swatches/Block/Catalog/Product/View/Type/Configurable.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Cybage_Swatches_Block_Catalog_Product_View_Type_Configurable extends Mage_Catalog_Block_Product_View_Type_Configurable
|
22 |
+
{
|
23 |
+
protected $childProducts;
|
24 |
+
|
25 |
+
protected function _afterToHtml($html) {
|
26 |
+
$attributeIdsWithImages = Mage::registry('swatches_allowed_ids');
|
27 |
+
$confData = array();
|
28 |
+
$html = parent::_afterToHtml($html);
|
29 |
+
if ('product.info.options.configurable' == $this->getNameInLayout() && Mage::getStoreConfig('swatches/default/show_swatches')) {
|
30 |
+
if (!empty($attributeIdsWithImages)) {
|
31 |
+
foreach ($attributeIdsWithImages as $attrIdToHide) {
|
32 |
+
$html = preg_replace('@(id="attribute' . $attrIdToHide . ')(-)?([0-9]*)(")(\s+)(class=")(.*?)(super-attribute-select)(-)?([0-9]*)@', '$1$2$3$4$5$6$7$8$9$10 no-display', $html);
|
33 |
+
}
|
34 |
+
}
|
35 |
+
$simpleProducts = $this->getProduct()->getTypeInstance(true)->getUsedProducts(null, $this->getProduct());
|
36 |
+
|
37 |
+
if ($this->childProducts) {
|
38 |
+
$this->childProducts = array_values($this->childProducts);
|
39 |
+
|
40 |
+
foreach ($simpleProducts as $simple) {
|
41 |
+
$key = array();
|
42 |
+
for ($i = 0; $i < count($this->childProducts); $i++) {
|
43 |
+
foreach ($this->childProducts[$i] as $optionId => $productIds) {
|
44 |
+
if (in_array($simple->getId(), $productIds)) {
|
45 |
+
$key[] = $optionId;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
if ($key) {
|
50 |
+
$strKey = implode(',', $key);
|
51 |
+
|
52 |
+
if ($simple->getImage()) {
|
53 |
+
$imgGallery = Mage::getModel('catalog/product')->load($simple->getId())->getMediaGalleryImages();
|
54 |
+
$i = 0;
|
55 |
+
if ($simple->getImage() == 'no_selection') {
|
56 |
+
$confData[$strKey]['media_url'][$i]['label'] = $simple->getImageLabel();
|
57 |
+
$confData[$strKey]['media_url'][$i]['url'] = $this->getSkinUrl('images/catalog/product/placeholder/image.jpg');
|
58 |
+
$confData[$strKey]['media_url'][$i]['galleryUrl'] = $this->getSkinUrl('images/catalog/product/placeholder/image.jpg');
|
59 |
+
} else {
|
60 |
+
$confData[$strKey]['media_url'][$i]['label'] = $simple->getImageLabel();
|
61 |
+
$confData[$strKey]['media_url'][$i]['url'] = Mage::helper('catalog/output')->productAttribute($simple, Mage::helper('catalog/image')->init($simple, 'image')->resize(265), 'image')->__toString();
|
62 |
+
$confData[$strKey]['media_url'][$i]['galleryUrl'] = Mage::helper('catalog/image')->init($simple, 'image');
|
63 |
+
}
|
64 |
+
|
65 |
+
if(count($imgGallery) > 0) {
|
66 |
+
foreach ($imgGallery as $_image) {
|
67 |
+
++$i;
|
68 |
+
$params = array('id' => $simple->getId(), 'image' => $_image->getValueId());
|
69 |
+
$galleryUrl = $this->getUrl('catalog/product/gallery', $params);
|
70 |
+
$confData[$strKey]['media_url'][$i]['label'] = $_image->getLabel();
|
71 |
+
$confData[$strKey]['media_url'][$i]['url'] = $_image->getUrl();
|
72 |
+
$confData[$strKey]['media_url'][$i]['galleryUrl'] = $galleryUrl;
|
73 |
+
} }
|
74 |
+
else {
|
75 |
+
$confData[$strKey]['media_url'][1]['label'] = '';
|
76 |
+
$confData[$strKey]['media_url'][1]['url'] = '';
|
77 |
+
$confData[$strKey]['media_url'][1]['galleryUrl'] = '';
|
78 |
+
}
|
79 |
+
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
$html .= '<script type="text/javascript"> additionalData = new PDPSwatchesData(' . Zend_Json::encode($confData) . '); </script>';
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
return $html;
|
88 |
+
}
|
89 |
+
|
90 |
+
public function getJsonConfig() {
|
91 |
+
|
92 |
+
$jsonConfig = parent::getJsonConfig();
|
93 |
+
$config = Zend_Json::decode($jsonConfig);
|
94 |
+
$swatchesIds = array();
|
95 |
+
if (Mage::getStoreConfig('swatches/default/show_swatches')) {
|
96 |
+
foreach ($config['attributes'] as $attributeId => $attribute) {
|
97 |
+
$attrSwatches = Mage::getModel('swatches/attribute')->load($attributeId, 'attribute_id');
|
98 |
+
|
99 |
+
if ($attrSwatches->getUseSwatches()) {
|
100 |
+
$config['attributes'][$attributeId]['swatches_size'] = Mage::helper('swatches')->getOptionsImageSizePDP();
|
101 |
+
$config['attributes'][$attributeId]['use_swatches'] = 1;
|
102 |
+
$swatchesIds[] = $attributeId;
|
103 |
+
foreach ($attribute['options'] as $i => $option) {
|
104 |
+
$this->childProducts[$attributeId][$option['id']] = $option['products'];
|
105 |
+
$config['attributes'][$attributeId]['options'][$i]['image'] = Mage::helper('swatches')->getSwatchesBasedOnPriority($option['id'], $this->getProduct()->getEntityId());
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
Mage::unregister('swatches_allowed_ids');
|
110 |
+
Mage::register('swatches_allowed_ids', $swatchesIds, true);
|
111 |
+
}
|
112 |
+
return Zend_Json::encode($config);
|
113 |
+
}
|
114 |
+
}
|
app/code/community/Cybage/Swatches/Block/Catalog/Product/View/Type/ConfigurableList.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Cybage_Swatches_Block_Catalog_Product_View_Type_ConfigurableList extends Mage_Catalog_Block_Product_View_Type_Configurable
|
22 |
+
{
|
23 |
+
protected $_optionProducts;
|
24 |
+
protected $_jsonConfig;
|
25 |
+
|
26 |
+
public function checkConfAttribute()
|
27 |
+
{
|
28 |
+
$configAttributes = $this->getAllowAttributes();
|
29 |
+
$attributeArray = Mage::helper('core')->decorateArray($configAttributes);
|
30 |
+
|
31 |
+
foreach($attributeArray as $attribute)
|
32 |
+
{
|
33 |
+
$attributeInfoArray[] = array('label'=>$attribute->getLabel(),'attribute_id'=>$attribute->getAttributeId(),'decoratedIsLast'=>$attribute->decoratedIsLast);
|
34 |
+
}
|
35 |
+
|
36 |
+
return $attributeInfoArray;
|
37 |
+
}
|
38 |
+
|
39 |
+
protected function _afterToHtml($html)
|
40 |
+
{
|
41 |
+
|
42 |
+
$imageSize = Mage::helper('swatches')->getthumbImageSize();
|
43 |
+
$html = parent::_afterToHtml($html);
|
44 |
+
if ('product.info.options.configurable' == $this->getNameInLayout())
|
45 |
+
{
|
46 |
+
$html = str_replace('super-attribute-select', 'no-display super-attribute-select', $html);
|
47 |
+
|
48 |
+
$simpleProducts = $this->getProduct()->getTypeInstance(true)->getUsedProducts(null, $this->getProduct());
|
49 |
+
if ($this->_optionProducts)
|
50 |
+
{
|
51 |
+
$this->_optionProducts = array_values($this->_optionProducts);
|
52 |
+
foreach ($simpleProducts as $simple)
|
53 |
+
{
|
54 |
+
$key = array();
|
55 |
+
for ($i = 0; $i < count($this->_optionProducts); $i++)
|
56 |
+
{
|
57 |
+
foreach ($this->_optionProducts[$i] as $optionId => $productIds)
|
58 |
+
{
|
59 |
+
if (in_array($simple->getId(), $productIds))
|
60 |
+
{
|
61 |
+
$key[] = $optionId;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
if ($key)
|
67 |
+
{
|
68 |
+
$strKey = implode(',', $key);
|
69 |
+
$confData[$strKey] = array();
|
70 |
+
|
71 |
+
$confData[$strKey]['parent_image'] =(string)($this->helper('catalog/image')->init($this->getProduct(), 'small_image')->resize($imageSize));
|
72 |
+
$confData[$strKey]['small_image'] = (string)($this->helper('catalog/image')->init($simple, 'small_image')->resize($imageSize));
|
73 |
+
}
|
74 |
+
}
|
75 |
+
$html .= '<script type="text/javascript">
|
76 |
+
confData['.$this->getProduct()->getEntityId().'] = new swatchesListingData(' . Zend_Json::encode($confData) . ');
|
77 |
+
</script>';
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
return $html;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getJsonConfig()
|
85 |
+
{
|
86 |
+
$jsonConfig = parent::getJsonConfig();
|
87 |
+
$config = Zend_Json::decode($jsonConfig);
|
88 |
+
|
89 |
+
if (Mage::helper('swatches')->getOptionsImageSize()){
|
90 |
+
$config['size'] = Mage::helper('swatches')->getOptionsImageSize();
|
91 |
+
}
|
92 |
+
foreach ($config['attributes'] as $attributeId => $attribute)
|
93 |
+
{
|
94 |
+
$attr = Mage::getModel('swatches/attribute')->load($attributeId, 'attribute_id');
|
95 |
+
if($attr->getUseSwatches()){
|
96 |
+
foreach ($attribute['options'] as $i => $option)
|
97 |
+
{
|
98 |
+
$this->_optionProducts[$attributeId][$option['id']] = $option['products'];
|
99 |
+
$config['attributes'][$attributeId]['use_swatches'] = 1;
|
100 |
+
$config['attributes'][$attributeId]['options'][$i]['image'] = Mage::helper('swatches')->getSwatchesBasedOnPriority($option['id'],$this->getProduct()->getEntityId());
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
$this->_jsonConfig = $config;
|
105 |
+
return Zend_Json::encode($config);
|
106 |
+
}
|
107 |
+
|
108 |
+
public function getPriceForConfig()
|
109 |
+
{
|
110 |
+
$config = array();
|
111 |
+
$product = $this->product;
|
112 |
+
$regularPrice = $product->getPrice();
|
113 |
+
$finalPrice = $product->getFinalPrice();
|
114 |
+
$tierPrices = array();
|
115 |
+
|
116 |
+
foreach ($product->getTierPrice() as $tierPrice) {
|
117 |
+
$tierPrices[] = Mage::helper('core')->currency($tierPrice['website_price'], false, false);
|
118 |
+
}
|
119 |
+
|
120 |
+
$config = array(
|
121 |
+
'productId' => $product->getId(),
|
122 |
+
'priceFormat' => Mage::app()->getLocale()->getJsPriceFormat(),
|
123 |
+
'productPrice' => Mage::helper('core')->currency($finalPrice, false, false),
|
124 |
+
'productOldPrice' => Mage::helper('core')->currency($regularPrice, false, false),
|
125 |
+
'plusDisposition' => 0,
|
126 |
+
'minusDisposition' => 0,
|
127 |
+
'tierPrices' => $tierPrices,
|
128 |
+
);
|
129 |
+
|
130 |
+
|
131 |
+
return Mage::helper('core')->jsonEncode($config);
|
132 |
+
}
|
133 |
+
}
|
app/code/community/Cybage/Swatches/Helper/Data.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Cybage_Swatches_Helper_Data extends Mage_Core_Helper_Abstract
|
22 |
+
{
|
23 |
+
public function getUploadedImageUrl($attrValue)
|
24 |
+
{
|
25 |
+
$uploadDir = Mage::getBaseDir('media') . DIRECTORY_SEPARATOR .
|
26 |
+
'swatches' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR;
|
27 |
+
|
28 |
+
if (file_exists($uploadDir . $attrValue . '.jpg'))
|
29 |
+
{
|
30 |
+
return Mage::getBaseUrl('media') . 'swatches' . '/' . 'images' . '/' . $attrValue . '.jpg';
|
31 |
+
}
|
32 |
+
return '';
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getSwatchesBlock($_product, $html)
|
36 |
+
{
|
37 |
+
$block = Mage::app()->getLayout()->createBlock(
|
38 |
+
'Cybage_Swatches_Block_Catalog_Product_View_Type_ConfigurableList',
|
39 |
+
'swatches_catalog_product_view_type_configurable_list',
|
40 |
+
array('template' => 'cybage/swatches/configurable.phtml')
|
41 |
+
);
|
42 |
+
$block->setProduct($_product);
|
43 |
+
$block->setNameInLayout('product.info.options.configurable');
|
44 |
+
|
45 |
+
$html .= '<div id="swatches-block">' . $block->toHtml() . '</div>';
|
46 |
+
|
47 |
+
return $html;
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getthumbImageSize()
|
51 |
+
{
|
52 |
+
return Mage::getStoreConfig('swatches/list/thumb_img_size_list');
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getOptionsImageSize()
|
56 |
+
{
|
57 |
+
return Mage::getStoreConfig('swatches/list/img_size_list');
|
58 |
+
}
|
59 |
+
|
60 |
+
public function getOptionsImageSizePDP()
|
61 |
+
{
|
62 |
+
return Mage::getStoreConfig('swatches/pdp/img_size_pdp');
|
63 |
+
}
|
64 |
+
|
65 |
+
public function getUseSwatches($attributeId)
|
66 |
+
{
|
67 |
+
$confAttr = Mage::getModel('swatches/attribute')->load($attributeId, 'attribute_id');
|
68 |
+
return array($confAttr->getUseSwatches());
|
69 |
+
}
|
70 |
+
|
71 |
+
public function getProductImageUrl($productId,$optionId)
|
72 |
+
{
|
73 |
+
$attrValue = $productId."-".$optionId;
|
74 |
+
|
75 |
+
$uploadDir = Mage::getBaseDir('media') . DIRECTORY_SEPARATOR .
|
76 |
+
'swatches' . DIRECTORY_SEPARATOR . 'products' . DIRECTORY_SEPARATOR;
|
77 |
+
|
78 |
+
if (file_exists($uploadDir . $attrValue . '.jpg'))
|
79 |
+
{
|
80 |
+
return Mage::getBaseUrl('media') . 'swatches' . '/' . 'products' . '/' . $attrValue . '.jpg';
|
81 |
+
}
|
82 |
+
return '';
|
83 |
+
}
|
84 |
+
|
85 |
+
public function getSwatchesBasedOnPriority($attrValue,$productId)
|
86 |
+
{
|
87 |
+
$productLevelSwatches = $this->getProductImageUrl($productId,$attrValue);
|
88 |
+
|
89 |
+
if(!empty($productLevelSwatches)){
|
90 |
+
return $productLevelSwatches;
|
91 |
+
}else{
|
92 |
+
return $this->getUploadedImageUrl($attrValue);
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
app/code/community/Cybage/Swatches/Helper/Product.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Cybage_Swatches_Helper_Product extends Mage_Catalog_Helper_Product
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* Added a condition which will return true if products
|
25 |
+
* is child of configurable product.
|
26 |
+
* Check if a product can be shown
|
27 |
+
*
|
28 |
+
* @param Mage_Catalog_Model_Product|int $product
|
29 |
+
* @return boolean
|
30 |
+
*/
|
31 |
+
public function canShow($product, $where = 'catalog')
|
32 |
+
{
|
33 |
+
if (is_int($product)) {
|
34 |
+
$product = Mage::getModel('catalog/product')->load($product);
|
35 |
+
}
|
36 |
+
|
37 |
+
/* @var $product Mage_Catalog_Model_Product */
|
38 |
+
|
39 |
+
if (!$product->getId()) {
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
|
43 |
+
if(!$product->isVisibleInCatalog() || !$product->isVisibleInSiteVisibility()){
|
44 |
+
$productType = $this->getProductInfo($product->getId());
|
45 |
+
if($productType == "configurable"){
|
46 |
+
return true;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();
|
50 |
+
}
|
51 |
+
|
52 |
+
/*
|
53 |
+
Get Parent id for give child
|
54 |
+
returns : product type
|
55 |
+
*/
|
56 |
+
public function getProductInfo($id) {
|
57 |
+
$parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($id);
|
58 |
+
|
59 |
+
$parentProductInfo = Mage::getModel("catalog/product")->load($parentIds[0]);
|
60 |
+
if(!empty($parentIds)){
|
61 |
+
return $parentProductInfo->getTypeId();
|
62 |
+
}else{
|
63 |
+
return "";
|
64 |
+
}
|
65 |
+
|
66 |
+
}
|
67 |
+
}
|
app/code/community/Cybage/Swatches/Model/Attribute.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Cybage_Swatches_Model_Attribute extends Mage_Core_Model_Abstract
|
22 |
+
{
|
23 |
+
protected function _construct()
|
24 |
+
{
|
25 |
+
$this->_init('swatches/attribute');
|
26 |
+
}
|
27 |
+
}
|
app/code/community/Cybage/Swatches/Model/Mysql4/Attribute.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Cybage_Swatches_Model_Mysql4_Attribute extends Mage_Core_Model_Mysql4_Abstract
|
22 |
+
{
|
23 |
+
protected function _construct()
|
24 |
+
{
|
25 |
+
$this->_init('swatches/attribute', 'entity_id');
|
26 |
+
}
|
27 |
+
}
|
app/code/community/Cybage/Swatches/Model/Mysql4/Attribute/Collection.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Cybage_Swatches_Model_Mysql4_Attribute_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
22 |
+
{
|
23 |
+
protected function _construct()
|
24 |
+
{
|
25 |
+
$this->_init('swatches/attribute');
|
26 |
+
}
|
27 |
+
}
|
app/code/community/Cybage/Swatches/Model/Observer.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Cybage_Swatches_Model_Observer
|
22 |
+
{
|
23 |
+
public function saveAttributesAfter($observer){
|
24 |
+
|
25 |
+
$data = $observer->getControllerAction()->getRequest()->getPost();
|
26 |
+
|
27 |
+
if($data['is_configurable'] && $data['is_global']){
|
28 |
+
|
29 |
+
$baseDir = Mage::getBaseDir('media') . DIRECTORY_SEPARATOR .
|
30 |
+
'swatches' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR;
|
31 |
+
|
32 |
+
if (isset($_FILES['swatches_img']) && isset($_FILES['swatches_img']['error']))
|
33 |
+
{
|
34 |
+
foreach($_FILES['swatches_img']['error'] as $optionId => $errorCode)
|
35 |
+
{
|
36 |
+
if ($errorCode == UPLOAD_ERR_OK)
|
37 |
+
{
|
38 |
+
if (strpos($optionId, 'option') === false) {
|
39 |
+
move_uploaded_file($_FILES['swatches_img']['tmp_name'][$optionId], $baseDir . $optionId . '.jpg');
|
40 |
+
} else {
|
41 |
+
$newOptionId = Mage::getResourceHelper('importexport')->getNextAutoincrement(Mage::getSingleton ( 'core/resource' )->getTableName('eav/attribute_option'))-1;
|
42 |
+
move_uploaded_file($_FILES['swatches_img']['tmp_name'][$optionId], $baseDir . $newOptionId . '.jpg');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
if(Mage::app()->getRequest()->isPost('useSwatches'))
|
49 |
+
{
|
50 |
+
$confAttr = Mage::getModel('swatches/attribute')->load($data['attribute_id'], 'attribute_id');
|
51 |
+
if (!$confAttr->getId())
|
52 |
+
{
|
53 |
+
$confAttr->setAttributeId($data['attribute_id']);
|
54 |
+
}
|
55 |
+
$confAttr->setUseSwatches(intval(Mage::app()->getRequest()->getPost('useSwatches')));
|
56 |
+
$confAttr->save();
|
57 |
+
}
|
58 |
+
|
59 |
+
// $deleteArr = $data['swatches_img_delete'];
|
60 |
+
if(isset($data['swatches_img_delete']) && !empty( $data['swatches_img_delete']))
|
61 |
+
{
|
62 |
+
foreach( $data['swatches_img_delete'] as $optionId => $value)
|
63 |
+
{
|
64 |
+
if ($value)
|
65 |
+
{
|
66 |
+
unlink($baseDir . $optionId . '.jpg');
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
public function onListBlockHtmlBefore($observer)
|
74 |
+
{
|
75 |
+
$block = $observer->getBlock();
|
76 |
+
$transport = $observer->getTransport();
|
77 |
+
$html = $transport->getHtml();
|
78 |
+
//$thisClass = get_class($block);
|
79 |
+
|
80 |
+
if (($block instanceof Mage_Catalog_Block_Product_List) && Mage::getStoreConfig('swatches/list/swatches_on_list')) {
|
81 |
+
|
82 |
+
$collection = null;
|
83 |
+
if($productListlock = Mage::app()->getLayout()->getBlock('product_list')){
|
84 |
+
// First make a copy, otherwise the rest of the page might be affected!
|
85 |
+
$collection = clone $productListlock->getLoadedProductCollection();
|
86 |
+
}
|
87 |
+
elseif($productSearchlock = Mage::app()->getLayout()->getBlock('search_result_list')){
|
88 |
+
$collection = $productSearchlock->getLoadedProductCollection();
|
89 |
+
}
|
90 |
+
|
91 |
+
foreach ($collection->getItems() as $item) {
|
92 |
+
$productsIdList[] = $item->getEntityId();
|
93 |
+
}
|
94 |
+
|
95 |
+
foreach($productsIdList as $value => $productId){
|
96 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
97 |
+
|
98 |
+
if($product->isSaleable() && $product->isConfigurable()){
|
99 |
+
$template = '@(product-price-'.$productId.'">(.*?)div>)@s';
|
100 |
+
preg_match_all($template, $html, $res);
|
101 |
+
if($res[0]){
|
102 |
+
$replace = Mage::helper('swatches')->getSwatchesBlock($product, $res[1][0]);
|
103 |
+
if(strpos($html, $replace) === false) {
|
104 |
+
$html= str_replace($res[0][0], $replace, $html);
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
$transport->setHtml($html);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
public function saveCatalogProductAfter($observer){
|
114 |
+
|
115 |
+
$deleteArr = Mage::app()->getRequest()->getPost('swatches_img_delete');
|
116 |
+
|
117 |
+
$productId = $observer->getProduct()->getData('entity_id');
|
118 |
+
|
119 |
+
$baseDir = Mage::getBaseDir('media') . DIRECTORY_SEPARATOR .
|
120 |
+
'swatches' . DIRECTORY_SEPARATOR . 'products' . DIRECTORY_SEPARATOR;
|
121 |
+
|
122 |
+
if (isset($_FILES['swatches_img']) && isset($_FILES['swatches_img']['error']))
|
123 |
+
{
|
124 |
+
foreach($_FILES['swatches_img']['error'] as $optionId => $errorCode)
|
125 |
+
{
|
126 |
+
if ($errorCode == UPLOAD_ERR_OK)
|
127 |
+
{
|
128 |
+
move_uploaded_file($_FILES['swatches_img']['tmp_name'][$optionId], $baseDir . $productId.'-'.$optionId . '.jpg');
|
129 |
+
}
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
if(!empty($deleteArr))
|
134 |
+
{
|
135 |
+
foreach($deleteArr as $optionId => $value)
|
136 |
+
{
|
137 |
+
if ($value)
|
138 |
+
{
|
139 |
+
unlink($baseDir . $productId.'-'.$optionId . '.jpg');
|
140 |
+
}
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
app/code/community/Cybage/Swatches/etc/adminhtml.xml
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Cybage Color Swatches Plugin
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available on the World Wide Web at:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
12 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
13 |
+
*
|
14 |
+
* @category Color Swatches Plugin
|
15 |
+
* @package Cybage_Swatches
|
16 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
17 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<config>
|
23 |
+
<acl>
|
24 |
+
<resources>
|
25 |
+
<all>
|
26 |
+
<title>Allow Everything</title>
|
27 |
+
</all>
|
28 |
+
<admin>
|
29 |
+
<children>
|
30 |
+
<system>
|
31 |
+
<children>
|
32 |
+
<config>
|
33 |
+
<children>
|
34 |
+
<swatches translate="title">
|
35 |
+
<title>Configurable Products Swatches</title>
|
36 |
+
</swatches>
|
37 |
+
</children>
|
38 |
+
</config>
|
39 |
+
</children>
|
40 |
+
</system>
|
41 |
+
</children>
|
42 |
+
</admin>
|
43 |
+
</resources>
|
44 |
+
</acl>
|
45 |
+
</config>
|
app/code/community/Cybage/Swatches/etc/config.xml
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Cybage Color Swatches Plugin
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available on the World Wide Web at:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
12 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
13 |
+
*
|
14 |
+
* @category Color Swatches Plugin
|
15 |
+
* @package Cybage_Swatches
|
16 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
17 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<config>
|
23 |
+
<modules>
|
24 |
+
<Cybage_Swatches>
|
25 |
+
<version>1.0.0</version>
|
26 |
+
</Cybage_Swatches>
|
27 |
+
</modules>
|
28 |
+
<frontend>
|
29 |
+
<routers>
|
30 |
+
<swatches>
|
31 |
+
<use>standard</use>
|
32 |
+
<args>
|
33 |
+
<module>Cybage_Swatches</module>
|
34 |
+
<frontName>swatches</frontName>
|
35 |
+
</args>
|
36 |
+
</swatches>
|
37 |
+
</routers>
|
38 |
+
<layout>
|
39 |
+
<updates>
|
40 |
+
<swatches>
|
41 |
+
<file>cybage_swatches.xml</file>
|
42 |
+
</swatches>
|
43 |
+
</updates>
|
44 |
+
</layout>
|
45 |
+
</frontend>
|
46 |
+
<adminhtml>
|
47 |
+
<layout>
|
48 |
+
<updates>
|
49 |
+
<swatches>
|
50 |
+
<file>cybage_swatches.xml</file>
|
51 |
+
</swatches>
|
52 |
+
</updates>
|
53 |
+
</layout>
|
54 |
+
</adminhtml>
|
55 |
+
<global>
|
56 |
+
<blocks>
|
57 |
+
<swatches>
|
58 |
+
<class>Cybage_Swatches_Block</class>
|
59 |
+
</swatches>
|
60 |
+
<!--<adminhtml>
|
61 |
+
<rewrite>
|
62 |
+
<catalog_product_attribute_edit_tabs>Cybage_Swatches_Block_Adminhtml_Catalog_Product_Attribute_Edit_Tabs</catalog_product_attribute_edit_tabs>
|
63 |
+
</rewrite>
|
64 |
+
</adminhtml>-->
|
65 |
+
<adminhtml>
|
66 |
+
<rewrite>
|
67 |
+
<catalog_product_attribute_edit_tab_main>Cybage_Swatches_Block_Adminhtml_Catalog_Product_Attribute_Edit_Tab_Main</catalog_product_attribute_edit_tab_main>
|
68 |
+
<catalog_product_attribute_edit_tab_options>Cybage_Swatches_Block_Adminhtml_Catalog_Product_Attribute_Edit_Tab_Options</catalog_product_attribute_edit_tab_options>
|
69 |
+
<catalog_product_attribute_edit_form>Cybage_Swatches_Block_Adminhtml_Catalog_Product_Attribute_Edit_Form</catalog_product_attribute_edit_form>
|
70 |
+
<catalog_product_edit_tab_super_config_grid_renderer_checkbox>Cybage_Swatches_Block_Adminhtml_Catalog_Product_Attribute_Edit_Tab_Super_Config_Grid_Renderer</catalog_product_edit_tab_super_config_grid_renderer_checkbox>
|
71 |
+
</rewrite>
|
72 |
+
</adminhtml>
|
73 |
+
<catalog>
|
74 |
+
<rewrite>
|
75 |
+
<product_view_type_configurable>Cybage_Swatches_Block_Catalog_Product_View_Type_Configurable</product_view_type_configurable>
|
76 |
+
</rewrite>
|
77 |
+
</catalog>
|
78 |
+
</blocks>
|
79 |
+
<helpers>
|
80 |
+
<swatches>
|
81 |
+
<class>Cybage_Swatches_Helper</class>
|
82 |
+
</swatches>
|
83 |
+
<catalog>
|
84 |
+
<rewrite>
|
85 |
+
<product>Cybage_Swatches_Helper_Product</product>
|
86 |
+
</rewrite>
|
87 |
+
</catalog>
|
88 |
+
</helpers>
|
89 |
+
<models>
|
90 |
+
<swatches>
|
91 |
+
<class>Cybage_Swatches_Model</class>
|
92 |
+
<resourceModel>swatches_mysql4</resourceModel>
|
93 |
+
</swatches>
|
94 |
+
<swatches_mysql4>
|
95 |
+
<class>Cybage_Swatches_Model_Mysql4</class>
|
96 |
+
<entities>
|
97 |
+
<attribute>
|
98 |
+
<table>cybage_swatches_attribute</table>
|
99 |
+
</attribute>
|
100 |
+
</entities>
|
101 |
+
</swatches_mysql4>
|
102 |
+
</models>
|
103 |
+
|
104 |
+
<resources>
|
105 |
+
<swatches_read>
|
106 |
+
<connection><use>core_read</use></connection>
|
107 |
+
</swatches_read>
|
108 |
+
<swatches_write>
|
109 |
+
<connection><use>core_write</use></connection>
|
110 |
+
</swatches_write>
|
111 |
+
<swatches_setup>
|
112 |
+
<setup>
|
113 |
+
<module>Cybage_Swatches</module>
|
114 |
+
</setup>
|
115 |
+
<connection>
|
116 |
+
<use>core_setup</use>
|
117 |
+
</connection>
|
118 |
+
</swatches_setup>
|
119 |
+
</resources>
|
120 |
+
<events>
|
121 |
+
<controller_action_postdispatch_adminhtml_catalog_product_attribute_save>
|
122 |
+
<observers>
|
123 |
+
<swatches_save_observer>
|
124 |
+
<type>singleton</type>
|
125 |
+
<class>swatches/observer</class>
|
126 |
+
<method>saveAttributesAfter</method>
|
127 |
+
</swatches_save_observer>
|
128 |
+
</observers>
|
129 |
+
</controller_action_postdispatch_adminhtml_catalog_product_attribute_save>
|
130 |
+
<catalog_product_save_before>
|
131 |
+
<observers>
|
132 |
+
<swatches_on_product_save>
|
133 |
+
<type>singleton</type>
|
134 |
+
<class>swatches/observer</class>
|
135 |
+
<method>saveCatalogProductAfter</method>
|
136 |
+
</swatches_on_product_save>
|
137 |
+
</observers>
|
138 |
+
</catalog_product_save_before>
|
139 |
+
<core_block_abstract_to_html_after>
|
140 |
+
<observers>
|
141 |
+
<swatches_onlist>
|
142 |
+
<type>singleton</type>
|
143 |
+
<class>swatches/observer</class>
|
144 |
+
<method>onListBlockHtmlBefore</method>
|
145 |
+
</swatches_onlist>
|
146 |
+
</observers>
|
147 |
+
</core_block_abstract_to_html_after>
|
148 |
+
</events>
|
149 |
+
</global>
|
150 |
+
</config>
|
app/code/community/Cybage/Swatches/etc/system.xml
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Cybage Color Swatches Plugin
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available on the World Wide Web at:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
12 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
13 |
+
*
|
14 |
+
* @category Color Swatches Plugin
|
15 |
+
* @package Cybage_Swatches
|
16 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
17 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<config>
|
23 |
+
<tabs>
|
24 |
+
<cybage translate="label">
|
25 |
+
<label>Cybage</label>
|
26 |
+
<sort_order>100</sort_order>
|
27 |
+
</cybage>
|
28 |
+
</tabs>
|
29 |
+
<sections>
|
30 |
+
<swatches translate="label">
|
31 |
+
<label>Configurable Products Swatches</label>
|
32 |
+
<tab>cybage</tab>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<sort_order>10</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
<groups>
|
39 |
+
<default translate="label">
|
40 |
+
<label>General Settings</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>10</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
<fields>
|
47 |
+
<show_swatches translate="label">
|
48 |
+
<label>Replace Drop-Downs with Swatches</label>
|
49 |
+
<frontend_type>select</frontend_type>
|
50 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
51 |
+
<sort_order>20</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>1</show_in_store>
|
55 |
+
</show_swatches>
|
56 |
+
</fields>
|
57 |
+
</default>
|
58 |
+
<list>
|
59 |
+
<label>Category List Page Settings</label>
|
60 |
+
<frontend_type>text</frontend_type>
|
61 |
+
<sort_order>20</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>1</show_in_store>
|
65 |
+
<fields>
|
66 |
+
<swatches_on_list translate="label">
|
67 |
+
<label>Display Color Swatches on Product List Pages</label>
|
68 |
+
<frontend_type>select</frontend_type>
|
69 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
70 |
+
<sort_order>10</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
</swatches_on_list>
|
75 |
+
<img_size_list translate="label comment">
|
76 |
+
<label>Image Size of swatches on Product List in px</label>
|
77 |
+
<comment>Images will get resized to the given size on product list page.</comment>
|
78 |
+
<frontend_type>text</frontend_type>
|
79 |
+
<sort_order>20</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>1</show_in_website>
|
82 |
+
<show_in_store>1</show_in_store>
|
83 |
+
</img_size_list>
|
84 |
+
</fields>
|
85 |
+
</list>
|
86 |
+
<pdp>
|
87 |
+
<label>Product Details Page Settings</label>
|
88 |
+
<frontend_type>text</frontend_type>
|
89 |
+
<sort_order>30</sort_order>
|
90 |
+
<show_in_default>1</show_in_default>
|
91 |
+
<show_in_website>1</show_in_website>
|
92 |
+
<show_in_store>1</show_in_store>
|
93 |
+
<fields>
|
94 |
+
<img_size_pdp translate="label comment">
|
95 |
+
<label>Image Size of swatches on Product Details page in px</label>
|
96 |
+
<comment>Images will get resized to the given size on product details page.</comment>
|
97 |
+
<frontend_type>text</frontend_type>
|
98 |
+
<sort_order>10</sort_order>
|
99 |
+
<show_in_default>1</show_in_default>
|
100 |
+
<show_in_website>1</show_in_website>
|
101 |
+
<show_in_store>1</show_in_store>
|
102 |
+
</img_size_pdp>
|
103 |
+
</fields>
|
104 |
+
</pdp>
|
105 |
+
</groups>
|
106 |
+
</swatches>
|
107 |
+
</sections>
|
108 |
+
</config>
|
app/code/community/Cybage/Swatches/sql/swatches_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
$installer = $this;
|
22 |
+
$installer->startSetup();
|
23 |
+
|
24 |
+
$installer->run("CREATE TABLE IF NOT EXISTS `{$this->getTable('swatches/attribute')}` (
|
25 |
+
`entity_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
26 |
+
`attribute_id` int(11) unsigned NOT NULL,
|
27 |
+
`use_swatches` tinyint(1) unsigned NOT NULL,
|
28 |
+
PRIMARY KEY (`entity_id`),
|
29 |
+
UNIQUE KEY `attribute_id` (`attribute_id`)
|
30 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
|
31 |
+
");
|
32 |
+
|
33 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/cybage_swatches.xml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Cybage Color Swatches Plugin
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available on the World Wide Web at:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
12 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
13 |
+
*
|
14 |
+
* @category Color Swatches Plugin
|
15 |
+
* @package Cybage_Swatches
|
16 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
17 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<layout>
|
23 |
+
<adminhtml_catalog_product_configurable>
|
24 |
+
<reference name="product_tabs">
|
25 |
+
<action method="addTab"><name>configurable</name><block>swatches/adminhtml_catalog_product_edit_tab_super_config</block></action>
|
26 |
+
</reference>
|
27 |
+
</adminhtml_catalog_product_configurable>
|
28 |
+
</layout>
|
app/design/adminhtml/default/default/template/cybage/catalog/product/edit/super/config.phtml
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
?>
|
21 |
+
<?php if (!$this->isReadonly()):?>
|
22 |
+
<div class="entry-edit">
|
23 |
+
<div id="assign_product_warrning" style="display: none;">
|
24 |
+
<ul class="messages">
|
25 |
+
<li class="error-msg">
|
26 |
+
<ul>
|
27 |
+
<li><?php echo $this->__('Links with associated products will retain only after saving current product.') ?></li>
|
28 |
+
</ul>
|
29 |
+
</li>
|
30 |
+
</ul>
|
31 |
+
</div>
|
32 |
+
<div class="entry-edit-head">
|
33 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('catalog')->__('Create Simple Associated Product') ?></h4>
|
34 |
+
</div>
|
35 |
+
<fieldset class="a-right">
|
36 |
+
<?php echo $this->getChildHtml('create_empty') ?> <?php echo $this->getChildHtml('create_from_configurable') ?>
|
37 |
+
</fieldset>
|
38 |
+
</div>
|
39 |
+
|
40 |
+
<div id="<?php echo $this->getHtmlId() ?>_simple_form" class="ignore-validate configurable-simple-product">
|
41 |
+
<?php echo $this->getChildHtml('simple'); ?>
|
42 |
+
</div>
|
43 |
+
<?php endif;?>
|
44 |
+
<div class="entry-edit">
|
45 |
+
<div class="entry-edit-head">
|
46 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('catalog')->__('Super product attributes configuration') ?></h4>
|
47 |
+
</div>
|
48 |
+
<fieldset id="<?php echo $this->getHtmlId() ?>">
|
49 |
+
<legend><?php echo Mage::helper('catalog')->__('Super product attributes configuration') ?></legend>
|
50 |
+
<input type="hidden" id="<?php echo $this->getHtmlId() ?>_save_links" name="configurable_products_data" value=""/>
|
51 |
+
<input type="hidden" id="<?php echo $this->getHtmlId() ?>_save_attributes" name="configurable_attributes_data" />
|
52 |
+
|
53 |
+
<ul class="messages">
|
54 |
+
<li class="notice-msg">
|
55 |
+
<ul><li><?php echo Mage::helper('catalog')->__('Price values for options should be specified in system base currency.')?></li></ul>
|
56 |
+
<ul><li><?php echo Mage::helper('catalog')->__('Attribute names can be specified per store.')?></li></ul>
|
57 |
+
</li>
|
58 |
+
</ul>
|
59 |
+
<ul id="<?php echo $this->getHtmlId() ?>_attributes" class="super-attributes">
|
60 |
+
</ul>
|
61 |
+
</fieldset>
|
62 |
+
</div>
|
63 |
+
<div class="no-display" id="<?php echo $this->getHtmlId() ?>_attribute_template">
|
64 |
+
<div class="<?php if (!$this->isReadonly()):?>attribute-name-container <?php endif;?>left">
|
65 |
+
'{{frontend_label}}'
|
66 |
+
</div>
|
67 |
+
<div class="values-container right">
|
68 |
+
<label for="__id___label" class="bold"><?php echo Mage::helper('catalog')->__('Attribute Name:') ?></label>
|
69 |
+
<input id="__id___label" type="text" <?php if ($this->isAttributesConfigurationReadonly()): ?> disabled="disabled" <?php endif;?> class="input-text attribute-label required-entry template no-display" value="'{{label}}'" readonly="label" />
|
70 |
+
<input id="__id___label_use_default" type="checkbox" value="1" " checked="use_default" class="attribute-use-default-label">
|
71 |
+
<label for="__id___label_use_default"><?php echo Mage::helper('catalog')->__('Use default')?> ('{{store_label}}')</label>
|
72 |
+
<ul class="attribute-values">
|
73 |
+
</ul>
|
74 |
+
</div>
|
75 |
+
</div>
|
76 |
+
<div class="no-display" id="<?php echo $this->getHtmlId() ?>_value_template">
|
77 |
+
<div class="attribute-value-label-container left">
|
78 |
+
<?php echo Mage::helper('catalog')->__('Option:') ?> <strong>'{{label}}'</strong>
|
79 |
+
</div>
|
80 |
+
<?php if ($this->getCanReadPrice() !== false) : ?>
|
81 |
+
<div class="attribute-values-container-main">
|
82 |
+
<div class="attribute-values-container left">
|
83 |
+
<?php echo Mage::helper('catalog')->__('Price:') ?>
|
84 |
+
<input id="__id___pricing" type="text" <?php if ($this->isAttributesPricesReadonly() || $this->getCanEditPrice() === false): ?> disabled="disabled" <?php endif;?> class="input-text attribute-price validate-number template no-display" value="'{{pricing_value}}'"/>
|
85 |
+
</div>
|
86 |
+
<div class="attribute-values-container left">
|
87 |
+
<select class="attribute-price-type" id="__id___price_type" <?php if ($this->isAttributesPricesReadonly() || $this->getCanEditPrice() === false): ?> disabled="disabled" <?php endif;?>>
|
88 |
+
<option value="0"><?php echo Mage::helper('catalog')->__('Fixed') ?></option>
|
89 |
+
<option value="1"><?php echo Mage::helper('catalog')->__('Percentage') ?></option>
|
90 |
+
</select>
|
91 |
+
</div>
|
92 |
+
<div class="attribute-values-container left">
|
93 |
+
<table width="320px">
|
94 |
+
<tr>
|
95 |
+
<td align="center">
|
96 |
+
<input type="file" name="swatches_img['{{option_id}}']" id="file-'{{option_id}}'" style="width:200px" onchange="check_extension(this.value,this.id);">
|
97 |
+
</td>
|
98 |
+
<td align="center" width="50px">
|
99 |
+
<img src="'{{option_img}}'" alt="" width="18" height="18">
|
100 |
+
</td>
|
101 |
+
<td align="center" width="151px">
|
102 |
+
<input type="checkbox" name="swatches_img_delete['{{option_id}}']" value="1" title="Remove Swatches"> Click box for removing image.
|
103 |
+
</td>
|
104 |
+
</tr>
|
105 |
+
</table>
|
106 |
+
</div>
|
107 |
+
<?php if ($this->getShowUseDefaultPrice()):?>
|
108 |
+
<div class="attribute-values-container">
|
109 |
+
<input id="__id___default" type="checkbox" <?php if ($this->isAttributesPricesReadonly() || $this->getCanEditPrice() === false): ?> disabled="disabled" <?php endif;?> class="attribute-use-default-value"> <label for="__id___default" class="normal"><?php echo Mage::helper('catalog')->__('Use Default Value') ?></label>
|
110 |
+
</div>
|
111 |
+
<?php endif;?>
|
112 |
+
<?php else : ?>
|
113 |
+
<div class="attribute-values-container-main">
|
114 |
+
<div class="attribute-values-container left">
|
115 |
+
<input id="__id___pricing" type="hidden" class="attribute-price template no-display" value="0" />
|
116 |
+
</div>
|
117 |
+
<div class="attribute-values-container left">
|
118 |
+
<input type="hidden" class="attribute-price-type" id="__id___price_type" value="0" />
|
119 |
+
</div>
|
120 |
+
<?php if ($this->getShowUseDefaultPrice()) : ?>
|
121 |
+
<div class="attribute-values-container no-display">
|
122 |
+
<input id="__id___default" type="checkbox" <?php if ($this->isReadonly() || $this->getCanEditPrice() === false):?> disabled="disabled" <?php endif;?> class="attribute-use-default-value">
|
123 |
+
</div>
|
124 |
+
<?php endif; ?>
|
125 |
+
<?php endif; ?>
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
+
<div class="template no-display" id="<?php echo $this->getHtmlId() ?>_simple_pricing">
|
129 |
+
<?php if ($this->getCanReadPrice() !== false) : ?>
|
130 |
+
<div class="attribute-values-container left v-middle">
|
131 |
+
<?php echo Mage::helper('catalog')->__('Price:') ?>
|
132 |
+
<input type="text" class="input-text attribute-price validate-number"<?php if ($this->getCanEditPrice() === false) : ?> disabled="disabled" <?php endif; ?>/>
|
133 |
+
</div>
|
134 |
+
<div class="attribute-values-container left v-middle">
|
135 |
+
<select class="attribute-price-type"<?php if ($this->getCanEditPrice() === false) : ?> disabled="disabled" <?php endif; ?>>
|
136 |
+
<option value="0"><?php echo Mage::helper('catalog')->__('Fixed') ?></option>
|
137 |
+
<option value="1"><?php echo Mage::helper('catalog')->__('Percentage') ?></option>
|
138 |
+
</select>
|
139 |
+
</div>
|
140 |
+
<?php else : ?>
|
141 |
+
<input type="hidden" class="attribute-price" />
|
142 |
+
<input type="hidden" class="attribute-price-type" />
|
143 |
+
<?php endif; ?>
|
144 |
+
</div>
|
145 |
+
<div class="template no-display" id="<?php echo $this->getHtmlId() ?>_simple_pricing_view">
|
146 |
+
<?php echo Mage::helper('catalog')->__('Price') ?> <strong>'{{value}}'</strong>
|
147 |
+
</div>
|
148 |
+
<?php echo $this->getGridHtml() ?>
|
149 |
+
<script type="text/javascript">
|
150 |
+
var superProduct = new Product.Configurable(<?php echo $this->getAttributesJson() ?>,<?php echo $this->getLinksJson() ?>,'<?php echo $this->getHtmlId() ?>_',<?php echo $this->getGridJsObject() ?>, <?php echo ( $this->isReadonly() ? 'true' : 'false'); ?>);
|
151 |
+
superProduct.createEmptyUrl = '<?php echo $this->getNewEmptyProductUrl() ?>';
|
152 |
+
superProduct.createNormalUrl = '<?php echo $this->getNewProductUrl() ?>';
|
153 |
+
superProduct.createQuickUrl = '<?php echo $this->getQuickCreationUrl() ?>';
|
154 |
+
|
155 |
+
Validation.add(
|
156 |
+
'validate-configurable',
|
157 |
+
'<?php echo $this->escapeJs(Mage::helper('catalog')->__('Product with this combination of attributes already associated to configurable.')) ?>',
|
158 |
+
superProduct.checkCreationUniqueAttributes.bind(superProduct)
|
159 |
+
)
|
160 |
+
|
161 |
+
var hash = {
|
162 |
+
'.jpg' : 1,
|
163 |
+
'.jpeg' : 1,
|
164 |
+
'.gif' : 1,
|
165 |
+
'.png' : 1,
|
166 |
+
};
|
167 |
+
|
168 |
+
function check_extension(filename,submitId) {
|
169 |
+
var re = /\..+$/;
|
170 |
+
var ext = filename.match(re);
|
171 |
+
var submitEl = document.getElementById(submitId);
|
172 |
+
|
173 |
+
if (hash[ext]) {
|
174 |
+
submitEl.disabled = false;
|
175 |
+
return true;
|
176 |
+
} else {
|
177 |
+
alert("Please upload 'jpg', 'jpeg', 'gif', 'png' file only");
|
178 |
+
submitEl.value = '';
|
179 |
+
|
180 |
+
return false;
|
181 |
+
}
|
182 |
+
}
|
183 |
+
</script>
|
184 |
+
|
185 |
+
<div><input type="hidden" name="affect_configurable_product_attributes" value="1" /></div>
|
app/design/adminhtml/default/default/template/cybage/swatches/options.phtml
ADDED
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
?>
|
21 |
+
<?php
|
22 |
+
/**
|
23 |
+
* Attribute options control
|
24 |
+
*
|
25 |
+
* @see Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract
|
26 |
+
* @var $this Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract
|
27 |
+
*/
|
28 |
+
?>
|
29 |
+
<?php
|
30 |
+
$baseDir = Mage::getBaseDir('media') . DIRECTORY_SEPARATOR .'swatches' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR;
|
31 |
+
?>
|
32 |
+
<div>
|
33 |
+
<ul class="messages">
|
34 |
+
<li class="notice-msg">
|
35 |
+
<ul>
|
36 |
+
<li><?php echo $this->__('If you do not specify an option value for a specific store view then the default (Admin) value will be used.') ?></li>
|
37 |
+
</ul>
|
38 |
+
</li>
|
39 |
+
</ul>
|
40 |
+
</div>
|
41 |
+
|
42 |
+
<div class="entity-edit">
|
43 |
+
<div class="entry-edit-head">
|
44 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Manage Titles (Size, Color, etc.)') ?></h4>
|
45 |
+
</div>
|
46 |
+
<div class="box">
|
47 |
+
<div class="hor-scroll">
|
48 |
+
<table class="dynamic-grid" cellspacing="0" id="attribute-labels-table">
|
49 |
+
<tr>
|
50 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
51 |
+
<th><?php echo $_store->getName() ?></th>
|
52 |
+
<?php endforeach; ?>
|
53 |
+
</tr>
|
54 |
+
<tr>
|
55 |
+
<?php $_labels = $this->getLabelValues() ?>
|
56 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
57 |
+
<td>
|
58 |
+
<input class="input-text<?php if($_store->getId()==0): ?> required-option<?php endif; ?>" type="text" name="frontend_label[<?php echo $_store->getId() ?>]" value="<?php echo $this->htmlEscape($_labels[$_store->getId()]) ?>"<?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/>
|
59 |
+
</td>
|
60 |
+
<?php endforeach; ?>
|
61 |
+
</tr>
|
62 |
+
</table>
|
63 |
+
</div>
|
64 |
+
</div>
|
65 |
+
</div>
|
66 |
+
<br/>
|
67 |
+
<div class="entity-edit" id="matage-options-panel">
|
68 |
+
<div class="entry-edit-head">
|
69 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Manage Options (values of your attribute)') ?></h4>
|
70 |
+
</div>
|
71 |
+
<div class="box">
|
72 |
+
<div class="hor-scroll">
|
73 |
+
<table class="dynamic-grid" cellspacing="0" cellpadding="0">
|
74 |
+
<tr id="attribute-options-table">
|
75 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
76 |
+
<th><?php echo $_store->getName() ?></th>
|
77 |
+
<?php endforeach; ?>
|
78 |
+
<th><?php echo $this->__('Position') ?></th>
|
79 |
+
<th class="nobr a-center"><?php echo $this->__('Is Default') ?></th>
|
80 |
+
<th class="nobr a-center"><?php echo Mage::helper('swatches')->__('Upload Image') ?></th>
|
81 |
+
<th class="nobr a-center"><?php echo Mage::helper('swatches')->__('Preview') ?></th>
|
82 |
+
<th class="nobr a-center"><?php echo Mage::helper('swatches')->__('Remove Image') ?></th>
|
83 |
+
<th>
|
84 |
+
<?php if (!$this->getReadOnly()):?>
|
85 |
+
<?php echo $this->getAddNewButtonHtml() ?>
|
86 |
+
<?php endif;?>
|
87 |
+
</th>
|
88 |
+
</tr>
|
89 |
+
<tr class="no-display template" id="row-template">
|
90 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
91 |
+
<td><input name="option[value][{{id}}][<?php echo $_store->getId() ?>]" value="{{store<?php echo $_store->getId() ?>}}" class="input-text<?php if($_store->getId()==0): ?> required-option<?php endif; ?>" type="text" <?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/></td>
|
92 |
+
<?php endforeach; ?>
|
93 |
+
<td class="a-center"><input class="input-text" type="text" name="option[order][{{id}}]" value="{{sort_order}}" <?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/></td>
|
94 |
+
<td><input class="input-radio" type="radio" name="default[]" value="{{id}}" <?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/></td>
|
95 |
+
</tr>
|
96 |
+
</table>
|
97 |
+
</div>
|
98 |
+
<input type="hidden" id="option-count-check" value="" />
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
<script type="text/javascript">
|
102 |
+
//<![CDATA[
|
103 |
+
var optionDefaultInputType = 'radio';
|
104 |
+
|
105 |
+
// IE removes quotes from element.innerHTML whenever it thinks they're not needed, which breaks html.
|
106 |
+
var templateText =
|
107 |
+
'<tr class="option-row">'+
|
108 |
+
<?php foreach ($this->getStores() as $_store): ?>
|
109 |
+
'<td><input name="option[value][{{id}}][<?php echo $_store->getId() ?>]" value="{{store<?php echo $_store->getId() ?>}}" class="input-text<?php if($_store->getId()==0): ?> required-option<?php endif; ?>" type="text" <?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/><\/td>'+
|
110 |
+
<?php endforeach; ?>
|
111 |
+
'<td><input class="input-text" type="text" name="option[order][{{id}}]" value="{{sort_order}}" <?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/><\/td>'+
|
112 |
+
'<td class="a-center"><input class="input-radio" type="{{intype}}" name="default[]" value="{{id}}" {{checked}} <?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/><\/td>'+
|
113 |
+
'<td class="a-center"><input type="file" id="file-{{id}}" name="swatches_img[{{id}}]" style="width:200px" onchange="check_extension(this.value,\'file-{{id}}\');"><\/td>'+
|
114 |
+
'<td class="a-center"><img src="{{option_img}}" alt="" width="18" height="18"><\/td>'+
|
115 |
+
'<td class="a-center"><input type="checkbox" name="swatches_img_delete[{{id}}]" value="1"><\/td>'+
|
116 |
+
'<td class="a-left" id="delete_button_container_{{id}}">'+
|
117 |
+
'<input type="hidden" class="delete-flag" name="option[delete][{{id}}]" value="" />'+
|
118 |
+
<?php if (!$this->getReadOnly()):?>
|
119 |
+
'<?php echo $this->getDeleteButtonHtml() ?>'+
|
120 |
+
<?php endif;?>
|
121 |
+
'<\/td>'+
|
122 |
+
'<\/tr>';
|
123 |
+
|
124 |
+
var attributeOption = {
|
125 |
+
table : $('attribute-options-table'),
|
126 |
+
templateSyntax : /(^|.|\r|\n)({{(\w+)}})/,
|
127 |
+
templateText : templateText,
|
128 |
+
itemCount : 0,
|
129 |
+
totalItems : 0,
|
130 |
+
isReadOnly: <?php echo (int)$this->getReadOnly(); ?>,
|
131 |
+
add : function(data) {
|
132 |
+
this.template = new Template(this.templateText, this.templateSyntax);
|
133 |
+
var isNewOption = false;
|
134 |
+
if(!data.id){
|
135 |
+
data = {};
|
136 |
+
data.id = 'option_'+this.itemCount;
|
137 |
+
isNewOption = true;
|
138 |
+
}
|
139 |
+
if (!data.intype)
|
140 |
+
data.intype = optionDefaultInputType;
|
141 |
+
Element.insert(this.table, {after: this.template.evaluate(data)});
|
142 |
+
if (isNewOption && !this.isReadOnly) {
|
143 |
+
this.enableNewOptionDeleteButton(data.id);
|
144 |
+
}
|
145 |
+
this.bindRemoveButtons();
|
146 |
+
this.itemCount++;
|
147 |
+
this.totalItems++;
|
148 |
+
this.updateItemsCountField();
|
149 |
+
},
|
150 |
+
remove : function(event){
|
151 |
+
var element = $(Event.findElement(event, 'tr')); // !!! Button already
|
152 |
+
// have table parent in safari
|
153 |
+
// Safari workaround
|
154 |
+
element.ancestors().each(function(parentItem){
|
155 |
+
if (parentItem.hasClassName('option-row')) {
|
156 |
+
element = parentItem;
|
157 |
+
throw $break;
|
158 |
+
} else if (parentItem.hasClassName('box')) {
|
159 |
+
throw $break;
|
160 |
+
}
|
161 |
+
});
|
162 |
+
|
163 |
+
|
164 |
+
if(element){
|
165 |
+
var elementFlags = element.getElementsByClassName('delete-flag');
|
166 |
+
if(elementFlags[0]){
|
167 |
+
elementFlags[0].value=1;
|
168 |
+
}
|
169 |
+
|
170 |
+
element.addClassName('no-display');
|
171 |
+
element.addClassName('template');
|
172 |
+
element.hide();
|
173 |
+
this.totalItems--;
|
174 |
+
this.updateItemsCountField();
|
175 |
+
}
|
176 |
+
},
|
177 |
+
updateItemsCountField: function() {
|
178 |
+
if (this.totalItems > 0) {
|
179 |
+
$('option-count-check').value = '1';
|
180 |
+
} else {
|
181 |
+
$('option-count-check').value = '';
|
182 |
+
}
|
183 |
+
},
|
184 |
+
enableNewOptionDeleteButton: function(id) {
|
185 |
+
$$('#delete_button_container_' + id + ' button').each(function(button) {
|
186 |
+
button.enable();
|
187 |
+
button.removeClassName('disabled');
|
188 |
+
});
|
189 |
+
},
|
190 |
+
bindRemoveButtons : function(){
|
191 |
+
var buttons = $$('.delete-option');
|
192 |
+
for(var i=0;i<buttons.length;i++){
|
193 |
+
if(!$(buttons[i]).binded){
|
194 |
+
$(buttons[i]).binded = true;
|
195 |
+
Event.observe(buttons[i], 'click', this.remove.bind(this));
|
196 |
+
}
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
}
|
201 |
+
if($('row-template')){
|
202 |
+
$('row-template').remove();
|
203 |
+
}
|
204 |
+
attributeOption.bindRemoveButtons();
|
205 |
+
|
206 |
+
if($('add_new_option_button')){
|
207 |
+
Event.observe('add_new_option_button', 'click', attributeOption.add.bind(attributeOption));
|
208 |
+
}
|
209 |
+
Validation.addAllThese([
|
210 |
+
['required-option', '<?php echo $this->__('Failed') ?>', function(v) {
|
211 |
+
return !Validation.get('IsEmpty').test(v);
|
212 |
+
}]]);
|
213 |
+
Validation.addAllThese([
|
214 |
+
['required-options-count', '<?php echo $this->__('Options is required') ?>', function(v) {
|
215 |
+
return !Validation.get('IsEmpty').test(v);
|
216 |
+
}]]);
|
217 |
+
<?php foreach ($this->getOptionValues() as $_value): ?>
|
218 |
+
attributeOption.add(<?php echo $_value->toJson() ?>);
|
219 |
+
<?php endforeach; ?>
|
220 |
+
//]]>
|
221 |
+
|
222 |
+
var hash = {
|
223 |
+
'.jpg' : 1,
|
224 |
+
'.jpeg' : 1,
|
225 |
+
'.gif' : 1,
|
226 |
+
'.png' : 1,
|
227 |
+
};
|
228 |
+
|
229 |
+
function check_extension(filename,submitId) {
|
230 |
+
var re = /\..+$/;
|
231 |
+
var ext = filename.match(re);
|
232 |
+
var submitEl = document.getElementById(submitId);
|
233 |
+
if (hash[ext]) {
|
234 |
+
submitEl.disabled = false;
|
235 |
+
return true;
|
236 |
+
} else {
|
237 |
+
alert("Please upload 'jpg', 'jpeg', 'gif', 'png' file only");
|
238 |
+
submitEl.value = '';
|
239 |
+
|
240 |
+
return false;
|
241 |
+
}
|
242 |
+
}
|
243 |
+
</script>
|
app/design/frontend/base/default/layout/cybage_swatches.xml
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Cybage Color Swatches Plugin
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available on the World Wide Web at:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
12 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
13 |
+
*
|
14 |
+
* @category Color Swatches Plugin
|
15 |
+
* @package Cybage_Swatches
|
16 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
17 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<layout version="1.0.0">
|
23 |
+
<catalog_product_view>
|
24 |
+
<reference name="head">
|
25 |
+
<action method="addJs"><script>varien/configurable.js</script></action>
|
26 |
+
<action method="addItem"><type>skin_css</type><name>js/cybage/swatches/css/swatches.css</name><params/></action>
|
27 |
+
</reference>
|
28 |
+
</catalog_product_view>
|
29 |
+
<PRODUCT_TYPE_configurable>
|
30 |
+
<reference name="head">
|
31 |
+
<action method="addItem"><type>skin_js</type><name>js/cybage/swatches/configurable.js</name><params/></action>
|
32 |
+
</reference>
|
33 |
+
</PRODUCT_TYPE_configurable>
|
34 |
+
<catalog_category_default>
|
35 |
+
<reference name="head">
|
36 |
+
<action method="addItem" ifconfig="swatches/list/swatches_on_list"><type>skin_css</type><name>js/cybage/swatches/css/swatches.css</name><params/></action>
|
37 |
+
<action method="addJs" ifconfig="swatches/list/swatches_on_list"><script>varien/product.js</script></action>
|
38 |
+
<action method="addJs" ifconfig="swatches/list/swatches_on_list"><script>varien/configurable.js</script></action>
|
39 |
+
<action method="addItem" ifconfig="swatches/list/swatches_on_list"><type>skin_js</type><name>js/cybage/swatches/configurableList.js</name><params/></action>
|
40 |
+
</reference>
|
41 |
+
</catalog_category_default>
|
42 |
+
|
43 |
+
<catalogsearch_result_index>
|
44 |
+
<reference name="head">
|
45 |
+
<action method="addItem" ifconfig="swatches/list/swatches_on_list"><type>skin_css</type><name>js/cybage/swatches/css/swatches.css</name><params/></action>
|
46 |
+
<action method="addJs" ifconfig="swatches/list/swatches_on_list"><script>varien/product.js</script></action>
|
47 |
+
<action method="addJs" ifconfig="swatches/list/swatches_on_list"><script>varien/configurable.js</script></action>
|
48 |
+
<action method="addItem" ifconfig="swatches/list/swatches_on_list"><type>skin_js</type><name>js/cybage/swatches/configurableList.js</name><params/></action>
|
49 |
+
</reference>
|
50 |
+
</catalogsearch_result_index>
|
51 |
+
|
52 |
+
<catalog_category_layered>
|
53 |
+
<reference name="head">
|
54 |
+
<action method="addItem" ifconfig="swatches/list/swatches_on_list"><type>skin_css</type><name>js/cybage/swatches/css/swatches.css</name><params/></action>
|
55 |
+
<action method="addJs" ifconfig="swatches/list/swatches_on_list"><script>varien/product.js</script></action>
|
56 |
+
<action method="addJs" ifconfig="swatches/list/swatches_on_list"><script>varien/configurable.js</script></action>
|
57 |
+
<action method="addItem" ifconfig="swatches/list/swatches_on_list"><type>skin_js</type><name>js/cybage/swatches/configurableList.js</name><params/></action>
|
58 |
+
</reference>
|
59 |
+
</catalog_category_layered>
|
60 |
+
</layout>
|
app/design/frontend/base/default/template/cybage/swatches/configurable.phtml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cybage Color Swatches Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available on the World Wide Web at:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
11 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
12 |
+
*
|
13 |
+
* @category Color Swatches Plugin
|
14 |
+
* @package Cybage_Swatches
|
15 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
16 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
18 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
$productAttribute = $this->checkConfAttribute();
|
22 |
+
$activeProduct = $this->getProduct();
|
23 |
+
?>
|
24 |
+
|
25 |
+
<?php if($activeProduct->isSaleable()):?>
|
26 |
+
<dl>
|
27 |
+
<?php if(!empty($productAttribute)):
|
28 |
+
|
29 |
+
foreach($productAttribute as $attributeValue):
|
30 |
+
//if($attributeValue['attribute_id'] == "272"):
|
31 |
+
?>
|
32 |
+
|
33 |
+
<dt id="title-<?php echo $attributeValue['attribute_id'] ?>-<?php echo $activeProduct->getEntityId() ?>">
|
34 |
+
<label class="required"><em>*</em> <?php echo $attributeValue['label']; ?></label>
|
35 |
+
</dt>
|
36 |
+
<dd class="last">
|
37 |
+
<div class="input-box" style="margin: 2px;">
|
38 |
+
<select name="superattributeValue[<?php echo $attributeValue['attribute_id'] ?>]" id="attribute<?php echo $attributeValue['attribute_id'] ?>-<?php echo $activeProduct->getEntityId() ?>" class="required-entry no-display super-attribute-select-<?php echo $activeProduct->getEntityId() ?>">
|
39 |
+
<option><?php echo $this->__('Choose an Option...') ?></option>
|
40 |
+
</select>
|
41 |
+
</div>
|
42 |
+
</dd>
|
43 |
+
<?php// endif; ?>
|
44 |
+
<?php endforeach; ?>
|
45 |
+
<?php endif; ?>
|
46 |
+
</dl>
|
47 |
+
<script type="text/javascript">
|
48 |
+
listingSwatches = new Product.Config(<?php echo $this->getJsonConfig() ?>);
|
49 |
+
optionsPrice['<?php echo $activeProduct->getId();?>'] = new Product.OptionsPrice(<?php echo $this->getPriceForConfig();?>);
|
50 |
+
</script>
|
51 |
+
<?php endif;?>
|
app/etc/modules/Cybage_Swatches.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Cybage Color Swatches Plugin
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available on the World Wide Web at:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you are unable to access it on the World Wide Web, please send an email
|
12 |
+
* To: Support_Magento@cybage.com. We will send you a copy of the source file.
|
13 |
+
*
|
14 |
+
* @category Color Swatches Plugin
|
15 |
+
* @package Cybage_Swatches
|
16 |
+
* @copyright Copyright (c) 2014 Cybage Software Pvt. Ltd., India
|
17 |
+
* http://www.cybage.com/pages/centers-of-excellence/ecommerce/ecommerce.aspx
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
* @author Cybage Software Pvt. Ltd. <Support_Magento@cybage.com>
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<config>
|
23 |
+
<modules>
|
24 |
+
<Cybage_Swatches>
|
25 |
+
<active>true</active>
|
26 |
+
<codePool>community</codePool>
|
27 |
+
</Cybage_Swatches>
|
28 |
+
</modules>
|
29 |
+
</config>
|
media/swatches/.htaccess
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Options All -Indexes
|
2 |
+
<IfModule mod_php5.c>
|
3 |
+
php_flag engine 0
|
4 |
+
</IfModule>
|
5 |
+
|
6 |
+
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
|
7 |
+
Options -ExecCGI
|
8 |
+
|
9 |
+
<IfModule mod_rewrite.c>
|
10 |
+
|
11 |
+
############################################
|
12 |
+
## enable rewrites
|
13 |
+
|
14 |
+
Options +FollowSymLinks
|
15 |
+
RewriteEngine on
|
16 |
+
|
17 |
+
############################################
|
18 |
+
## never rewrite for existing files
|
19 |
+
RewriteCond %{REQUEST_FILENAME} !-f
|
20 |
+
|
21 |
+
############################################
|
22 |
+
## rewrite everything else to index.php
|
23 |
+
|
24 |
+
RewriteRule .* ../get.php [L]
|
25 |
+
</IfModule>
|
media/swatches/images/.htaccess
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Options All -Indexes
|
2 |
+
<IfModule mod_php5.c>
|
3 |
+
php_flag engine 0
|
4 |
+
</IfModule>
|
5 |
+
|
6 |
+
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
|
7 |
+
Options -ExecCGI
|
8 |
+
|
9 |
+
<IfModule mod_rewrite.c>
|
10 |
+
|
11 |
+
############################################
|
12 |
+
## enable rewrites
|
13 |
+
|
14 |
+
Options +FollowSymLinks
|
15 |
+
RewriteEngine on
|
16 |
+
|
17 |
+
############################################
|
18 |
+
## never rewrite for existing files
|
19 |
+
RewriteCond %{REQUEST_FILENAME} !-f
|
20 |
+
|
21 |
+
############################################
|
22 |
+
## rewrite everything else to index.php
|
23 |
+
|
24 |
+
RewriteRule .* ../get.php [L]
|
25 |
+
</IfModule>
|
media/swatches/products/.htaccess
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Options All -Indexes
|
2 |
+
<IfModule mod_php5.c>
|
3 |
+
php_flag engine 0
|
4 |
+
</IfModule>
|
5 |
+
|
6 |
+
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
|
7 |
+
Options -ExecCGI
|
8 |
+
|
9 |
+
<IfModule mod_rewrite.c>
|
10 |
+
|
11 |
+
############################################
|
12 |
+
## enable rewrites
|
13 |
+
|
14 |
+
Options +FollowSymLinks
|
15 |
+
RewriteEngine on
|
16 |
+
|
17 |
+
############################################
|
18 |
+
## never rewrite for existing files
|
19 |
+
RewriteCond %{REQUEST_FILENAME} !-f
|
20 |
+
|
21 |
+
############################################
|
22 |
+
## rewrite everything else to index.php
|
23 |
+
|
24 |
+
RewriteRule .* ../get.php [L]
|
25 |
+
</IfModule>
|
package.xml
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Cybage_Swatches</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>Administrator can use the Color Swatch plug-in for configurable products to define their color, related size, and price at Magento store. For example, you can sell t-shirts in two colors and three sizes. The plug-in is used to define any type of attribute such as size, price, manufacturer, and color.</summary>
|
10 |
+
<description>Administrator can use the Color Swatch plug-in for configurable products to define their color, related size, and price at Magento store. For example, you can sell t-shirts in two colors and three sizes. The plug-in is used to define any type of attribute such as size, price, manufacturer, and color. 
|
11 |
+
Features
|
12 |
+
• Support multiple swatch images for attribute options 
|
13 |
+
• Easy management of width and height of swatches 
|
14 |
+
• Organization of images for the configurable product attributes
|
15 |
+
• Support for multiple attribute options
|
16 |
+
• Easy management of multiple attributes on a single product 
|
17 |
+
• Convert product attribute options as swatches on configurable products
|
18 |
+
• Customers can view the simple products images based on their selection of Configurable products options.
|
19 |
+
Benefits
|
20 |
+
• Easy installation and integration
|
21 |
+
• Configure products easily to get more business
|
22 |
+
• Open source implementation
|
23 |
+
• Easy management of color swatches at attribute and product level
|
24 |
+
• Customers can view different images based on their selection of the configurable product options</description>
|
25 |
+
<notes>After installation of the Color Swatches plug-in, please clear the cache.</notes>
|
26 |
+
<authors><author><name>Cybage Software Pvt. Ltd.</name><user>cybage</user><email>Support_Magento@cybage.com</email></author></authors>
|
27 |
+
<date>2015-01-30</date>
|
28 |
+
<time>06:15:11</time>
|
29 |
+
<contents><target name="magecommunity"><dir name="Cybage"><dir name="Swatches"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Attribute"><dir name="Edit"><file name="Form.php" hash="af7cbe62251e2eb2f5e9162bf6755b76"/><dir name="Tab"><file name="Main.php" hash="55239421ceeb962578b256d29157e837"/><file name="Options.php" hash="138f7133fc9a1ecc6d7a8dc1893bb731"/></dir></dir></dir><dir name="Edit"><dir name="Tab"><dir name="Super"><file name="Config.php" hash="b2634a1dc8dc6052883c22fecefc99a9"/></dir></dir></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><dir name="View"><dir name="Type"><file name="Configurable.php" hash="32e6d9d638e4f1ddf6be7079ae5b1503"/><file name="ConfigurableList.php" hash="33202ef00c1b86bb5859ca33954f7fc6"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="718831a5462ff7051714a0bcb4f71e86"/><file name="Product.php" hash="85d86882c9a3d298c05f9be1a1868827"/></dir><dir name="Model"><file name="Attribute.php" hash="60cc2983759612b61dfae72f815dc488"/><dir name="Mysql4"><dir name="Attribute"><file name="Collection.php" hash="cc7f8e3c49ec5f19077bba7252316940"/></dir><file name="Attribute.php" hash="4d555f2b0df3ffbb10c082f0cb079887"/></dir><file name="Observer.php" hash="2e4b2600689dc800516450a75ab73154"/></dir><dir name="etc"><file name="adminhtml.xml" hash="02949e28fff6bb938f048c9edd89fd24"/><file name="config.xml" hash="501d31296fdd889d190d561935ef82b2"/><file name="system.xml" hash="135b73951746c4a5a04ccd4c0a5c5ae3"/></dir><dir name="sql"><dir name="swatches_setup"><file name="mysql4-install-1.0.0.php" hash="879f4dbc6b4a0a764e57f80f3510483f"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cybage_Swatches.xml" hash="3bbc5c26a2ebd202911b7fdee78991f5"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="cybage_swatches.xml" hash="96adb24ca6a7d410e493a2aed65f594f"/></dir><dir name="template"><dir name="cybage"><dir name="catalog"><dir name="product"><dir name="edit"><dir name="super"><file name="config.phtml" hash="428c8fbfec9435f55de21fb32cf84123"/></dir></dir></dir></dir><dir name="swatches"><file name="options.phtml" hash="7456ca85bb090ec4bb79737b83e0b20d"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="cybage_swatches.xml" hash="0eab22119365021d4583f3d2e5f59a24"/></dir><dir name="template"><dir name="cybage"><dir name="swatches"><file name="configurable.phtml" hash="a2da9222d4e004a664a0ba6f108df23c"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="js"><dir name="cybage"><dir name="swatches"><file name="configurable.js" hash="1f98e78d7d2254ea2da52a83325e98f7"/><file name="configurableList.js" hash="c76ac5ca86c8d8baf725f11e546a97b6"/><dir name="css"><file name="swatches.css" hash="66dd4b9ec053b84574dc91e59cb25b5b"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="swatches"><dir name="images"><file name=".htaccess" hash="08de5b2f5ea1ce6f51f40a19bacbf42e"/></dir><dir name="products"><file name=".htaccess" hash="08de5b2f5ea1ce6f51f40a19bacbf42e"/></dir><file name=".htaccess" hash="08de5b2f5ea1ce6f51f40a19bacbf42e"/></dir></target></contents>
|
30 |
+
<compatible/>
|
31 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
32 |
+
</package>
|
skin/frontend/base/default/js/cybage/swatches/configurable.js
ADDED
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**************************** CONFIGURABLE PRODUCT **************************/
|
2 |
+
/**************************** reference from varien/configurable.js **************************/
|
3 |
+
|
4 |
+
// Product.Config is initialized in varien/configurable.js
|
5 |
+
|
6 |
+
Product.Config.prototype.configureElement = function(element)
|
7 |
+
{
|
8 |
+
this.reloadOptionLabels(element);
|
9 |
+
if(element.value){
|
10 |
+
this.state[element.config.id] = element.value;
|
11 |
+
if(element.nextSetting){
|
12 |
+
element.nextSetting.disabled = false;
|
13 |
+
this.fillSelect(element.nextSetting);
|
14 |
+
this.resetChildren(element.nextSetting);
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
var selectValue = '';
|
19 |
+
this.settings.each(function(element){
|
20 |
+
if (parseInt(element.value))
|
21 |
+
{
|
22 |
+
selectValue += element.value + ',';
|
23 |
+
}
|
24 |
+
});
|
25 |
+
|
26 |
+
selectValue = selectValue.substr(0, selectValue.length - 1);
|
27 |
+
this.updateSwatchInfo(selectValue);
|
28 |
+
|
29 |
+
/*if(typeof additionalData != 'undefined')
|
30 |
+
{
|
31 |
+
this.reloadAssociatedPrice(selectValue);
|
32 |
+
}
|
33 |
+
else
|
34 |
+
{*/
|
35 |
+
this.reloadPrice();
|
36 |
+
//}
|
37 |
+
}
|
38 |
+
|
39 |
+
Product.Config.prototype.fillSelect = function(element){
|
40 |
+
|
41 |
+
var attributeId = element.id.replace(/[a-z]*/, '');
|
42 |
+
var options = this.getAttributeOptions(attributeId);
|
43 |
+
this.clearSelect(element);
|
44 |
+
element.options[0] = new Option('', '');
|
45 |
+
element.options[0].innerHTML = this.config.chooseText;
|
46 |
+
|
47 |
+
var prevConfig = false;
|
48 |
+
if(element.prevSetting){
|
49 |
+
prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex];
|
50 |
+
}
|
51 |
+
|
52 |
+
if(options) {
|
53 |
+
if ($('swatch-images-' + attributeId))
|
54 |
+
{
|
55 |
+
$('swatch-images-' + attributeId).parentNode.removeChild($('swatch-images-' + attributeId));
|
56 |
+
}
|
57 |
+
|
58 |
+
if (this.config.attributes[attributeId].use_swatches)
|
59 |
+
{
|
60 |
+
contentDiv = new Element('div', {
|
61 |
+
'class': 'main-swatch-container',
|
62 |
+
'id': 'swatch-images-' + attributeId});
|
63 |
+
|
64 |
+
$(element.parentNode).insert({
|
65 |
+
top: contentDiv
|
66 |
+
});
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
var index = 1;
|
71 |
+
for(var i=0;i<options.length;i++){
|
72 |
+
var allowedProducts = [];
|
73 |
+
if(prevConfig) {
|
74 |
+
for(var j=0;j<options[i].products.length;j++){
|
75 |
+
if(prevConfig.config.allowedProducts
|
76 |
+
&& prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){
|
77 |
+
allowedProducts.push(options[i].products[j]);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
} else {
|
81 |
+
allowedProducts = options[i].products.clone();
|
82 |
+
}
|
83 |
+
|
84 |
+
if(allowedProducts.size()>0)
|
85 |
+
{
|
86 |
+
if (this.config.attributes[attributeId].use_swatches)
|
87 |
+
{
|
88 |
+
var imgContainer = new Element('div', {
|
89 |
+
'class': 'attr-image-container',
|
90 |
+
'id': 'attr-image-container-' + attributeId
|
91 |
+
});
|
92 |
+
|
93 |
+
contentDiv.insert(imgContainer);
|
94 |
+
|
95 |
+
var swatch = new Element('img', {
|
96 |
+
'class': 'attr-image',
|
97 |
+
'id': 'attr-image-' + options[i].id,
|
98 |
+
'src': options[i].image,
|
99 |
+
'alt': options[i].label,
|
100 |
+
'title': options[i].label,
|
101 |
+
'width':this.config.attributes[attributeId].swatches_size,
|
102 |
+
'height':this.config.attributes[attributeId].swatches_size
|
103 |
+
});
|
104 |
+
swatch.observe('click', this.setSwatches.bind(this));
|
105 |
+
|
106 |
+
imgContainer.insert(swatch);
|
107 |
+
}
|
108 |
+
|
109 |
+
options[i].allowedProducts = allowedProducts;
|
110 |
+
element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id);
|
111 |
+
element.options[index].config = options[i];
|
112 |
+
index++;
|
113 |
+
}
|
114 |
+
}
|
115 |
+
if(this.config.attributes[attributeId].use_swatches) {
|
116 |
+
$(element.parentNode).insert({
|
117 |
+
bottom: new Element('div', {'class': 'swatches-separator'})
|
118 |
+
});
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
Product.Config.prototype.setSwatches = function(event){
|
124 |
+
|
125 |
+
var element = Event.element(event);
|
126 |
+
attributeId = element.parentNode.id.replace(/[a-z-]*/, '');
|
127 |
+
optionId = element.id.replace(/[a-z-]*/, '');
|
128 |
+
|
129 |
+
$('swatch-images-' + attributeId).childElements().each(function(childElement){
|
130 |
+
if(childElement.childElements()[0]){
|
131 |
+
childElement.childElements()[0].removeClassName('attr-image-selected');
|
132 |
+
}
|
133 |
+
});
|
134 |
+
element.addClassName('attr-image-selected');
|
135 |
+
|
136 |
+
$('attribute' + attributeId).value = optionId;
|
137 |
+
this.configureElement($('attribute' + attributeId));
|
138 |
+
}
|
139 |
+
|
140 |
+
Product.Config.prototype.updateSwatchInfo = function(selectValue)
|
141 |
+
{
|
142 |
+
if ('undefined' == typeof(additionalData))
|
143 |
+
{
|
144 |
+
return false;
|
145 |
+
}
|
146 |
+
|
147 |
+
if (additionalData.hasselectValue(selectValue))
|
148 |
+
{
|
149 |
+
if(additionalData.getData(selectValue, 'media_url'))
|
150 |
+
{
|
151 |
+
if($$('.product-img-box .more-views') == undefined || $$('.product-img-box .more-views') == '') {
|
152 |
+
$$('.product-img-box').last().insert('<div class="more-views"><h2>More Views</h2><ul></ul></div>');
|
153 |
+
}
|
154 |
+
|
155 |
+
var cnt = 0;
|
156 |
+
|
157 |
+
additionalData.getData(selectValue, 'media_url').each(function (image,cnt){
|
158 |
+
|
159 |
+
if(cnt == 0){
|
160 |
+
$$('.product-img-box .product-image img').each( function(img){ img.src=image['url'] } );
|
161 |
+
} else if(cnt == 1){
|
162 |
+
if(image['url'] == '') {
|
163 |
+
$$('.product-img-box .more-views ul ').each( function(ul){
|
164 |
+
ul.innerHTML = null;
|
165 |
+
});
|
166 |
+
}else{
|
167 |
+
$$('.product-img-box .more-views ul ').each( function(ul){
|
168 |
+
ul.innerHTML = additionalData.getGalleryInfo(image['label'],image['url'],image['galleryUrl']);
|
169 |
+
}); }
|
170 |
+
} else {
|
171 |
+
$$('.product-img-box .more-views ul ').each( function(ul){
|
172 |
+
ul.innerHTML += additionalData.getGalleryInfo(image['label'],image['url'],image['galleryUrl']);
|
173 |
+
});
|
174 |
+
}
|
175 |
+
cnt++;
|
176 |
+
});
|
177 |
+
}
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
Product.Config.prototype.reloadAssociatedPrice = function(selectValue)
|
182 |
+
{
|
183 |
+
if ('undefined' == typeof(additionalData))
|
184 |
+
{
|
185 |
+
return false;
|
186 |
+
}
|
187 |
+
|
188 |
+
var container;
|
189 |
+
if (additionalData.hasselectValue(selectValue))
|
190 |
+
{
|
191 |
+
if (additionalData.getData(selectValue, 'price_html'))
|
192 |
+
{
|
193 |
+
$$('.product-shop .price-box').each(function(container)
|
194 |
+
{
|
195 |
+
container.innerHTML = additionalData.getData(selectValue, 'price_html');
|
196 |
+
}.bind(this));
|
197 |
+
|
198 |
+
}
|
199 |
+
|
200 |
+
if (additionalData.getData(selectValue, 'price_clone_html'))
|
201 |
+
{
|
202 |
+
$$('.product-options-bottom .price-box').each(function(container)
|
203 |
+
{
|
204 |
+
container.innerHTML = additionalData.getData(selectValue, 'price_clone_html');
|
205 |
+
}.bind(this));
|
206 |
+
|
207 |
+
}
|
208 |
+
|
209 |
+
|
210 |
+
}
|
211 |
+
|
212 |
+
}
|
213 |
+
|
214 |
+
PDPSwatchesData = Class.create();
|
215 |
+
PDPSwatchesData.prototype =
|
216 |
+
{
|
217 |
+
initialize : function(additionalData)
|
218 |
+
{
|
219 |
+
this.additionalData = additionalData;
|
220 |
+
},
|
221 |
+
|
222 |
+
getGalleryInfo : function(label,url,galleryUrl){
|
223 |
+
var liContent = "<li><a href='#' onclick=\"popWin('"+galleryUrl+"', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;\" title='"+label+"'><img src="+url+" width='56' height='56' alt='"+label+"' /></a></li>";
|
224 |
+
|
225 |
+
return liContent;
|
226 |
+
},
|
227 |
+
|
228 |
+
hasselectValue : function(selectValue)
|
229 |
+
{
|
230 |
+
return ('undefined' != typeof(this.additionalData[selectValue]));
|
231 |
+
},
|
232 |
+
|
233 |
+
getData : function(selectValue, param)
|
234 |
+
{
|
235 |
+
if (this.hasselectValue(selectValue) && 'undefined' != typeof(this.additionalData[selectValue][param]))
|
236 |
+
{
|
237 |
+
return this.additionalData[selectValue][param];
|
238 |
+
}
|
239 |
+
return false;
|
240 |
+
}
|
241 |
+
}
|
skin/frontend/base/default/js/cybage/swatches/configurableList.js
ADDED
@@ -0,0 +1,340 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**************************** CONFIGURABLE PRODUCT **************************/
|
2 |
+
/**************************** reference from varien/configurable.js **************************/
|
3 |
+
|
4 |
+
// Product.Config is initialized in varien/configurable.js
|
5 |
+
|
6 |
+
swatchesListingData = Class.create();
|
7 |
+
swatchesListingData.prototype.initialize = function(optionProducts){
|
8 |
+
this.optionProducts = optionProducts;
|
9 |
+
}
|
10 |
+
|
11 |
+
var optionsPrice = [];
|
12 |
+
var confData = [];
|
13 |
+
var prevNextProduct = [];
|
14 |
+
|
15 |
+
Product.Config.prototype.initialize = function(config){
|
16 |
+
|
17 |
+
this.config = config;
|
18 |
+
this.taxConfig = this.config.taxConfig;
|
19 |
+
this.settings = $$('.super-attribute-select-'+ config.productId);
|
20 |
+
this.state = new Hash();
|
21 |
+
this.priceTemplate = new Template(this.config.template);
|
22 |
+
this.prices = config.prices;
|
23 |
+
this.hideLabels();
|
24 |
+
|
25 |
+
this.settings.each(function(element){
|
26 |
+
var attributeId = this.getAttributeId(element);
|
27 |
+
if(attributeId && this.config.attributes[attributeId]) {
|
28 |
+
element.config = this.config.attributes[attributeId];
|
29 |
+
element.attributeId = attributeId;
|
30 |
+
this.state[attributeId] = false;
|
31 |
+
}
|
32 |
+
}.bind(this))
|
33 |
+
|
34 |
+
this.setPrevnextSetting();
|
35 |
+
// Set values to inputs
|
36 |
+
this.configureForValues();
|
37 |
+
document.observe("dom:loaded", this.configureForValues.bind(this));
|
38 |
+
}
|
39 |
+
|
40 |
+
Product.Config.prototype.fillSelect = function(element){
|
41 |
+
|
42 |
+
var attributeId = this.getAttributeId(element);
|
43 |
+
var options = this.getAttributeOptions(attributeId);
|
44 |
+
this.clearSelect(element);
|
45 |
+
element.options[0] = new Option('', '');
|
46 |
+
element.options[0].innerHTML = this.config.chooseText;
|
47 |
+
var prevConfig = false;
|
48 |
+
|
49 |
+
if(element.prevSetting){
|
50 |
+
prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex];
|
51 |
+
}
|
52 |
+
|
53 |
+
if(options) {
|
54 |
+
|
55 |
+
if (this.config.attributes[attributeId].use_swatches)
|
56 |
+
{
|
57 |
+
if ($('swatch-images-' + attributeId + '-' + this.config.productId))
|
58 |
+
{
|
59 |
+
$('swatch-images-' + attributeId + '-' + this.config.productId).parentNode.removeChild($('swatch-images-' + attributeId + '-' + this.config.productId));
|
60 |
+
}
|
61 |
+
$('title-' + attributeId + '-' + this.config.productId).show();
|
62 |
+
contentDiv = new Element('div', {
|
63 |
+
'class': 'settings-swatch-container',
|
64 |
+
'id': 'swatch-images-' + attributeId + '-' + this.config.productId});
|
65 |
+
|
66 |
+
$(element.parentNode).insert({
|
67 |
+
top: contentDiv
|
68 |
+
});
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
var index = 1;
|
73 |
+
for(var i=0;i<options.length;i++){
|
74 |
+
var allowedProducts = [];
|
75 |
+
if(prevConfig) {
|
76 |
+
|
77 |
+
for(var j=0;j<options[i].products.length;j++){
|
78 |
+
if(prevConfig.config && prevConfig.config.allowedProducts
|
79 |
+
&& prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){
|
80 |
+
|
81 |
+
allowedProducts.push(options[i].products[j]);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
} else {
|
85 |
+
allowedProducts = options[i].products.clone();
|
86 |
+
}
|
87 |
+
|
88 |
+
if(allowedProducts.size()>0)
|
89 |
+
{
|
90 |
+
if (this.config.attributes[attributeId].use_swatches)
|
91 |
+
{
|
92 |
+
var imgContainer = new Element('div', {
|
93 |
+
'class': 'attr-image-container',
|
94 |
+
'id': 'attr-image-container-' + options[i].id + '-' + this.config.productId
|
95 |
+
});
|
96 |
+
|
97 |
+
contentDiv.insert(imgContainer);
|
98 |
+
|
99 |
+
var swatch = new Element('img', {
|
100 |
+
'class': 'attr-image',
|
101 |
+
'id': 'attr-image-' + options[i].id + '-' + this.config.productId,
|
102 |
+
'src': options[i].image,
|
103 |
+
'alt': options[i].label,
|
104 |
+
'title': options[i].label,
|
105 |
+
'height': this.config.size,
|
106 |
+
'width': this.config.size
|
107 |
+
});
|
108 |
+
swatch.observe('click', this.setSwatches.bind(this));
|
109 |
+
|
110 |
+
imgContainer.insert(swatch);
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
+
if(allowedProducts.size()>0){
|
115 |
+
options[i].allowedProducts = allowedProducts;
|
116 |
+
element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id);
|
117 |
+
element.options[index].config = options[i];
|
118 |
+
index++;
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
if(this.config.attributes[attributeId].use_swatches) {
|
124 |
+
$(element.parentNode).insert({
|
125 |
+
bottom: new Element('div', {'class': 'swatches-separator'})
|
126 |
+
});
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
}
|
131 |
+
|
132 |
+
Product.Config.prototype.setSwatches = function(event){
|
133 |
+
|
134 |
+
var element = Event.element(event);
|
135 |
+
attributeId = element.parentNode.parentNode.id.replace(/[a-z-]*/, '');
|
136 |
+
var optionId = element.id.replace(/[a-z-]*/, '');
|
137 |
+
var position = optionId.indexOf('-');
|
138 |
+
if ('-1' != position)
|
139 |
+
optionId = optionId.substring(0, position);
|
140 |
+
|
141 |
+
$$('#attribute' + attributeId).each(function(select){
|
142 |
+
select.value = optionId;
|
143 |
+
});
|
144 |
+
this.configureElement($('attribute' + attributeId));
|
145 |
+
}
|
146 |
+
|
147 |
+
Product.Config.prototype.configureElement = function(element)
|
148 |
+
{
|
149 |
+
this.reloadOptionLabels(element);
|
150 |
+
|
151 |
+
if(element.value){
|
152 |
+
|
153 |
+
this.state[element.config.id] = element.value;
|
154 |
+
var elementId = element.id;
|
155 |
+
|
156 |
+
var position = elementId.indexOf('-');
|
157 |
+
if ('-1' != position){
|
158 |
+
elementId = elementId.substring(position+1, elementId.lenght);
|
159 |
+
elementId = parseInt(elementId);
|
160 |
+
if(prevNextProduct[elementId] && prevNextProduct[elementId][element.config.id] && prevNextProduct[elementId][element.config.id][1] || element.nextSetting){
|
161 |
+
if(prevNextProduct[elementId] && prevNextProduct[elementId][element.config.id] && prevNextProduct[elementId][element.config.id][1]){
|
162 |
+
element.nextSetting = prevNextProduct[elementId][element.config.id][1]
|
163 |
+
}
|
164 |
+
element.nextSetting.disabled = false;
|
165 |
+
this.fillSelect(element.nextSetting);
|
166 |
+
this.resetChildren(element.nextSetting);
|
167 |
+
}
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
if ($('attr-image-' + element.value + '-' + this.config.productId))
|
172 |
+
{
|
173 |
+
this.selectImage($('attr-image-' + element.value + '-' + this.config.productId));
|
174 |
+
}
|
175 |
+
else {
|
176 |
+
attributeId = element.id.replace(/[a-z-]*/, '');
|
177 |
+
if ($('swatch-images-' + attributeId))
|
178 |
+
{
|
179 |
+
$('swatch-images-' + attributeId).childElements().each(function(child){
|
180 |
+
child.removeClassName('attr-image-selected');
|
181 |
+
});
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
}
|
186 |
+
|
187 |
+
|
188 |
+
Product.Config.prototype.selectImage = function(element)
|
189 |
+
{
|
190 |
+
attributeId = element.parentNode.parentNode.id.replace(/[a-z-]*/, '');
|
191 |
+
$('swatch-images-' + attributeId).childElements().each(function(child){
|
192 |
+
var childr = child.childElements();
|
193 |
+
if(childr[0]) {
|
194 |
+
$(childr[0]).removeClassName('attr-image-selected');
|
195 |
+
}
|
196 |
+
});
|
197 |
+
element.addClassName('attr-image-selected');
|
198 |
+
|
199 |
+
var position = attributeId.indexOf('-');
|
200 |
+
if ('-1' == position) return;
|
201 |
+
|
202 |
+
var optionId = attributeId.substring(0, position);
|
203 |
+
var parentId = attributeId.substring(position+1, attributeId.length);
|
204 |
+
|
205 |
+
var selectValue = '';
|
206 |
+
this.settings.each(function(select){
|
207 |
+
if (parseInt(select.value))
|
208 |
+
{
|
209 |
+
selectValue += select.value + ',';
|
210 |
+
}
|
211 |
+
});
|
212 |
+
selectValue = selectValue.substr(0, selectValue.length - 1);
|
213 |
+
if('undefined' != typeof(confData[parentId]['optionProducts'][selectValue]['small_image'])){
|
214 |
+
var parUrl = confData[parentId]['optionProducts'][selectValue]['parent_image'];
|
215 |
+
var possl = parUrl.lastIndexOf('/');
|
216 |
+
|
217 |
+
$$('.product-image img').each(function(img){
|
218 |
+
var posslImg = img.src.lastIndexOf('/');
|
219 |
+
if(img.src.substr(posslImg, img.src.length) == parUrl.substr(possl, parUrl.length) || img.hasClassName('swatches-parent-'+parentId)){
|
220 |
+
img.src = confData[parentId]['optionProducts'][selectValue]['small_image'];
|
221 |
+
img.addClassName('swatches-parent-'+parentId);
|
222 |
+
|
223 |
+
}
|
224 |
+
});
|
225 |
+
|
226 |
+
}
|
227 |
+
|
228 |
+
/*if ('undefined' != typeof(confData[parentId]))
|
229 |
+
{
|
230 |
+
this.reloadPriceOfChildProducts(parentId, selectValue);
|
231 |
+
}else{*/
|
232 |
+
this.reloadPrice();
|
233 |
+
//}
|
234 |
+
}
|
235 |
+
|
236 |
+
Product.Config.prototype.reloadPrice = function(){
|
237 |
+
|
238 |
+
var price = 0;
|
239 |
+
var oldPrice = 0;
|
240 |
+
for(var i=this.settings.length-1;i>=0;i--){
|
241 |
+
var selected = this.settings[i].options[this.settings[i].selectedIndex];
|
242 |
+
if(selected.config){
|
243 |
+
price += parseFloat(selected.config.price);
|
244 |
+
oldPrice += parseFloat(selected.config.oldPrice);
|
245 |
+
}
|
246 |
+
}
|
247 |
+
|
248 |
+
optionsPrice[this.config.productId].changePrice('config', {'price': price, 'oldPrice': oldPrice});
|
249 |
+
optionsPrice[this.config.productId].reload();
|
250 |
+
return price;
|
251 |
+
if($('product-price-'+this.config.productId)){
|
252 |
+
$('product-price-'+this.config.productId).innerHTML = price;
|
253 |
+
}
|
254 |
+
this.reloadOldPrice();
|
255 |
+
}
|
256 |
+
|
257 |
+
|
258 |
+
Product.Config.prototype.reloadPriceOfChildProducts = function(parentId, selectValue)
|
259 |
+
{
|
260 |
+
if ('undefined' == typeof(confData) || 'undefined' == typeof(confData[parentId]['optionProducts'][selectValue]['price_html']))
|
261 |
+
{
|
262 |
+
return false;
|
263 |
+
}
|
264 |
+
|
265 |
+
var childConf = confData[parentId]['optionProducts'][selectValue];
|
266 |
+
var priceHtml = childConf['price_html'];
|
267 |
+
//console.log(priceHtml);
|
268 |
+
|
269 |
+
$$('.price-box').each(function(container)
|
270 |
+
{
|
271 |
+
if(container.select('#product-price-'+parentId) != 0 || container.select('#parent-product-price-'+parentId) != 0) {
|
272 |
+
|
273 |
+
var priceContainer = new Element('div', {'style': 'display:none'});
|
274 |
+
priceContainer.update(priceHtml);
|
275 |
+
container.insert(priceContainer);
|
276 |
+
|
277 |
+
var pricetmpContainer1 = new Element('div', {'id': 'parent-product-price-'+parentId});
|
278 |
+
var pricetmpContainer2 = priceContainer.childElements()[0];
|
279 |
+
pricetmpContainer2.appendChild(pricetmpContainer1);
|
280 |
+
container.innerHTML = pricetmpContainer2.innerHTML;
|
281 |
+
}
|
282 |
+
}.bind(this));
|
283 |
+
|
284 |
+
}
|
285 |
+
|
286 |
+
Product.Config.prototype.getAttributeId = function(element){
|
287 |
+
var attributeId = element.id.replace(/[a-z]*/, '');
|
288 |
+
var position = attributeId.indexOf('-');
|
289 |
+
if ('-1' != position){
|
290 |
+
attributeId = attributeId.substring(0, position);
|
291 |
+
}
|
292 |
+
return attributeId;
|
293 |
+
|
294 |
+
}
|
295 |
+
|
296 |
+
Product.Config.prototype.hideLabels = function(element){
|
297 |
+
this.settings.each(function(element){
|
298 |
+
var attributeId = element.id.replace(/[a-z]*/,'');
|
299 |
+
$('title-' + attributeId).hide();
|
300 |
+
}.bind(this))
|
301 |
+
}
|
302 |
+
|
303 |
+
Product.Config.prototype.setPrevnextSetting = function(){
|
304 |
+
var childSettings = [];
|
305 |
+
|
306 |
+
for(var cnt=this.settings.length-1;cnt>=0;cnt--){
|
307 |
+
|
308 |
+
if(this.settings[cnt-1]){
|
309 |
+
var prevSetting = this.settings[cnt-1];
|
310 |
+
}else{
|
311 |
+
var prevSetting = false;
|
312 |
+
}
|
313 |
+
|
314 |
+
if(this.settings[cnt+1]){
|
315 |
+
var nextSetting = this.settings[cnt+1];
|
316 |
+
}else{
|
317 |
+
var nextSetting = false;
|
318 |
+
}
|
319 |
+
|
320 |
+
if (cnt == 0){
|
321 |
+
this.fillSelect(this.settings[cnt])
|
322 |
+
} else {
|
323 |
+
this.settings[cnt].disabled = true;
|
324 |
+
}
|
325 |
+
|
326 |
+
$(this.settings[cnt]).childSettings = childSettings.clone();
|
327 |
+
prevNextProduct[this.settings[cnt].config.id] = [prevSetting, nextSetting];
|
328 |
+
var optionId = this.settings[cnt].id;
|
329 |
+
var position = optionId.indexOf('-');
|
330 |
+
if ('-1' != position){
|
331 |
+
optionId = optionId.substring(position+1, optionId.lenght);
|
332 |
+
id = parseInt(optionId);
|
333 |
+
prevNextProduct[id] = [];
|
334 |
+
prevNextProduct[id][this.settings[cnt].config.id] = [prevSetting, nextSetting];
|
335 |
+
}
|
336 |
+
$(this.settings[cnt]).prevSetting = prevSetting;
|
337 |
+
$(this.settings[cnt]).nextSetting = nextSetting;
|
338 |
+
childSettings.push(this.settings[cnt]);
|
339 |
+
}
|
340 |
+
}
|
skin/frontend/base/default/js/cybage/swatches/css/swatches.css
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.attr-image
|
2 |
+
{
|
3 |
+
padding: 3px;
|
4 |
+
margin-right: 5px;
|
5 |
+
cursor:pointer;
|
6 |
+
}
|
7 |
+
|
8 |
+
#swatches-block{
|
9 |
+
clear:both;
|
10 |
+
}
|
11 |
+
.input-box{
|
12 |
+
padding-bottom:10px;
|
13 |
+
}
|
14 |
+
.swatch-title{
|
15 |
+
font-weight: 600;
|
16 |
+
position: absolute;
|
17 |
+
padding-left: 3px;
|
18 |
+
}
|
19 |
+
|
20 |
+
.attr-image-selected
|
21 |
+
{
|
22 |
+
padding: 0px;
|
23 |
+
border: 3px solid rgb(56,114,187);
|
24 |
+
}
|
25 |
+
|
26 |
+
.main-swatch-container
|
27 |
+
{
|
28 |
+
width: 100%;
|
29 |
+
clear: both;
|
30 |
+
}
|
31 |
+
|
32 |
+
.attr-image-container
|
33 |
+
{
|
34 |
+
float:left;
|
35 |
+
position:relative;
|
36 |
+
text-align: center;
|
37 |
+
}
|
38 |
+
|
39 |
+
.no-display{
|
40 |
+
display: none !important;
|
41 |
+
}
|
42 |
+
|
43 |
+
.swatches-separator{
|
44 |
+
clear: both;
|
45 |
+
}
|
46 |
+
|
47 |
+
.tier-prices{
|
48 |
+
clear:both;
|
49 |
+
padding:10px 0 10px;
|
50 |
+
}
|
51 |
+
.product-image img {
|
52 |
+
width: 100%;
|
53 |
+
}
|