Magento extra role field

Please LogIn to Reply!

Post By: admin | 26-01-2012 06:35 Reply

I have added an extra field in the admin_role table in magento called limit_products. I have also added an extra field into the magento backend, and using the admin_permissions_role_prepare_save event I set this field to either 1 or 0, using the function below. However, it doesn't seem to want to save this field at all. Any ideas what I am doing wrong? I even tried setting the field in RoleController.php (where the other fields are set), but no luck. Anyone know what I'm doing wrong?

public function adminPermissionsRolePrepareSave(Varien_Event_Observer $observer) {
    $role = $observer->getEvent()->getObject();
    $request = $observer->getEvent()->getRequest();
    //fb($request);
    $role->setLimitProducts((bool)$request->getPost('limit_products', false));
    return $this;
}

EDIT: I just realised I forgot to mention that $request->getPost('limit_products', false); does return the right value, it's just the $role->setLimitProducts(); isn't saving it. Also when I do $role->getLimitProducts(); it does return the right value.

`Reply Or Comment!
Please LogIn to Reply!