Magentoのインストールを1.4.1.0から1.7.0.2にアップグレードしました。カテゴリを編集しようとするとエラーが発生します。
エラーは次のように述べています。
Fatal error: Call to a member function getAttributeCode() on a non-object in /home/.../domains/.../public_html/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php on line 137
同じ問題についてフォーラムでいくつかのトピックを見つけましたが、解決策はありませんでした。ここでも解決策を見つけることができませんでした。
古いバージョンのAttributes.phpと新しいバージョンを比較すると、唯一の違いはこのコードブロック(132行目から145行目)です。
if ($this->getCategory()->getLevel() == 1) {
$fieldset->removeField('custom_use_parent_settings');
} else {
if ($this->getCategory()->getCustomUseParentSettings()) {
foreach ($this->getCategory()->getDesignAttributes() as $attribute) {
if ($element = $form->getElement($attribute->getAttributeCode())) {
$element->setDisabled(true);
}
}
}
if ($element = $form->getElement('custom_use_parent_settings')) {
$element->setData('onchange', 'onCustomUseParentChanged(this)');
}
}
このブロック全体をコメントアウトすると、すべてが正常に機能しているようです。しかし、より良い修正はありますか?私は実際にはこのコードブロックの目的を理解していません。