You are here:  » How do I add Visit store button to search results

Support Forum



How do I add Visit store button to search results

Submitted by webie on Sat, 2007-04-21 02:58 in

Hi

I am trying to add Visit store button to search results I am not sure how i would do this how some one can point me in the right direction.

Many Thanks
Darren

Submitted by support on Sat, 2007-04-21 07:16

Hi Darren,

This can be done, but you need to consider that sometimes a search result is actually a comparison of the product from more than one store. You can certainly add the "Visit Store" link when there is only one store for a product, and you can identify where this needs to go in the code from the location of the "More Information" line that is displayed when there is only one store.

In html/searchresults.php look for the following code (near the end):

<span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("More Information"); ?></a></span>

To add the "Visit Store" link, add the following code on the next line:

<br /><a href='<?php print tapestry_buyURL($product); ?>' <?php print javascript_statusBar(translate("go to")." ".$product["merchant"]); ?>>Visit Store</a>

That should do the trick!
Cheers,
David.

Submitted by webie on Sat, 2007-04-21 18:41

Hi David,

Sorry to be pain but is there way of showing both compare prices and visit store image button? also how can i show product rating & product reviews and also if the product is featured to display image button for that product all from search results.

Many Thanks David
Darren

Submitted by support on Sun, 2007-04-22 09:34

Hi Darren,

Check the mods discussed in this thread...

http://www.pricetapestry.com/node/1003

Cheers,
David.

Submitted by webie on Mon, 2007-04-23 02:46

Hi David,

I looked at that tread already I was just looking to display read review with review count and write review on search results for each product my site is now live be nice to get some input or some ideas on
layout.

Many Thanks
Darren
http://www.bargainshack.co.uk

Submitted by support on Mon, 2007-04-23 07:09

Hi Darren,

No problem - in html/searchresults.php look for the following line:

<p><?php print substr($product["description"],0,250); ?></p>

...and add the following block of code immediately afterwards to display the review link after the description:

          <?php
          if ($config_useRewrite)
          {
            $reviewHREF = $config_baseHREF."review/".tapestry_hyphenate($product["name"]).".html";
          }
          else
          {
            $reviewHREF = $config_baseHREF."reviews.php?q=".urlencode($product["name"]);
          }
          $sql = "SELECT count(*) AS numReviews FROM `".$config_databaseTablePrefix."reviews` WHERE product_name = '".database_safe($product["name"])."' AND approved <> '0' ORDER BY created";
          database_querySelect($sql,$rows);
          if ($rows[0]["numReviews"])
          {
            print "<a href='".$reviewHREF."'>Reviews (".$rows[0]["numReviews"].")</a>";
          }
          else
          {
            print "<a href='".$reviewHREF."'>Review This Product</a>";
          }
          ?>

Hope this helps!
Cheers,
David.

Submitted by webie on Mon, 2007-04-23 11:17

Hi David,

Another big thank you works a treat

all the best

darren