Shopp Support » Setting Up Shopp

Setting Up Shopp

Get URL of product image via template tag

  1. Hey All,

    I'm having a bit of trouble retrieving the URL for the full-size product image within the category.php template. Have a lake at the code below:

    <?php echo shopp('product','image','type=image&property=url&return=true'); ?>

    I've tried it with and without echo/return=true, unfortunately, it returns nothing in either case. Suggestions? Clues? I'm all ears!

    If you're curious, I'm employing it at http://dev.seedplanted.org/shop to return some fancy hover previews, similar to many stock photo sites. The URL should be injected into the rel attribute of each thumbnail's enclosing anchor tag.

    Posted 1 month ago — #

  2. Alright, I neglected the part of the doc that insisted this tag be used within the images loop. It works just fine. What a n00b.

    Here's where I'm at now:
    <?php if(shopp('product','has-images')): while(shopp('product','images')): shopp('product','image','type=image&property=url'); endwhile; endif; ?>

    Posted 1 month ago — #

  3. Well, I'm close, at least. Regardless of whether I specify 'small', 'thumbnail' or 'image' it returns the same file.

    Granted, I have set the thumbnail and gallery image dimensions to be the same, but even so, what I'm trying to get is the original, un-modified image. Is there a way to pull that via template tag? (I assume their must, as it's pulled in to the thickbox link somehow)

    Posted 1 month ago — #

  4. Just me

    • Verified

    Profile

    <?php if(shopp('product','has-images','type=image')) : ?>
    ...
    <?php endif; ?>

    Posted 1 month ago — #

  5. Awesome, thanks! Works like a champ.

    Why does the loop default to thumbs only, shouldn't the loop pull all images by default, leaving it up to the image tag to specify the image type to return (especially since the image tag defaults to thumbnails, anyhow)? That's just the logic my own mind follows, your mileage may vary.

    Posted 1 month ago — #

  6. Just me

    • Verified

    Profile

    I am glad it works.

    You could also say, why load it all if you only need one.
    There are so many ways to Rome:)

    Posted 1 month ago — #

  7. Oh so true. Makes no nevermind to me!

    Posted 1 month ago — #


Reply

You must log in to post.