You are here:  » Show Product table on niche page


Show Product table on niche page

Submitted by stuball2 on Mon, 2014-06-23 22:58 in

Hi David,

I am making some product reviews for certain products and I would like to display a single search result at the bottom of that page.

I found this: http://www.pricetapestry.com/node/5004 which is sort of similar and I also found this: http://www.pricetapestry.com/node/1740 . What I need is somewhere in the middle:

So the page is constructed as so:

Header
Menu
Review

Then I would like the table you see in search results (product name is mapped) in the same format as search results:

Image Name Price
Desc Compare x prices.

Is there a nice way to drop this in please?

Thanks in advance.
Stuart.

Submitted by support on Tue, 2014-06-24 08:09

Hello Stuart,

To pick and show the search result for a single product "Product Name", have a go with simply;

  $name = "Product Name";
  $sql = "SELECT *,COUNT(id) AS numMerchants,MIN(price) as minPrice FROM `".$config_databaseTablePrefix."products` WHERE name = '".database_safe($name)."' GROUP BY name";
  $searchresults["numRows"] = database_querySelect($sql,$rows);
  $searchresults["products"] = $rows;
  $searchresults["products"][0]["productHREF"] = tapestry_productHREF($searchresults["products"][0]);
  require("html/searchresults.php");

Cheers,
David.
--
PriceTapestry.com

Submitted by stuball2 on Tue, 2014-06-24 17:17

Works perfect, Thanks!

Submitted by stuball2 on Tue, 2014-06-24 17:28

Hi David,

Responded too soon - it is nearly perfect, it looks fine but the hyperlinks on the compare box and the product title don't link correctly, they link to the review page for some reason. Any ideas?

Thanks,
Stuart.

Submitted by support on Tue, 2014-06-24 19:20

Hi Stuart,

Replacement corrected above - to add computed "productHREF" field to the $searchresults array...

Cheers,
David.
--
PriceTapestry.com