Magento – überschreibt ungewollt Attribute bei “Update Attributes”

PictureIn einem Shop hatten wir das Problem, that in the use of “Update Attributes” (Catalog > Organizing articles > anhaken article and then top right of the drop “Update Attributes” select) also Attribute überschrieben bzw. geleert wurden, die gar nicht angehakt worden sind.

Example: Wir wollten für 10 Produkte die Mehrwertsteuer-Klasse ändern. For this, we hook them to the product list and select “Update Attributes”. Then we set at the Häcken “To change” and select the correct value. Anschließend dann speichern.

Nun wurde aber nicht nur das gewünschte Attribut verändert sondern bei vielen anderen Attributen wurde einfach der bisher vorhandene Wert entfernt / deleted.

Nach näherer Betrachtung -der Backend-Ansicht- turned out, that at the respective attributes, although not checked “To change” set, das Feld aber dennoch aktiv war. Dies konnte man an zwei Dingen sehen:

1. sind alle anderen Felder so lange ausgegraut, how not checked “To change” is set.
2. konnte man ohne den Haken zu setzen in den Feldern etwas eintragen oder auswählen

Setzte man nun nur kurz den Haken und entfernte ihn anschließend wieder (ohne eine Änderung vorzunehmen), wurde das Feld ausgegraut und nichts wurde verändert.

Anschließend schauten wir uns den Code an und stellten fest, it seems at a “Read-Only”-Attribute law, welches durch eine Extension erstellt worden war und welches nun auch in der Liste auftauchte bzw. diese durcheinanderbrachte.

The solution was now the “Read-Only”-Attributes of the “Update Attributes”-exclude list.

Dies haben wir dadurch erreicht, dass wir die Datei Attribute.php aus dem Ordner app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Edit/Action kopiert und in das Verzeichnis app/code/local/Mage/Adminhtml/Helper/Catalog/Product/Edit/Action kopiert haben. Anschließend wurde dann die Zeile

$this->_attributes->addFieldToFilter('frontend_input',array('neat' => 'label'));

hinter

if ($this->_excludedAttributes) {
$this->_attributes->addFieldToFilter('attribute_code', array('of' => $this->_excludedAttributes));
}

and before

// check product type apply to limitation and remove attributes that impossible to change in mass-update

inserted.

Dies verhindert, that the disturbing attribute type appears and the function “Update Attributes” durcheinander bringt.

Used in Magento versions 1.9 Comments? Additions? Notes? Gladly!

Published by Covos

Since 2009 I have been working intensively with Magento. I started with the creation and operation of B2C stores. This was extended through my work in the logistics sector. This resulted first specialized B2E systems. Today I work day-a day with exciting B2C, B2B- and B2E projects and reports in this blog about challenges and give insider tips.

Leave a Reply

Your email address will not be published. Required fields are marked *