You are here:  » Related Products showing images instead ot name of product?


Related Products showing images instead ot name of product?

Submitted by blogmaster2003 on Sun, 2013-05-12 12:58 in

Hi

how can i show images with link instead of the name of product in the related products (after one product)

Also could i add also the name and/or logo of that store?

Submitted by support on Mon, 2013-05-13 08:23

Hi,

Related Products HTML is actually generated by the search results HTML module, so the first thing that you would need to do is to create a separate HTML module for them, so that they can be styled independently of search results.

To do this, first make a copy of html/searchresults.php and save it as a new file:

html/relatedresults.php

Next, edit html/related.php and look for the following code at line 3:

  require("html/searchresults.php");

...and REPLACE with:

  require("html/relatedresults.php");

Now you can edit html/relatedresults.php and change the Related Products layout as required.

Here's a basic example, based on the Featured Products layout, showing image (linked), and if numMerchants is 1 then the merchant name or logo as well....

<div class='featured'>
  <table cellspacing='20'>
    <tr>
      <?php foreach($searchresults["products"] as $product): ?>
        <td align='center' valign='top'>
          <p>
            <a href='<?php print $product["productHREF"]; ?>'><img border='0' height='100' src='<?php print $product["image_url"]; ?>' alt='<?php print htmlentities($product["name"],ENT_QUOTES,$config_charset); ?>' /></a>
          </p>
          <p>
          <?php if ($product["numMerchants"] > 1): ?>
            <em><?php print translate("from"); ?></em>&nbsp;<strong><?php print $config_currencyHTML.$product["minPrice"]; ?></strong>
          <?php else: ?>
            <strong><?php print $config_currencyHTML.$product["price"]; ?></strong>
          <?php endif; ?>
          </p>
          <?php if ($product["numMerchants"] > 1): ?>
            <p>
            <a href='<?php print $product["merchantHREF"]; ?>'><?php print (file_exists("logos/".$product["merchant"])?"<img src='".$config_baseHREF."logos/".$product["merchant"]."' border='0' />":$product["merchant"]); ?></a>
            </p>
          <?php endif; ?>
        </td>
      <?php endforeach; ?>
    </tr>
  </table>
</div>

Cheers,
David.
--
PriceTapestry.com