Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. document.observe('dom:loaded', function(){
  2. var bodyClass = $('html-body').classNames().toString();
  3. if (bodyClass == 'adminhtml-catalog-product-attribute-edit') {
  4. var map = {
  5. 2: 3, //DE
  6. 1: 17, //EN
  7. 10: 18, //FR
  8. 11: 19, //IT
  9. 12: 20 //ES
  10. }
  11.  
  12. var re = /option[value][(d+)][d+]/;
  13.  
  14. $H(map).each(function(pair){
  15. var sourceLabel = $$('input[name="frontend_label[' + pair.key + ']"]')[0];
  16. var targetLabel = $$('input[name="frontend_label[' + pair.value + ']"]')[0];
  17. if (targetLabel.readAttribute('value') != sourceLabel.readAttribute('value')) {
  18. targetLabel.setAttribute('value', sourceLabel.readAttribute('value'));
  19. targetLabel.setStyle({backgroundColor: 'lightgreen'});
  20. }
  21.  
  22. $$('input[name^="option[value]"][name$="[' + pair.key + ']"]').each(function(s){
  23. var sourceClass = s.readAttribute('name');
  24. var matches;
  25. if ((matches = re.exec(sourceClass)) !== null) {
  26. if (matches.index === re.lastIndex) {
  27. re.lastIndex++;
  28. }
  29. var sourceOption = s.readAttribute('value');
  30. var targetOption = $$('input[name="option[value][' + matches[1] + '][' + pair.value + ']')[0];
  31. if (targetOption.readAttribute('value') != sourceOption) {
  32. targetOption.setAttribute('value', sourceOption);
  33. targetOption.setStyle({backgroundColor: 'lightgreen'});
  34. }
  35. }
  36. });
  37. });
  38. }
  39. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement