Hi, Currently all products have no/0 value, but I want to modify it to have 10 as default value. This is the code currently: /** * Sets the product rate field * * @param string $val the value to be put in product_rate */ function setProductRate($val) { $this->set('product_rate', $val); } Code (markup): what do I need to change to set the default value as 10? Any help appreciated. Thanks
Hi. Are these products you speak of instances of a class? Anyway, you could do the following: function setProductRate($val) { if (!$val) $val = 10; $this->set('product_rate', $val); } Code (markup): .. but you would still have to call the function for each product. If a product is a class, it usually has a constructor function where you can set the default product_rate. You can also call the original function by passing 10 as argument: setProductRate(10); Code (markup): /LTar