You are here:  » Product Not Found Reviews


Product Not Found Reviews

Submitted by noodles on Tue, 2006-10-24 18:27 in

If an item is deleted from the database is it possible to still display the reviews for it?

Submitted by noodles on Thu, 2006-10-26 16:50

Perhaps I should elaborate, If I have a URL like this
http://www.mydomain.com/review/Apple-Mac-G5.html
indexed in the search engines for a product than no longer exists in the products table and someone clicks on it then I get the message..

"Price search results for Apple Mac G5(product not found)"

So, as i still hold the reviews for the Apple Mac G5 in the reviews table I should be able to pull those from the table and at least make the page of some use, is that right or is this harder than it sounds?

Thanks
Dave

Submitted by support on Thu, 2006-10-26 17:08

Hi Dave,

Yes - that makes sense - i'll have into it for you and post the modifications required to products.php....

Cheers,
David.

Submitted by support on Thu, 2006-10-26 17:33

Hi Again,

To implement this, look for the following code in products.php (line 72)...

  $banner["h2"] .= "(".translate("product not found").")";

...and add the following code immediately afterwards:

  $sql = "SELECT * FROM `".$config_databaseTablePrefix."reviews` WHERE product_name = '".database_safe($q)."' AND approved <> '0' ORDER BY created";
  if (database_querySelect($sql,$rows))
  {
    $ratings["reviews"] = $rows;
  }

Finally, you also need to incorporate the ratings HTML module (it won't make any difference to the normal product pages). Look for the following code...

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

...and add the following line immediately afterwards:

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

If you want to remove the review form from the page if the product no longer exists, you would need to add an IF case around the form code in html/ratings.php:

  <?php if (isset($product)): ?>
  <form>
    ... existing form code...
  </form>
  <?php endif; ?>

That should do the trick...

Cheers,
David.

Submitted by noodles on Thu, 2006-10-26 18:04

Excellent job, works a treat.

thanks
Dave