Skip to main content
2 of 3
deleted 34 characters in body
sv3n
  • 11.7k
  • 7
  • 41
  • 73

How can i get image url with proper path?

<?php foreach ($temp as $product): ?>
    <?php
    $id = $product['entity_id'];
    $img = $product['image'];
    $url = $product['url_path'];
    $small_image = $skinUrl.$product['small_image'];
    $small_img_lable = $product['small_image_label'];
    $thumbnail = $product['thumbnail'];
    $name = $product['name'];
    $price = $product['price'];
    $special_price = $product['special_price'];
    $size = $product['size'];
    ?>

    <li class="product-grid_item product-tile">
        <a class="product-image" href="<?php echo $url; ?>">
            <div class="quickview"><button class="button button--s button--inverted">Quick View</button></div>
                <picture class="pimg1">
                    <source srcset="<?php echo $small_image; ?>" media="(min-width: 400px)">
                    <img srcset="<?php echo $small_image; ?>" alt="<?php echo $small_img_lable;?>">
                </picture>
                <picture class="pimg2">
                    <source srcset="<?php echo $thumbnail; ?>" media="(min-width: 400px)">
                    <img srcset="<?php echo $thumbnail; ?>" alt="<?php echo $thumbnail;?>">
                </picture>

$temp contain product attributes. And i have all the attibute data in json file, but can't get image url. How can I get this?

"small_image":"\/1\/_\/1_4_1.jpg","thumbnail":"\/1\/_\/1_4_1.jpg"

this are my small image and thumbnail image values in json.