You are here:  » Put vist store in search results

Support Forum



Put vist store in search results

Submitted by wilkins on Tue, 2010-04-06 10:38 in

Hi david

I am looking to put a visit store under the more info link on the search results page,is it possible, I am aware there could be a issue if there is more than one company.

Brent

Submitted by support on Tue, 2010-04-06 12:19

Hi Brent,

This can easily be added in html/searchresults.php. To only show the Visit Store link if there is only one merchant, look for the following closing endif; statement on line 30:

          <?php endif; ?>

...and REPLACE that with:

            <br /><a href='<?php print tapestry_buyURL($product); ?>'>Visit Store</a>
          <?php endif; ?>

Alternatively, to have it displayed in both cases (either 1 or more merchants), just add the code on the line after the endif; statement instead...

Cheers,
David.

Submitted by wilkins on Tue, 2010-04-06 12:54

Hi David

that worked great, one more thing regarding sending people to the merchant, could a link for this be put into the rss.php also.

Thanks

brent

Submitted by support on Tue, 2010-04-06 13:51

Hi Brent,

Sure, could you post your current rss.php and let me know how / where you want the link within the feed - i.e. do you want it to replace the link to your Price Tapestry site; or alternatively include it as part of the description etc...

Cheers,
David.

Submitted by wilkins on Tue, 2010-04-06 14:07

Hi david

I would like it after the description if possible as a separate link.

Brent

<?php
  $baseURL = "url"; // URL of your site without trailing "/"
  require("includes/common.php");
  header("Content-Type: text/xml");
  print "<?xml version='1.0' encoding='UTF-8'?>";
  print "<rss version='2.0'>";
  print "<channel>";
  print "<title>RSS Feed</title>";
  print "<link>".$baseURL.$config_baseHREF."</link>";
  print "<description>RSS Feed</description>";
  if ($_GET["merchant"]) { $where = " WHERE merchant='".database_safe($_GET["merchant"])."' "; }
  elseif ($_GET["category"]) { $where = " WHERE category='".database_safe($_GET["category"])."' "; }
  elseif ($_GET["brand"]) { $where = " WHERE brand='".database_safe($_GET["brand"])."' "; }
  else { $where = ""; }
  $sql = "SELECT * FROM `".$config_databaseTablePrefix."products` ".$where." ORDER BY RAND() LIMIT 20";
  if (database_querySelect($sql,$rows))
  {
    foreach($rows as $product)
    {
      print "<item>";
      if ($config_useRewrite)
      {
        $href = "product/".tapestry_hyphenate($product["name"]).".html";
      }
      else
      {
        $href = "products.php?q=".urlencode($product["name"]);
      }
      print "<title>".$product["name"]."</title>";
      print "<link>".$baseURL.$config_baseHREF.$href."</link>";
      print "<guid>".$baseURL.$config_baseHREF.$href."</guid>";
      print "<description><![CDATA[";
      print "<img src='".$product["image_url"]."' /><br />";
      print "<p>".$product["description"]."</p>";
      print "]]></description>";
      print "</item>";
    }
  }
  print "</channel>";
  print "</rss>";
?>

Submitted by support on Tue, 2010-04-06 14:30

Hi Brent,

To do that, replace this line:

      print "<img src='".$product["image_url"]."' /><br />";

...with:

      print "<img src='".$product["image_url"]."' /><br />";
      print "<a href='".tapestry_buyURL($product)."'>Visit Store</a>";

Cheers,
David.