Oscommerce, Solve UPS Error – “Call to undefined function tep_cfg_select_multioption()”

Before three days we have got “Fatal error: Call to undefined function tep_cfg_select_multioption() in /admin/modules.php(221) : eval()’d code on line 1” error while trying to edit the United Parcel Service (UPS) module configuration from our site admin.

And we have got solution of that, so we are sharing that solution.

Here the first question is: why this error has occurred? And what is the solution of it?

Here the error is saying “Call to undefined function tep_cfg_select_multioption()”, it means PHP doesn’t know anything about “tep_cfg_select_multioption()” function.

And this was happened because we didn’t add “tep_cfg_select_multioption()” function in “/admin/includes/functions/general.php” file.

Now to solve this problem just follow the under given two steps.

Step-1:

Add the following code to /admin/includes/functions/general.php, at the end just before the final “?>”:

// Alias function for array of configuration values in the Administration Tool
function tep_cfg_select_multioption($select_array, $key_value, $key = '') {
for ($i=0; $i<sizeof($select_array); $i++) {
$name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');
$string .= '<br><input type="checkbox" name="' . $name . '" value="' . $select_array[$i] . '"';
$key_values = explode( ", ", $key_value);
if ( in_array($select_array[$i], $key_values) ) $string .= 'CHECKED';
$string .= '> ' . $select_array[$i];
}
return $string;
}
//

Step-2:

In /admin/modules.php, around line 37 replace:

case 'save':
while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {
tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key . "'");
}

With

case 'save':
while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {
if( is_array( $value ) ) $value = implode( ", ", $value);
tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key . "'");
}

That’s it.

Hope this will help you.

Advertisements

Speak Your Mind

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: