You are here:  » Include Product Description In Random Featured Products

Support Forum



Include Product Description In Random Featured Products

Submitted by johnc on Wed, 2010-06-02 14:27 in

Hi David

Using the random featured products setup for my homepage I'll see something like (along with an image):

Electric Cucumber Slicer

from £59.99

Full Product Description

..what I'd like to include is say the first so many chars or words of the product description before the price and link that is 'full product description'

Possible?

Cheers

John

Submitted by support on Fri, 2010-06-04 05:33

Hi John,

Assuming that you're still using the original html/featured.php to display your random featured products, to include a snippet of the description (although it may require a little CSS work to make it display neatly), look for the following code at line 24:

          <?php if ($product["numMerchants"] > 1): ?>

...and REPLACE with:

          <?php
          $breakLimit = 50;
          if (strlen($product["description"]) > $breakLimit)
          {
            $breakOffset = strpos($product["description"]," ",$breakLimit);
            if ($breakOffset !== false)
            {
              $product["description"] = substr($product["description"],0,$breakOffset);
              $product["description"] .= "... [<a href='".$product["productHREF"]."'>Full Description</a>]";
            }
          }
          print "<p>".$product["description"]."</p>";
          ?>
          <?php if ($product["numMerchants"] > 1): ?>

Cheers,
David.