0

Ok so I've created a custom module that has a single table model with a active select (no, yes) and a title and image. Now when I save the title saves and updates fine, the image is deleted or updated correctly all works fine.

All apart from the yes/no select.

I added a vardump of the post data and i see the following:

 ["active"]=> string(1) "0" ["title"]=> string(9) "Test Item"

So the data is being passed to my saveAction method correctly (I assume it's supposed to be a string with values going up from 0). The following is what I've been using to save the post data which works fine for everything else.

$model = Mage::getModel("tester/tester")
                    ->addData($post_data)
                    ->setId($this->getRequest()->getParam("id"));
                    ->save();

That is the line after my vardump of the post data so I'm just very confused as to why this is not working, this is the same code I've used to add active and in acitve options to other modules and it's all working fine (I can even sort by the select in the admin view).

I did add the functionality via an update to the module but have since uninstalled it and tried it again with no success.

for reference I created the module using the silktouch module creator.

1

If you added the 'active' field using an update, after creating the module and using it, clear the cache. Even if the cache is disabled there are still some cached things. one of them is the 'describe' table statements. I think Zend Framework does these. When you try to save your entity the parameters in $_data are matched to the table fields. If you have an older version of the table cached your 'active' field is not present in the table structure and it's not matched. Let me know if this is it.

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.