Jump to content

Help setting a default value


nimb0z

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/107081-help-setting-a-default-value/
Share on other sites

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.

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);
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.