You are here:  » Show All product Images from all merchants On product Page


Show All product Images from all merchants On product Page

Submitted by keshavkshirsagar on Wed, 2015-08-19 15:47 in

Hello David

On Product page image will display whose price will be minimum

If I want to show other images from other merchant then what to do

Product Main Image - whose price will be minimum
Product img gallery - Images From other merchant

Submitted by support on Thu, 2015-08-20 07:40

Hi,

You can loop over $product["products"] to access the image_url value for each merchant. The following example code will load an array ($images) with all available image_url values for all merchants on the page except for the cheapest merchant, who's image will be displayed as the main image on the page:

<?php
  $images 
= array();
  foreach(
$product["products"] as $p)
  {
    if (
$p["image_url"]) $images[] = $p["image_url"];
  }
  if (
count($images))
  {
    print 
"<ul>";
    foreach(
$images as $k => $image)
    {
      if (!
$k) continue;
      print 
"<li><img src='".$image."' /></li>";
    }
    print 
"</ul>";
  }
?>

The first (cheapest) merchant is excluded with this line:

      if (!$k) continue;

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by keshavkshirsagar on Thu, 2015-08-20 13:39

Hello David

This code is working

Thanks