nimb0z Posted May 24, 2008 Share Posted May 24, 2008 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); } what do I need to change to set the default value as 10? Any help appreciated. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/107081-help-setting-a-default-value/ Share on other sites More sharing options...
.josh Posted May 24, 2008 Share Posted May 24, 2008 Looks like you need to find where $val is being set, and change that from 0 to 10. But this smells like 3rd party code to me, so I am moving it there. I suggest you respond by posting what 3rd party script you're using, cross your fingers and hope someone knows about it there...or go to their support forum. Quote Link to comment https://forums.phpfreaks.com/topic/107081-help-setting-a-default-value/#findComment-548977 Share on other sites More sharing options...
nimb0z Posted May 24, 2008 Author Share Posted May 24, 2008 Oh, how do I know where its being stored? Yea, its a custom script. The coder will return on monday, but I needed this fixed asap. Quote Link to comment https://forums.phpfreaks.com/topic/107081-help-setting-a-default-value/#findComment-548983 Share on other sites More sharing options...
.josh Posted May 24, 2008 Share Posted May 24, 2008 You have to go through the script(s) and look for some kind of $val = blah sort of line. Quote Link to comment https://forums.phpfreaks.com/topic/107081-help-setting-a-default-value/#findComment-549049 Share on other sites More sharing options...
nimb0z Posted May 24, 2008 Author Share Posted May 24, 2008 Yea, there're a few: function arrayFromAssoc( $assoc, $value, $key = null ) { $temp = array(); for( $i=0; $i<count( $assoc ); $i++ ) { $val = strlen( $key ) ? $assoc[$i][$key] : $i; $temp[$val] = $assoc[$i][$value]; } return $temp; } and // javascript escape a value function sajax_esc($val) { $val = str_replace("\\", "\\\\", $val); $val = str_replace("\r", "\\r", $val); $val = str_replace("\n", "\\n", $val); $val = str_replace("'", "\\'", $val); return str_replace('"', '\\"', $val); } Quote Link to comment https://forums.phpfreaks.com/topic/107081-help-setting-a-default-value/#findComment-549057 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.