You are here:  » Related showing any results...or shducts empty

Support Forum



Related showing any results...or shducts empty

Submitted by koen on Wed, 2011-11-09 08:30 in

Hi David,

First of all (again) a note that I'm really happy with your script! Although I haven't reached my break even point yet, I'm very happy with all the features and configuration options.

I've got a slight problem with related products...
I've implemented the related feature on this site:

{link saved}
On this page it works quite well. But when there are no related products found, like on:
{link saved}
Nothing is shown and my layout (which depends heavily on the -tags in related.php) becomes quite a mess... Is there a possibility to implement a "No related products found" message?

Kind regards,
Koen

Submitted by support on Wed, 2011-11-09 10:07

Hi Koen,

html/related.php actually goes on to display html/searchresults.php so what you could do is as follows;

Firstly, in products.php look for the following code around line 120:

  if (isset($related)) require("html/related.php");

...and REPLACE with;

  if (!isset($related))
  {
    $searchresults["products"] = array();
  }
  require("html/related.php");

Then to make sure that the "Related Products" title isn't shown if there are no results, in html/related.php look for the following code at line 1:

<div class='related'><?php print translate("Related Products"); ?></div>

...and REPLACE with:

<div class='related'><?php print (count($searchresults["products"])?translate("Related Products"):""); ?></div>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by koen on Wed, 2011-11-09 13:00

Great! Thanks a lot!

Koen