Forum

Thread tagged as: Question, Shop

Adding a repeater image to an existing template

I've been loading products to the shop using the products template. We'd now like to include multiple images. Here's what the image part of the template looked like:-

<perch:shop id="image" type="image" label="Product image" width="800" />
<perch:shop id="image" type="image" width="80" height="80" density="1.6" crop="true" />

If I wrap that in a repeater like this:-

<perch:repeater id="images" label="Product images">
    <perch:shop id="image" type="image" label="Product image" width="800" />
    <perch:shop id="image" type="image" width="80" height="80" density="1.6" crop="true" />
</perch:repeater>

When go to edit one of the products I see the repeater but the single image I'd already loaded is not there. I'd like it to be the first image and I can then add some more. Am I doing something wrong?

Mark Smith

Mark Smith 0 points

  • 4 years ago
Simon Clay

Simon Clay 127 points

Hi, you're not doing anything wrong, but Perch will treat it as a new region if you wrap it in the repeater.

An alternative could be to add the repeater after the first image. You could re-label the first image as Main Image, and then have 'Additional Images' after as the repeater. This would have the added advantage of making it slightly easier to pull that Main Image into other product listings.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'd agree with Simon.

OK thanks both, I've gone with that approach.