You are here:  » minimal search results and prices comparison table template files


minimal search results and prices comparison table template files

Submitted by support on Mon, 2013-08-19 17:57 in

Hi everyone,

To assist people in customising their template files within the html/
folder of the distribution, here are almost minimal versions of the
search results and price comparison table templates that can be used
as a starting point for a completely customised design, for example
to create a table-less design.

(the formatting will be clearer when copied into a code aware text editor)

html/searchresults.php

<?php foreach($searchresults["products"] as $product): ?>
  <?php if ($product["image_url"]): ?>
    Product Image: <a href='<?php print $product["productHREF"]; ?>'><img width='80' src='<?php print htmlspecialchars($product["image_url"]); ?>' alt='<?php print htmlspecialchars($product["name"]); ?>' /></a>
    <br />
  <?php endif; ?>
  Product Name and Link: <a href='<?php print $product["productHREF"]; ?>'><?php print $product["name"]; ?></a>
  <br />
  Truncated Description: <?php print tapestry_substr($product["description"],250,"..."); ?>
  <br />
  <?php  if ($product["rating"]): ?>
    Star Rating: <?php print tapestry_stars($product["rating"],""); ?>
    <br />
  <?php endif; ?>
  Best Price: <?php print $config_currencyHTML.$product["minPrice"]; ?>
  <br />
  Link: <a href='<?php print $product["productHREF"]; ?>'>Compare Prices</a>
  <hr />
<?php endforeach; ?>

and html/prices.php

<?php foreach($prices["products"] as $product): ?>
  Merchant: <a href='<?php print $product["merchantHREF"]; ?>'><?php print (file_exists("logos/".$product["merchant"])?"<img alt='".$product["merchant"]."' src='".$config_baseHREF."logos/".str_replace(" ","%20",$product["merchant"])."' />":$product["merchant"]); ?></a>
  <br />
  Merchant Product Name: <?php print $product["original_name"]; ?>
  <br />
  Price: <?php print $config_currencyHTML.$product["price"]; ?>
  <?php if ($product["voucher_code"]): ?>
    <br />
    Voucher Code: <?php print $product["voucher_code"]; ?>
  <?php endif; ?>
  <br />
  Visit Store: <a href='<?php print tapestry_buyURL($product); ?>'><?php print translate("Visit Store"); ?></a>
  <hr />
<?php endforeach; ?>

Cheers,
David
--
PriceTapestry.com