grunionfab Posted April 5, 2007 Posted April 5, 2007 When I have a main category that has a sub category in it but no products in the main category i get this error: Fatal error: Call to undefined function: tep_array_values_to_string() in /home/grunionf/public_html/includes/modules/featured.php on line 37 It only happens when there is no products listed in the main cat. You can see it here on my site: http://grunionfabrication.com/sheet-metal-c-141.html i dont know when it started but it happened after some contribution but i dont really think it is affecting anything.... just looks bad.... Please help.
kirikintha Posted April 5, 2007 Posted April 5, 2007 You have to change it to allow a null value - either in the DB or in the code - jeez I can't remember where though... I am kinda done today I can't think anymore Nothing unreal exists
grunionfab Posted April 5, 2007 Author Posted April 5, 2007 You have to change it to allow a null value - either in the DB or in the code - jeez I can't remember where though... I am kinda done today I can't think anymore Thanks for the reply, I really dont know what that means though. I can paste up any code you might need to help me figure it out though.
Guest Posted April 5, 2007 Posted April 5, 2007 You have to re-check the installation instruction of the contribution you're using. Seems you did not change all files required for the module to run.
grunionfab Posted April 5, 2007 Author Posted April 5, 2007 You have to re-check the installation instruction of the contribution you're using. Seems you did not change all files required for the module to run. LOL the problem is I dont know which contribution that i installed started this problem and I dont know when it started..... I will paste the file that it says is having the problem. Line 37 is marked <?php /* osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License Featured Products V1.1 Displays a list of featured products, selected from admin For use as an Infobox instead of the "New Products" Infobox */ ?> <!-- featured_products //--> <?php if(FEATURED_PRODUCTS_DISPLAY == 'true') { $featured_products_category_id = $new_products_category_id; $cat_name_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $featured_products_category_id . "' limit 1"); $cat_name_fetch = tep_db_fetch_array($cat_name_query); $cat_name = $cat_name_fetch['categories_name']; $info_box_contents = array(); if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) { $info_box_contents[] = array('align' => 'left', 'text' => '<a class="headerNavigation" href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . TABLE_HEADING_FEATURED_PRODUCTS . '</a>'); list($usec, $sec) = explode(' ', microtime()); srand( (float) $sec + ((float) $usec * 100000) ); $mtm= rand(); $featured_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by rand($mtm) DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS); } else { $info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY, $cat_name)); $subcategories_array = array(); tep_get_subcategories($subcategories_array, $featured_products_category_id); LINE 37 $featured_products_category_id_list = tep_array_values_to_string($subcategories_array if ($featured_products_category_id_list == '') { $featured_products_category_id_list .= $featured_products_category_id; } else { $featured_products_category_id_list .= ',' . $featured_products_category_id; } $featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) left join " . TABLE_FEATURED . " f on p.products_id = f.products_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS); } $row = 0; $col = 0; $num = 0; while ($featured_products = tep_db_fetch_array($featured_products_query)) { $num ++; if ($num == 1) { new contentBoxHeading($info_box_contents); } $featured_products['products_name'] = tep_get_products_name($featured_products['products_id']); if($featured_products['specstat']) { $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br><s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>'); } else { $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=imageborder') . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id']))); } $col ++; if ($col > 2) { $col = 0; $row ++; } } if($num) { new contentBox($info_box_contents); } } else // If it's disabled, then include the original New Products box { // include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); // disable for dont show if desactive the feature module } ?> <!-- featured_products_eof //-->
Guest Posted April 6, 2007 Posted April 6, 2007 this is from the documentation of the contribution Step 12:edit /catalog/include/functions/general.php and ADD before the last ?> tag: function tep_array_values_to_string($array, $separator = ',') { $get_string = ''; if (sizeof($array) > 0) { while (list($key, $value) = each($array)) { $get_string .= $value . $separator; } $remove_chars = strlen($separator); $get_string = substr($get_string, 0, -$remove_chars); } return $get_string; } Seems you don't have it. Check again the instructions make sure you did all steps.
grunionfab Posted April 6, 2007 Author Posted April 6, 2007 this is from the documentation of the contributionSeems you don't have it. Check again the instructions make sure you did all steps. enigma, You are my hero! I could have sworn it happened sometime after i installed the featured products contribution but I guess I just had not noticed it before. Thank you so much, I was really worried what my customers must have been thinking when they saw that "Fatal Error". I really do appreciate it!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.