You are here:  » Reviews on a seperate page

Support Forum



Reviews on a seperate page

Submitted by murph on Mon, 2006-10-16 14:23 in

Just wondering, from an seo point, would it be better to ditch having the seperate page for the reviews (otherwise potential for duplicate content penalties) and have them paste to the main product detail page? Is this easy to do?

Submitted by support on Mon, 2006-10-16 15:02

It's reasonably easy to do - takes a bit of cutting and pasting though...!

Basically you need to bring all the code from reviews.php into products.php, not including the header, search box, footer etc.

Firstly, at the top of reviews.php, you will see the form handler code:

  if (isset($_POST["submit"]))
  {
    ...16 lines of code...
  }

Copy this into the top of products.php after the following line:

  $rewrite = isset($_GET["rewrite"]);

Next, you need to add the code to load the reviews from the database. This is the block of code you need:

      $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;
      }

Paste it into products.php as indicated below:

          $related = true;
        }
      }
      ....... PASTE CODE HERE ........
   }
   else
   {
     $banner["h2"] .= "(".translate("product not found").")";
   }

Finally, you need to pull in the HTML module that displays the reviews. The line of code you need is:

  require("html/ratings.php");

Include this line where you want the reviews to be displayed. If you want them after the prices, add that line after:

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

Cheers,
David.

Submitted by murph on Tue, 2006-10-17 10:06

Nice one David, that should do the trick, and perhaps i may use a javascript popout hidden div to display the form :)