You are here:  » merchant logo on category, searchresults and featurerd homepage


merchant logo on category, searchresults and featurerd homepage

Submitted by wesse249 on Tue, 2019-07-30 16:35 in

Hello David,

Is there a way to show a little merchant logo on the category, searchresults and featurerd homepage between the title and the more information button?

Thank you Jan Roel

Submitted by support on Wed, 2019-07-31 11:56

Hello Jan,

Sure - html/featured.php and html/searchresults.php both loop with $product in context, so when results relate to a single merchant you can display the logo using the following code:

<?php if (($product["numMerchants"]==1) && file_exists("logos/".$product["merchant"].$config_logoExtension)): ?>
  <br /><img alt='<?php print htmlspecialchars($product["merchant"],ENT_QUOTES,$config_charset); ?> <?php print translate("Logo"); ?>' src='<?php print $config_baseHREF."logos/".str_replace(" ","%20",$product["merchant"]).$config_logoExtension?>' />
<?php endif; ?>

The above just inserts a <br /> ahead of the logo but you might prefer to enclose it within a block element and style as required - let me know if you're not sure how to integrate into your design of course...

Cheers,
David.
--
PriceTapestry.com

Submitted by wesse249 on Fri, 2019-08-02 10:11

Hello David,

What is the best way to style the image size? And when there a more then one merchant is it then possible to show the cheapest logo?

Thanks Jan Roel

Submitted by support on Mon, 2019-08-05 10:00

Hello Jan,

You can style the image size through html/default.css - for Featured Products search for .pt_fp_image and similarly for search results, it's .pt_sr_image (which doesn't have any size styling by default)...

Regarding logo for cheapest merchant, you can query for the cheapest merchant for compared products - in place of the above use something like:

<?php
if ($product["numMerchants"]>1)
{
    $sql = "SELECT merchant FROM `".$config_databaseTablePrefix."products` WHERE name='".database_safe($product["name"])."' ORDER BY price LIMIT 1";
    database_querySelect($sql,$rows);
    $product["merchant"] = $row[0]["merchant"];
}
?>
<?php endif; ?>
<br /><img alt='<?php print htmlspecialchars($product["merchant"],ENT_QUOTES,$config_charset); ?> <?php print translate("Logo"); ?>' src='<?php print $config_baseHREF."logos/".str_replace(" ","%20",$product["merchant"]).$config_logoExtension?>' />

(i've removed the file exists check in this case assuming you have logos for all merchants which is normally the case - if required just let me know...)

Cheers,
David.
--
PriceTapestry.com