greysun Posted September 26, 2002 Share Posted September 26, 2002 I tried to install the Description in Product Listing mod and now when I try to veiw a product category I get this error Fatal error: Call to undefined function: osc_trunc_string() in /home/bullisla/bullisla-www/catalog/includes/modules/product_listing.php on line 134 Here is the code that is around that line // Products Description Hack begins case 'PRODUCT_LIST_DESCRIPTION': $lc_text = ' ' . osc_trunc_string(strip_tags($listing_values['products_description'], '<a><b><em><font><i><s><span><strong><sub><sup><u>'), PRODUCT_LIST_DESCRIPTION_LENGTH) . ' '; $col_to_span = sizeof($column_list)-1; if (PRODUCT_LIST_IMAGE > 0) { $col_to_span -= 1; } $lc_params = 'colspan="' . $col_to_span . '" '; break; // Products Description Hack ends Here is line 134 $lc_text = ' ' . osc_trunc_string(strip_tags($listing_values['products_description'], '<a><b><em><font><i><s><span><strong><sub><sup><u>'), PRODUCT_LIST_DESCRIPTION_LENGTH) . ' '; does anyone know whats going on? Any help would be appreciated Quote Link to comment Share on other sites More sharing options...
greysun Posted September 26, 2002 Author Share Posted September 26, 2002 Ok I figured it out. I was snoozing when I compared general.php in beyond compare. Everything works ok now This is a beautiful mod. Quote Link to comment Share on other sites More sharing options...
Paul_C Posted September 26, 2002 Share Posted September 26, 2002 Glad it's working for you :) For anyone else who has this problem; make sure you've added the osc_trunc_string() function to your catalog/includes/functions/general.php Quote "It's a damn poor mind that can only think of one way to spell a word." -- Andrew Jackson Link to comment Share on other sites More sharing options...
HaggisBoy Posted February 26, 2003 Share Posted February 26, 2003 Glad it's working for you :) For anyone else who has this problem; make sure you've added the osc_trunc_string() function to your catalog/includes/functions/general.php I have this problem. I have this problem. What does the function I need to add look like????? Can anyone post a correct copy of this file to me by e-mail? eddy@diecastcentral.net THANKS VERY MUCH! THIS IS THE ONLY THING STOPPING IT FROM WORKING I BELIEVE. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 26, 2003 Share Posted February 26, 2003 Glad it's working for you :) For anyone else who has this problem; make sure you've added the osc_trunc_string() function to your catalog/includes/functions/general.php I have this problem. I have this problem. What does the function I need to add look like????? Can anyone post a correct copy of this file to me by e-mail? eddy@diecastcentral.net THANKS VERY MUCH! THIS IS THE ONLY THING STOPPING IT FROM WORKING I BELIEVE. It should be in the contributed mod zip that you downloaded. Anyways make sure you add this in your catalog/includes/functions/ general.php file. Right before the last ?> at the end or bottom of the general.php file add this: //// // Products Description Hack begins // // grabs a length from a string, but goes back to the last space if it cut into // the middle of a string. If the string is longer than that, cut, then add '...' // to the end of the string, if the $more == 1 function osc_trunc_string($str="",$len=150,$more=1) { if ($str=="") return $str; if (is_array($str)) return $str; $str = trim($str); // if it's les than the size given, then return it if (strlen($str) <= $len) return $str; // else get that size of text $str = substr($str,0,$len); // backtrack to the end of a word if ($str != "") { // check to see if there are any spaces left if (!substr_count($str," ")) { if ($more) $str .= "..."; return $str; } // backtrack while(strlen($str) && ($str[strlen($str)-1] != " ")) { $str = substr($str,0,-1); } $str = substr($str,0,-1); if ($more) $str .= "..."; } return $str; } // Products Description Hack ends 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.