Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Bestseller list tweaking...


skeedo

Recommended Posts

First of all it's not showing up in my new store...do a certain number of products have to be purchased for it to first show up?

 

Secondly, I would like to truncate the Product names so they all fit on one line.

 

Anyone :?:

Link to comment
Share on other sites

You could incorporate this into the code to truncate the length of the product names:

////

// Truncate a string

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;

  }

Link to comment
Share on other sites

First of all it's not showing up in my new store...do a certain number of products have to be purchased for it to first show up?

 

You set this up under Admin - I think it's under Minimum Values (or Maximum?) Have a look in there. Sorry it's a bit vague! :)

 

Jen

I haven't lost my mind - I have it backed up on disk somewhere.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...