KJexotics Posted May 21, 2008 Share Posted May 21, 2008 I need help i instilled this, but it does not work Says: Fatal error: Cannot redeclare tep_get_categories() (previously declared in /home/kjexotic/public_html/livefoods/includes/functions/general.php:513) in /home/kjexotic/public_html/livefoods/includes/functions/general.php on line 1327 Shop: http://livefoods.kjexotics.co.uk/ Contribution: http://www.oscommerce.com/community/contributions,4475 Quote Link to comment Share on other sites More sharing options...
KJexotics Posted May 21, 2008 Author Share Posted May 21, 2008 :( anyone Quote Link to comment Share on other sites More sharing options...
KJexotics Posted May 21, 2008 Author Share Posted May 21, 2008 Also in the admin area, for this It will not let me edit it, it says Warning: call_user_func(tep_cfg_show_multicategories) [function.call-user-func]: First argument is expected to be a valid callback in /home/kjexotic/public_html/livefoods/admin/includes/functions/general.php on line 1195 and Fatal error: Call to undefined function tep_cfg_select_multicategories() in /home/kjexotic/public_html/livefoods/admin/modules.php(345) : eval()'d code on line 1 Quote Link to comment Share on other sites More sharing options...
KJexotics Posted May 22, 2008 Author Share Posted May 22, 2008 anyone ??? Quote Link to comment Share on other sites More sharing options...
KJexotics Posted May 22, 2008 Author Share Posted May 22, 2008 anyone ??? It got somthing todo with this code ??? function tep_get_categories($categories_array = '', $parent_id = '0', $indent = '') { global $languages_id; if (!is_array($categories_array)) $categories_array = array(); $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $categories_array[] = array('id' => $categories['categories_id'], 'text' => $indent . $categories['categories_name']); if ($categories['categories_id'] != $parent_id) { $categories_array = tep_get_categories($categories_array, $categories['categories_id'], $indent . ' '); } } return $categories_array; } //allows selecting many categories a ta time function tep_cfg_select_multicategories($key_value = '', $key) { if (tep_not_null($key_value)) $value_array = explode(', ',$key_value); else $value_array = array(); $name = ((tep_not_null($key)) ? 'configuration[' . $key . ']' : 'configuration_value').'[]'; $string = tep_draw_pull_multiselect_menu($name,tep_get_categories(), $value_array,' size="8" '); return $string; } function tep_cfg_show_multicategories($key_value = ''){ global $languages_id; $cat_str = ''; if (tep_not_null($key_value)){ $value_array = explode(', ',$key_value); for($i=0, $x=sizeof($value_array); $i<$x; $i++){ $cat_str .= tep_get_category_name((int)$value_array[$i], $languages_id).', '; } $cat_str = substr($cat_str, 0, -2); } return $cat_str; } Quote Link to comment Share on other sites More sharing options...
KJexotics Posted May 25, 2008 Author Share Posted May 25, 2008 anyone ??? i have now removed that bit of the code so i can see the site, but the problem is still there. Quote Link to comment Share on other sites More sharing options...
Guest Posted June 13, 2008 Share Posted June 13, 2008 I'm having problems with this contribution also. I wonder if there's an official support thread for the contribution. Quote Link to comment Share on other sites More sharing options...
cmakynen Posted June 18, 2008 Share Posted June 18, 2008 (edited) I'm having problems with this contribution also. I wonder if there's an official support thread for the contribution. This is a little late response, but I had a similar problem too with this contrib. It wasn't a problem before, started recently and must have been broken by a contribution I installed somewhere along the way. Anyway, to solve a similar error, I pasted the following function into the admin/includes/functions/html_output.php, as it had gone missing (found the code in the readme of the contribution free shipping by categories v 1.3) function tep_draw_pull_multiselect_menu($name, $values, $defaults, $parameters = '') { $field = '<select multiple name="' . tep_output_string($name) . '"'; if (tep_not_null($parameters)) $field .= ' ' . $parameters; $field .= '>' . "\n"; if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]); for ($i = 0, $n = sizeof($values); $i < $n; $i++) { $field .= '<option value="' . tep_output_string($values[$i]['id']) . '"'; if (in_array($values[$i]['id'], $defaults)) { $field .= ' SELECTED'; } $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>'; } $field .= '</select>'; return $field; } Works now. You might be able to solve your problem by checking the functions that need to be added, listed in the readme of the most recent contrib. Edited June 18, 2008 by cmakynen Quote Link to comment Share on other sites More sharing options...
magicandmischief182 Posted June 30, 2009 Share Posted June 30, 2009 Bump, this never got resolved. Quote Link to comment Share on other sites More sharing options...
Guest Posted July 28, 2010 Share Posted July 28, 2010 The answer to your problem is most likely that you pasted the functions into the wrong files. I got the same error due to this. Make sure you differentiate between the catalog files and the admin files for html_output.php and general.php Quote Link to comment Share on other sites More sharing options...
RuelRota Posted August 11, 2011 Share Posted August 11, 2011 Hi guys, you should follow the step in the text file included in the package, the filename is functions-to-add-if-installing.txt Here is the content. copy-paste to your catalog. add to (if you dont have such function) catalog\includes\functions\general.php function tep_get_categories_name($cID, $language = ''){ global $languages_id; if (!tep_not_null($language)) $language = $languages_id; $cname = tep_db_fetch_array(tep_db_query('select categories_name from '.TABLE_CATEGORIES_DESCRIPTION.' where categories_id="'.$cID.'" and language_id="'.$language.'"')); return $cname['categories_name']; } add to admin/includes/functions/html_output.php function tep_draw_pull_multiselect_menu($name, $values, $defaults, $parameters = '') { $field = '<select multiple name="' . tep_output_string($name) . '"'; if (tep_not_null($parameters)) $field .= ' ' . $parameters; $field .= '>' . "\n"; if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]); for ($i = 0, $n = sizeof($values); $i < $n; $i++) { $field .= '<option value="' . tep_output_string($values[$i]['id']) . '"'; if (in_array($values[$i]['id'], $defaults)) { $field .= ' SELECTED'; } $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>'; } $field .= '</select>'; return $field; } add to admin/includes/functions/general.php function tep_get_categories($categories_array = '', $parent_id = '0', $indent = '') { global $languages_id; if (!is_array($categories_array)) $categories_array = array(); $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $categories_array[] = array('id' => $categories['categories_id'], 'text' => $indent . $categories['categories_name']); if ($categories['categories_id'] != $parent_id) { $categories_array = tep_get_categories($categories_array, $categories['categories_id'], $indent . ' '); } } return $categories_array; } //allows selecting many categories a ta time function tep_cfg_select_multicategories($key_value = '', $key) { if (tep_not_null($key_value)) $value_array = explode(', ',$key_value); else $value_array = array(); $name = ((tep_not_null($key)) ? 'configuration[' . $key . ']' : 'configuration_value').'[]'; $string = tep_draw_pull_multiselect_menu($name,tep_get_categories(), $value_array,' size="8" '); return $string; } function tep_cfg_show_multicategories($key_value = ''){ global $languages_id; $cat_str = ''; if (tep_not_null($key_value)){ $value_array = explode(', ',$key_value); for($i=0, $x=sizeof($value_array); $i<$x; $i++){ $cat_str .= tep_get_category_name((int)$value_array[$i], $languages_id).', '; } $cat_str = substr($cat_str, 0, -2); } return $cat_str; } FILE: admin\modules.php find: case 'save': while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) { after it add: ( only if you don't have such piece of code ) if( is_array( $value ) ){ $value = implode( ", ", $value); $value = ereg_replace (", --none--", "", $value); } install in admin, make some configuration work (see help there). thats all. Quote Link to comment Share on other sites More sharing options...
black_feather Posted October 23, 2013 Share Posted October 23, 2013 I had the same problem but there's just a minor error in html_ouput.php, this is how it should be add to admin/includes/functions/html_output.php function tep_draw_pull_multiselect_menu($name, $values, $defaults, $parameters = '') { $field = '<select multiple name="' . tep_output_string($name) . '"'; if (tep_not_null($parameters)) $field .= ' ' . $parameters; $field .= '>' . "\n"; if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]); for ($i = 0, $n = sizeof($values); $i < $n; $i++) { $field .= '<option value="' . tep_output_string($values[$i]['id']) . '"'; if (in_array($values[$i]['id'], $defaults)) { $field .= ' SELECTED'; } $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => '', '<' => '<', '>' => '>')) . '</option>'; } $field .= '</select>'; return $field; } Quote Link to comment 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.
Note: Your post will require moderator approval before it will be visible.