Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Description in Product Listing Hack v.2 Fatal error


greysun

Recommended Posts

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

Link to comment
Share on other sites

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

"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

  • 4 months later...
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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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