Submitted by wesse249 on Sun, 2017-11-12 19:50 in Price Tapestry
Hello David,
When you go to my homepage not all images of products are loading. Also on categorypages. But when i go the productpage with the not loaded image the image is loaded. Do you know how this is possible?
This could be the case where products are compared but not all merchants have an image_url for the product, due to search results being generated by a summary query.
It is no problem to make a re-query any result for which there is no image_url to get the image from another merchant - to do this add the following code to the very top of html/searchresults.php:
<?php foreach($searchresults["products"] as $k => $product) { if (!$product["image_url"]) { $sql = "SELECT image_url FROM `".$config_databaseTablePrefix."products` WHERE name='".database_safe($product["name"])."' AND image_url <> ''"; if (database_querySelect($sql,$rows)) { $searchresults["products"][$k]["image_url"] = $rows[0]["image_url"]; } } } ?>
Hello JR,
This could be the case where products are compared but not all merchants have an image_url for the product, due to search results being generated by a summary query.
It is no problem to make a re-query any result for which there is no image_url to get the image from another merchant - to do this add the following code to the very top of html/searchresults.php:
<?php
foreach($searchresults["products"] as $k => $product)
{
if (!$product["image_url"])
{
$sql = "SELECT image_url FROM `".$config_databaseTablePrefix."products` WHERE name='".database_safe($product["name"])."' AND image_url <> ''";
if (database_querySelect($sql,$rows))
{
$searchresults["products"][$k]["image_url"] = $rows[0]["image_url"];
}
}
}
?>
Hope this helps!
Cheers,
David.
--
PriceTapestry.com