It looks like you're new here. If you want to get involved, click one of these buttons!
Hello,
I have a simple products module.
When the user creates a product, I want one of the fields to be save in uppercase to the database.
I think I should use the model hook: on_before_save but I can't find any example of where to put this hook and how to actually use it.
Do I put in the the products model file? Where? how?
Can anyone point me to the right documentation or give me an example on how to use this hook?
Comments
Found the answer, thx
In the products_model file, under:
class Products_model extends Base_module_model {
I added this function:
public function on_before_save($values) { $values = parent::on_before_save($values); $values['product_code'] = strtoupper($values['product_code']); return $values; }