Jump to content
Sign in to follow this  
greysun

Description in Product Listing Hack v.2 Fatal error

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×