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
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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.