0

So we have created a new store. Only to see that wee have to manually OPEN and COPY all product attributes Labels and Options 1 by 1. Storeview X already has the correct Labels and Options.

Question: Is there a method to copy ALL product attributes Labels and Options from a certain storeview and store them to the new storeview?

  • Loop over product attributes
  • Get value from root storeview = X
  • Copy to storeview = Y

enter image description here

0

You could try this sql query, just change your attribute ID and store id's.

UPDATE eav_attribute_option_value as t1
    INNER JOIN eav_attribute_option_value as t2
        ON t1.option_id = t2.option_id AND t2.store_id = 2
    SET t1.value = t2.value 
    WHERE t1.store_id = 4 AND t1.option_id IN (
    SELECT option_id FROM eav_attribute_option WHERE attribute_id = 235
    )
0

Somewhere I have a PHP script for this, but I could not find it actually ... (will update later ...hopefully)

Something we used in the past ...

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'});
                    }
                }
            });
        });
    }
});

You have to add this script to attribute edit page and adjust store IDs in var map. Not nice, but it works if you save your attributes manually...

  • Great!! Would be good also if m2 has something for this. I also have a working script for the label (not the options) and will post when behind laptop – snh_nl May 27 at 12:05
  • It has always surprised me that there is no option to do this language based. Of course maybe you want to override on a storeview level. But often for the same language you use the same values. – snh_nl May 27 at 12:06
  • @snh_nl if it is "great" there is a button ... ;) – sv3n Jun 25 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.