You are here:  » Image in last reviews

Support Forum



Image in last reviews

Submitted by Bakalinge on Mon, 2012-12-10 14:53 in

Hi David,

A strange thing is happening with a mod showing last reviews (already posted somewhere on this forum). I have the following code :

{code saved}

The problem is I can't get the product image next to each review (in fact there is always the same one, the "noimage.jpg") . And very strange, only one product has an thumbnail (the second product in the list !?!), but this is not the right one : this is the image of the last product in the search result column. I suspect a cache problem or something like this, but...

Any help would be appreciated.

Thanks

Bak

Submitted by support on Tue, 2012-12-11 05:07

Hello Bak,

Ah - reviews are actually indexed by normalised_name so in your code, where you currently have:

$sql2 = "SELECT image_url FROM `".$config_databaseTablePrefix."products` WHERE name='".database_safe($review["product_name"])."' AND image_url <> '' LIMIT 1";
database_querySelect($sql2,$rows2);
$review["image_url"] = $rows2[0]["image_url"];

...REPLACE this with:

$sql2 = "SELECT image_url FROM `".$config_databaseTablePrefix."products` WHERE normalised_name='".database_safe($review["product_name"])."' AND image_url <> '' LIMIT 1";
if (database_querySelect($sql2,$rows2))
{
  $review["image_url"] = $rows2[0]["image_url"];
}
else
{
  $review["image_url"] = "";
}

Cheers,
David.
--
PriceTapestry.com

Submitted by Bakalinge on Tue, 2012-12-11 08:45

Thanks David,

This time, I get an image for each review, but this is not the right one, and it's always the same (in fact, it's this time again the image of the last product from the search result...).

Submitted by support on Tue, 2012-12-11 10:04

Hello Bak,

Sorry about that - please could you email me the full script containing the code and I'll check it over for you...

Cheers,
David.
--
PriceTapestry.com