When setting the product to use the default value, setting the value to false would do it.

$product = Mage::getModel('catalog/product')
    ->setData($attr, false)

However, it appears that in category, this doesn't work? What am I missing?

$category = Mage::getModel('catalog/category')
    ->setData($attr, false)

This doesn't work either:

$category = Mage::getModel('catalog/category')->load($category_id);
  • Is the attribute on the category locked? Check with $category->isLockedAttribute($attr) – Robbie Averill Jun 1 '16 at 4:18
  • It's not locked, bool(false). – user1240207 Jun 1 '16 at 4:58

I was bumping into the same problem as you trying to change the 'display_mode'attribute for a category and when I used isLockedAttribute() I also got false as a result.

However I still went ahead and used $category->unlockAttribute('display_mode') and then $category->setDisplayMode(false) and it saved it correctly.

I still have no idea why it was reporting as unlocked while it was indeed locked but still Robbie's comment was spot on for my case. Maybe it will save someone else the headache if they have to face it like I did anyways.

| improve this answer | |

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.