diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php index 31734b83395..4f865355dc8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php @@ -23,7 +23,6 @@ class Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery extends Varien_Da { public function getElementHtml() { - //$html.= $this->getAfterElementHtml(); return $this->getContentHtml(); } @@ -38,7 +37,8 @@ public function getContentHtml() $content = Mage::getSingleton('core/layout') ->createBlock('adminhtml/catalog_product_helper_form_gallery_content'); - $content->setId($this->getHtmlId() . '_content') + $content + ->setId($this->getHtmlId() . '_content') ->setElement($this); return $content->toHtml(); } @@ -66,19 +66,31 @@ public function canDisplayUseDefault($attribute) /** * Check default value usage fact * - * @param Mage_Eav_Model_Entity_Attribute $attribute + * @param Mage_Eav_Model_Entity_Attribute|string $attribute * @return bool */ public function usedDefault($attribute) { - $attributeCode = $attribute->getAttributeCode(); - $defaultValue = $this->getDataObject()->getAttributeDefaultValue($attributeCode); + if (is_string($attribute)) { + $attributeCode = $attribute; + } else { + $attributeCode = $attribute->getAttributeCode(); + } + // special management for "label" and "position" since they're columns of the + // catalog_product_entity_media_gallery_value database table + if ($attributeCode == "label" || $attributeCode == "position") { + $media_gallery = $this->getDataObject()->getMediaGallery(); + if (!count($media_gallery["images"])) { + return true; + } + return $media_gallery["images"][0]["{$attributeCode}_use_default"]; + } + + $defaultValue = $this->getDataObject()->getAttributeDefaultValue($attributeCode); if (!$this->getDataObject()->getExistsStoreValueFlag($attributeCode)) { return true; - } elseif ($this->getValue() == $defaultValue && - $this->getDataObject()->getStoreId() != $this->_getDefaultStoreId() - ) { + } elseif ($this->getValue() == $defaultValue && $this->getDataObject()->getStoreId() != $this->_getDefaultStoreId()) { return false; } if ($defaultValue === false && !$attribute->getIsRequired() && $this->getValue()) { diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php index a10f7e2e719..c5fc49a0e20 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php @@ -579,9 +579,6 @@ protected function _initProductSave() $this->_filterStockData($productData['stock_data']); } - /** - * Websites - */ if (!isset($productData['website_ids'])) { $productData['website_ids'] = []; } diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php index 8acf4472eb4..3b58e89d5a3 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php @@ -43,7 +43,10 @@ public function afterLoad($object) foreach ($this->_getResource()->loadGallery($object, $this) as $image) { foreach ($localAttributes as $localAttribute) { if (is_null($image[$localAttribute])) { + $image[$localAttribute . '_use_default'] = true; $image[$localAttribute] = $this->_getDefaultValue($localAttribute, $image); + } else { + $image[$localAttribute . '_use_default'] = false; } } $value['images'][] = $image; @@ -107,6 +110,10 @@ public function beforeSave($object) $value['images'] = Mage::helper('core')->jsonDecode($value['images']); } + if (!is_array($value['values']) && strlen($value['values']) > 0) { + $value['values'] = Mage::helper('core')->jsonDecode($value['values']); + } + if (!is_array($value['images'])) { $value['images'] = []; } @@ -119,11 +126,11 @@ public function beforeSave($object) if (!empty($image['removed'])) { $clearImages[] = $image['file']; } elseif (!isset($image['value_id'])) { - $newFile = $this->_moveImageFromTmp($image['file']); + $newFile = $this->_moveImageFromTmp($image['file']); $image['new_file'] = $newFile; $newImages[$image['file']] = $image; $this->_renamedImages[$image['file']] = $newFile; - $image['file'] = $newFile; + $image['file'] = $newFile; } else { $existImages[$image['file']] = $image; } @@ -142,8 +149,6 @@ public function beforeSave($object) ]; $duplicate[$image['value_id']] = $newFile; } - - $value['duplicate'] = $duplicate; } foreach ($object->getMediaAttributes() as $mediaAttribute) { @@ -157,21 +162,21 @@ public function beforeSave($object) if (in_array($attrData, $clearImages)) { $object->setData($mediaAttrCode, 'no_selection'); } + } + foreach ($value['values'] as $mediaAttrCode => $attrData) { if (array_key_exists($attrData, $newImages)) { $object->setData($mediaAttrCode, $newImages[$attrData]['new_file']); - $object->setData($mediaAttrCode . '_label', $newImages[$attrData]['label']); + $object->setData($mediaAttrCode . '_label', ($newImages[$attrData]['label'] === null || $newImages[$attrData]['label_use_default']) ? $newImages[$attrData]['label_default'] : $newImages[$attrData]['label']); } if (array_key_exists($attrData, $existImages)) { - $object->setData($mediaAttrCode . '_label', $existImages[$attrData]['label']); + $object->setData($mediaAttrCode . '_label', ($existImages[$attrData]['label'] === null || $existImages[$attrData]['label_use_default']) ? $existImages[$attrData]['label_default'] : $existImages[$attrData]['label']); } } Mage::dispatchEvent('catalog_product_media_save_before', ['product' => $object, 'images' => $value]); - $object->setData($attrCode, $value); - return $this; } @@ -204,7 +209,6 @@ public function afterSave($object) } $storeId = $object->getStoreId(); - $storeIds = $object->getStoreIds(); $storeIds[] = Mage_Core_Model_App::ADMIN_STORE_ID; @@ -243,8 +247,8 @@ public function afterSave($object) // Add per store labels, position, disabled $data = []; $data['value_id'] = $image['value_id']; - $data['label'] = $image['label']; - $data['position'] = (int) $image['position']; + $data['label'] = ($image['label'] === null || $image["label_use_default"]) ? null : $image['label']; + $data['position'] = ($image['position'] === null || $image["position_use_default"]) ? null : (int) $image['position']; $data['disabled'] = (int) $image['disabled']; $data['store_id'] = (int) $object->getStoreId(); diff --git a/app/design/adminhtml/default/default/template/catalog/product/helper/gallery.phtml b/app/design/adminhtml/default/default/template/catalog/product/helper/gallery.phtml index d68c7467583..3b382e519cc 100644 --- a/app/design/adminhtml/default/default/template/catalog/product/helper/gallery.phtml +++ b/app/design/adminhtml/default/default/template/catalog/product/helper/gallery.phtml @@ -13,103 +13,138 @@ * @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> - - -
- -
- - - - - getImageTypes() as $typeId=>$type): ?> - - - - - - - - - - getImageTypes() as $typeId => $type): ?> - +
+
    +
  • +
      +
    • + __('Image type and information need to be specified for each store view.'); ?> +
    • +
    +
  • +
+
+
__('Image') ?>__('Label') ?>__('Sort Order') ?>escapeHtml($type['label'], ['br']); ?>
+ + + + getImageTypes() as $typeId => $type): ?> + - - - - - - - - - - getImageTypes() as $typeId=>$type): ?> - + + + + + + + + getImageTypes() as $typeId => $type): ?> + - - - - hasUseDefault()): ?> - - - - - getMediaAttributes() as $_attribute): ?> - + + + + + + + + + + getImageTypes() as $typeId => $type): ?> + - - - - - + + + + hasUseDefault()): ?> + + + + + getMediaAttributes() as $_attribute): ?> + + + + + + + - - - getImageTypes() as $typeId=>$type): ?> - + + + getImageTypes() as $typeId => $type): ?> + - - - - -getElement()->getReadonly()):?> - - - - - - -
__('Exclude') ?>__('Remove') ?>
__('Roll Over for preview') ?>
getElement()->getReadonly()):?> disabled="disabled" class="input-text" onkeyup="getJsObjectName(); ?>.updateImage('__file__')" onchange="getJsObjectName(); ?>.updateImage('__file__')" />getElement()->getReadonly()):?> disabled="disabled" class="input-text validate-number" onkeyup="getJsObjectName(); ?>.updateImage('__file__')" onchange="getJsObjectName(); ?>.updateImage('__file__')" />getElement()->getAttributeReadonly($typeId)) :?> disabled="disabled" type="radio" name="" onclick="getJsObjectName(); ?>.setProductImages('__file__')" value="__file__" />
__('Image') ?>__('Label') ?>__('Sort Order') ?>escapeHtml($type['label'], array('br')); ?> getElement()->getReadonly()):?> disabled="disabled" onclick="getJsObjectName(); ?>.updateImage('__file__')" />getElement()->getReadonly()):?> disabled="disabled" onclick="getJsObjectName(); ?>.updateImage('__file__')" />
__('Use Default Value') ?>   - getElement()->canDisplayUseDefault($_attribute)): ?> - getElement()->getAttributeReadonly($_attribute->getAttributeCode())):?> disabled="disabled" onclick="getJsObjectName(); ?>.updateUseDefault()" -getElement()->usedDefault($_attribute)): ?>checked value="getAttributeCode() ?>" /> - - __('Exclude') ?>__('Remove') ?>
+
+ __('Roll Over for preview') ?>
+
getElement()->getReadonly()): ?> disabled="disabled" + class="input-text" + onkeyup="getJsObjectName(); ?>.updateImage('__file__')" + onchange="getJsObjectName(); ?>.updateImage('__file__')"/>getElement()->getReadonly()): ?> disabled="disabled" + class="input-text validate-number" + onkeyup="getJsObjectName(); ?>.updateImage('__file__')" + onchange="getJsObjectName(); ?>.updateImage('__file__')"/> + getElement()->getAttributeReadonly($typeId)) : ?> disabled="disabled" + type="radio" name="" + onclick="getJsObjectName(); ?>.setProductImages('__file__')" + value="__file__"/>   
getElement()->getReadonly()): ?> disabled="disabled" + onclick="getJsObjectName(); ?>.updateImage('__file__')"/>getElement()->getReadonly()): ?> disabled="disabled" + onclick="getJsObjectName(); ?>.updateImage('__file__')"/>
__('Use Default Value') ?> + getElement()->getAttributeReadonly("label")): ?> disabled="disabled" + onclick="getJsObjectName(); ?>.updateUseDefault(this)" + getElement()->usedDefault("label")): ?>checked + value="label"/> + + getElement()->getAttributeReadonly("position")): ?> disabled="disabled" + onclick="getJsObjectName(); ?>.updateUseDefault(this)" + getElement()->usedDefault("position")): ?>checked + value="position"/> + + getElement()->canDisplayUseDefault($_attribute)): ?> + getElement()->getAttributeReadonly($_attribute->getAttributeCode())): ?> disabled="disabled" + onclick="getJsObjectName(); ?>.updateUseDefault()" + getElement()->usedDefault($_attribute)): ?>checked + value="getAttributeCode() ?>"/> + +   
__('No image') ?>  getElement()->getAttributeReadonly($typeId)) :?> disabled="disabled" name="" onclick="getJsObjectName(); ?>.setProductImages('no_selection')" value="no_selection" />  getElement()->getAttributeReadonly($typeId)) : ?> disabled="disabled" + name="" + onclick="getJsObjectName(); ?>.setProductImages('no_selection')" + value="no_selection"/>   
- __('Maximum width and height dimension for upload image is %s.', Mage::getStoreConfig(Mage_Catalog_Helper_Image::XML_NODE_PRODUCT_MAX_DIMENSION)); ?> - getUploaderHtml() ?> -
-
+   +   + + + getElement()->getReadonly()): ?> + + + + __('Maximum width and height dimension for upload image is %s.', Mage::getStoreConfig(Mage_Catalog_Helper_Image::XML_NODE_PRODUCT_MAX_DIMENSION)); ?> + getUploaderHtml() ?> + + + + + +
- - + + diff --git a/js/mage/adminhtml/product.js b/js/mage/adminhtml/product.js index 2227122afda..86f0de7ad52 100644 --- a/js/mage/adminhtml/product.js +++ b/js/mage/adminhtml/product.js @@ -16,21 +16,21 @@ var Product = {}; Product.Gallery = Class.create(); Product.Gallery.prototype = { - images : [], - file2id : { - 'no_selection' :0 - }, - idIncrement :1, - containerId :'', - container :null, - imageTypes : {}, - initialize : function(containerId, imageTypes) { + images: [], + file2id: { + 'no_selection': 0 + }, + idIncrement: 1, + containerId: '', + container: null, + imageTypes: {}, + initialize: function (containerId, imageTypes) { this.containerId = containerId, this.container = $(this.containerId); this.imageTypes = imageTypes; - document.on('uploader:fileSuccess', function(event) { + document.on('uploader:fileSuccess', function (event) { var memo = event.memo; - if(memo && this._checkCurrentContainer(memo.containerId)) { + if (memo && this._checkCurrentContainer(memo.containerId)) { this.handleUploadComplete([{response: memo.response}]); } }.bind(this)); @@ -38,19 +38,19 @@ Product.Gallery.prototype = { this.images = this.getElement('save').value.evalJSON(); this.imagesValues = this.getElement('save_image').value.evalJSON(); this.template = new Template('' + this - .getElement('template').innerHTML + '', new RegExp( - '(^|.|\\r|\\n)(__([a-zA-Z0-9_]+)__)', '')); + .getElement('template').innerHTML + '', new RegExp( + '(^|.|\\r|\\n)(__([a-zA-Z0-9_]+)__)', '')); this.fixParentTable(); this.updateImages(); varienGlobalEvents.attachEventHandler('moveTab', this.onImageTabMove - .bind(this)); + .bind(this)); }, - _checkCurrentContainer: function(child) { + _checkCurrentContainer: function (child) { return $(this.containerId).down('#' + child); }, - onImageTabMove : function(event) { + onImageTabMove: function (event) { var imagesTab = false; - this.container.ancestors().each( function(parentItem) { + this.container.ancestors().each(function (parentItem) { if (parentItem.tabObject) { imagesTab = parentItem.tabObject; throw $break; @@ -58,15 +58,15 @@ Product.Gallery.prototype = { }.bind(this)); if (imagesTab && event.tab && event.tab.name && imagesTab.name == event.tab.name) { - this.container.select('input[type="radio"]').each(function(radio) { + this.container.select('input[type="radio"]').each(function (radio) { radio.observe('change', this.onChangeRadio); }.bind(this)); this.updateImages(); } }, - fixParentTable : function() { - this.container.ancestors().each( function(parentItem) { + fixParentTable: function () { + this.container.ancestors().each(function (parentItem) { if (parentItem.tagName.toLowerCase() == 'td') { parentItem.style.width = '100%'; } @@ -76,15 +76,15 @@ Product.Gallery.prototype = { } }); }, - getElement : function(name) { + getElement: function (name) { return $(this.containerId + '_' + name); }, - showUploader : function() { + showUploader: function () { this.getElement('add_images_button').hide(); this.getElement('uploader').show(); }, - handleUploadComplete : function(files) { - files.each( function(item) { + handleUploadComplete: function (files) { + files.each(function (item) { if (!item.response.isJSON()) { try { console.log(item.response); @@ -109,14 +109,12 @@ Product.Gallery.prototype = { this.container.setHasChanges(); this.updateImages(); }, - updateImages : function() { + updateImages: function () { this.getElement('save').value = Object.toJSON(this.images); - $H(this.imageTypes).each( - function(pair) { - this.getFileElement('no_selection', - 'cell-' + pair.key + ' input').checked = true; - }.bind(this)); - this.images.each( function(row) { + $H(this.imageTypes).each(function (pair) { + this.getFileElement('no_selection', 'cell-' + pair.key + ' input').checked = true; + }.bind(this)); + this.images.each(function (row) { if (!$(this.prepareId(row.file))) { this.createImageRow(row); } @@ -128,92 +126,111 @@ Product.Gallery.prototype = { var element = Event.element(evt); element.setHasChanges(); }, - createImageRow : function(image) { + createImageRow: function (image) { var vars = Object.clone(image); vars.id = this.prepareId(image.file); var html = this.template.evaluate(vars); Element.insert(this.getElement('list'), { - bottom :html + bottom: html }); - $(vars.id).select('input[type="radio"]').each(function(radio) { + $(vars.id).select('input[type="radio"]').each(function (radio) { radio.observe('change', this.onChangeRadio); }.bind(this)); }, - prepareId : function(file) { + prepareId: function (file) { if (typeof this.file2id[file] == 'undefined') { this.file2id[file] = this.idIncrement++; } return this.containerId + '-image-' + this.file2id[file]; }, - getNextPosition : function() { + getNextPosition: function () { var maxPosition = 0; - this.images.each( function(item) { + this.images.each(function (item) { if (parseInt(item.position) > maxPosition) { maxPosition = parseInt(item.position); } }); return maxPosition + 1; }, - updateImage : function(file) { + updateImage: function (file) { var index = this.getIndexByFile(file); - this.images[index].label = this - .getFileElement(file, 'cell-label input').value; - this.images[index].position = this.getFileElement(file, - 'cell-position input').value; - this.images[index].removed = (this.getFileElement(file, - 'cell-remove input').checked ? 1 : 0); - this.images[index].disabled = (this.getFileElement(file, - 'cell-disable input').checked ? 1 : 0); + + var use_default_label = document.getElementById("use_default_label"); + if (use_default_label && use_default_label.checked) { + this.images[index].label = null; + this.images[index].label_use_default = true; + } else { + this.images[index].label = this.getFileElement(file, 'cell-label input').value; + this.images[index].label_use_default = false; + } + + var use_default_position = document.getElementById("use_default_position"); + if (use_default_position && use_default_position.checked) { + this.images[index].position = null; + this.images[index].position_use_default = true; + } else { + this.images[index].position = this.getFileElement(file, 'cell-position input').value; + this.images[index].position_use_default = false; + } + + this.images[index].removed = (this.getFileElement(file, 'cell-remove input').checked ? 1 : 0); + this.images[index].disabled = (this.getFileElement(file, 'cell-disable input').checked ? 1 : 0); this.getElement('save').value = Object.toJSON(this.images); this.updateState(file); this.container.setHasChanges(); }, - loadImage : function(file) { + loadImage: function (file) { var image = this.getImageByFile(file); this.getFileElement(file, 'cell-image img').src = image.url; this.getFileElement(file, 'cell-image img').show(); this.getFileElement(file, 'cell-image .place-holder').hide(); }, - setProductImages : function(file) { + setProductImages: function (file) { $H(this.imageTypes) - .each( - function(pair) { - if (this.getFileElement(file, - 'cell-' + pair.key + ' input').checked) { - this.imagesValues[pair.key] = (file == 'no_selection' ? null - : file); - } - }.bind(this)); + .each( + function (pair) { + if (this.getFileElement(file, + 'cell-' + pair.key + ' input').checked) { + this.imagesValues[pair.key] = (file == 'no_selection' ? null + : file); + } + }.bind(this)); this.getElement('save_image').value = Object.toJSON($H(this.imagesValues)); }, - updateVisualisation : function(file) { + updateVisualisation: function (file) { var image = this.getImageByFile(file); - this.getFileElement(file, 'cell-label input').value = image.label; - this.getFileElement(file, 'cell-position input').value = image.position; + + var use_default_label = document.getElementById("use_default_label"); + if(use_default_label && use_default_label.checked) { + this.getFileElement(file, 'cell-label input').value = image.label_default; + } else { + this.getFileElement(file, 'cell-label input').value = image.label; + } + + var use_default_position = document.getElementById("use_default_position"); + if(use_default_position && use_default_position.checked) { + this.getFileElement(file, 'cell-position input').value = image.position_default; + } else { + this.getFileElement(file, 'cell-position input').value = image.position; + } + this.getFileElement(file, 'cell-remove input').checked = (image.removed == 1); this.getFileElement(file, 'cell-disable input').checked = (image.disabled == 1); - $H(this.imageTypes) - .each( - function(pair) { - if (this.imagesValues[pair.key] == file) { - this.getFileElement(file, - 'cell-' + pair.key + ' input').checked = true; - } - }.bind(this)); + $H(this.imageTypes).each(function (pair) { + if (this.imagesValues[pair.key] == file) { + this.getFileElement(file, 'cell-' + pair.key + ' input').checked = true; + } + }.bind(this)); this.updateState(file); }, - updateState : function(file) { - if (this.getFileElement(file, 'cell-disable input').checked) { - this.getFileElement(file, 'cell-position input').disabled = true; - } else { - this.getFileElement(file, 'cell-position input').disabled = false; - } + updateState: function (file) { + // deprecated }, - getFileElement : function(file, element) { + getFileElement: function (file, element) { var selector = '#' + this.prepareId(file) + ' .' + element; - var elems = $$(selector); + var elems = document.querySelectorAll(selector); if (!elems[0]) { try { console.log(selector); @@ -222,65 +239,68 @@ Product.Gallery.prototype = { } } - return $$('#' + this.prepareId(file) + ' .' + element)[0]; + return elems[0]; }, - getImageByFile : function(file) { + getImageByFile: function (file) { if (this.getIndexByFile(file) === null) { return false; } return this.images[this.getIndexByFile(file)]; }, - getIndexByFile : function(file) { + getIndexByFile: function (file) { var index; - this.images.each( function(item, i) { + this.images.each(function (item, i) { if (item.file == file) { index = i; } }); return index; }, - updateUseDefault : function() { - if (this.getElement('default')) { - this.getElement('default').select('input').each( - function(input) { - $(this.containerId).select( - '.cell-' + input.value + ' input').each( - function(radio) { - radio.disabled = input.checked; - }); - }.bind(this)); + updateUseDefault: function (el) { + var inputs = document.querySelectorAll('#' + this.containerId + '_default td input'); + for (var i=0; i
' - }); + if (select.value && !$('simple_product_' + attributeCode + '_pricing_container')) { + Element.insert(select, { + after: '
' + }); var newContainer = select.next('div'); select.parentNode.removeChild(select); newContainer.appendChild(select); @@ -926,8 +924,7 @@ Product.Configurable.prototype = { } container.update(this.pricingValueTemplate.evaluate(value)); var priceValueField = container.down('.attribute-price'); - var priceTypeField = container - .down('.attribute-price-type'); + var priceTypeField = container.down('.attribute-price-type'); priceValueField.attributeCode = attributeCode; priceValueField.priceField = priceValueField; @@ -937,21 +934,18 @@ Product.Configurable.prototype = { priceTypeField.priceField = priceValueField; priceTypeField.typeField = priceTypeField; - Event.observe(priceValueField, 'change', - this.updateSimplePricing.bindAsEventListener(this)); - Event.observe(priceValueField, 'keyup', - this.updateSimplePricing.bindAsEventListener(this)); - Event.observe(priceTypeField, 'change', - this.updateSimplePricing.bindAsEventListener(this)); + Event.observe(priceValueField, 'change', this.updateSimplePricing.bindAsEventListener(this)); + Event.observe(priceValueField, 'keyup', this.updateSimplePricing.bindAsEventListener(this)); + Event.observe(priceTypeField, 'change', this.updateSimplePricing.bindAsEventListener(this)); $('simple_product_' + attributeCode + '_pricing_value').value = null; $('simple_product_' + attributeCode + '_pricing_type').value = null; } } else if (!isNaN(parseFloat(value.pricing_value))) { - container.update(this.pricingValueViewTemplate.evaluate( { - 'value' :(parseFloat(value.pricing_value) > 0 ? '+' : '') - + parseFloat(value.pricing_value) - + (parseInt(value.is_percent) > 0 ? '%' : '') + container.update(this.pricingValueViewTemplate.evaluate({ + 'value': (parseFloat(value.pricing_value) > 0 ? '+' : '') + + parseFloat(value.pricing_value) + + (parseInt(value.is_percent) > 0 ? '%' : '') })); $('simple_product_' + attributeCode + '_pricing_value').value = value.pricing_value; $('simple_product_' + attributeCode + '_pricing_type').value = value.is_percent; @@ -966,7 +960,7 @@ Product.Configurable.prototype = { $('simple_product_' + attributeCode + '_pricing_type').value = null; } }, - updateSimplePricing : function(evt) { + updateSimplePricing: function (evt) { var element = Event.element(evt); if (!element.priceField.value.blank()) { $('simple_product_' + element.attributeCode + '_pricing_value').value = element.priceField.value; @@ -976,16 +970,16 @@ Product.Configurable.prototype = { $('simple_product_' + element.attributeCode + '_pricing_type').value = null; } }, - updateSimpleForm : function() { - this.attributes.each( function(attribute) { + updateSimpleForm: function () { + this.attributes.each(function (attribute) { if ($('simple_product_' + attribute.attribute_code)) { this.showPricing( - $('simple_product_' + attribute.attribute_code), - attribute.attribute_code); + $('simple_product_' + attribute.attribute_code), + attribute.attribute_code); } }.bind(this)); }, - showNoticeMessage : function() { + showNoticeMessage: function () { $('assign_product_warrning').show(); } }; @@ -1023,7 +1017,7 @@ function initDisableFields(fieldContainer) { } function onCompleteDisableInited() { - onInitDisableFieldsList.each( function(item) { + onInitDisableFieldsList.each(function (item) { disableFieldEditMode(item); }); } @@ -1039,12 +1033,12 @@ function onUrlkeyChanged(urlKey) { function onCustomUseParentChanged(element) { var useParent = (element.value == 1) ? true : false; - element.up(2).select('input', 'select', 'textarea').each(function(el){ + element.up(2).select('input', 'select', 'textarea').each(function (el) { if (element.id != el.id) { el.disabled = useParent; } }); - element.up(2).select('img').each(function(el){ + element.up(2).select('img').each(function (el) { if (useParent) { el.hide(); } else {