Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- document.observe('dom:loaded', function(){
- var bodyClass = $('html-body').classNames().toString();
- if (bodyClass == 'adminhtml-catalog-product-attribute-edit') {
- var map = {
- 2: 3, //DE
- 1: 17, //EN
- 10: 18, //FR
- 11: 19, //IT
- 12: 20 //ES
- }
- var re = /option[value][(d+)][d+]/;
- $H(map).each(function(pair){
- var sourceLabel = $$('input[name="frontend_label[' + pair.key + ']"]')[0];
- var targetLabel = $$('input[name="frontend_label[' + pair.value + ']"]')[0];
- if (targetLabel.readAttribute('value') != sourceLabel.readAttribute('value')) {
- targetLabel.setAttribute('value', sourceLabel.readAttribute('value'));
- targetLabel.setStyle({backgroundColor: 'lightgreen'});
- }
- $$('input[name^="option[value]"][name$="[' + pair.key + ']"]').each(function(s){
- var sourceClass = s.readAttribute('name');
- var matches;
- if ((matches = re.exec(sourceClass)) !== null) {
- if (matches.index === re.lastIndex) {
- re.lastIndex++;
- }
- var sourceOption = s.readAttribute('value');
- var targetOption = $$('input[name="option[value][' + matches[1] + '][' + pair.value + ']')[0];
- if (targetOption.readAttribute('value') != sourceOption) {
- targetOption.setAttribute('value', sourceOption);
- targetOption.setStyle({backgroundColor: 'lightgreen'});
- }
- }
- });
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement