Forum
scope-parent="true" not working for slug field inside if statement inside reapea...
Hi. I am trying to return just the first item in a repeater region to the template...
to do that, I'm using
<perch:if exists="perch_item_first">
</perch:if>
But when I do that, the first item that uses scope-parent="true" to return the slug value returns nothing. The title field is returned.
<perch:repeater id="repeater_images" label="Additional Images">
<perch:if exists="perch_item_first">
<a href="/product.php?product=<perch:shop id="slug" type="slug" scope-parent="true" />"><img src="<perch:shop id="image_secondary" type="image" width="800" height="800" density="1.6" crop="true" />" alt="<perch:shop id="title" scope-parent="true"/>"></a>
</perch:if>
</perch:repeater>
scope-parent="true"
goes on theperch:repeater
tag.oh wow! I've always used it on the field in the repeater!
Moving the tag to the repeater does not change it though. Still works on the title field, but not on the slug field within an if statement...
Thanks, Monty
Can you show me your corrected code?
sure.
it's used on this page to add the 2nd image to each listing if that helps:
https://stopherethisistheplace.com/shop
-- Monty
Inside the repeater, you need to use
parent.slug
to address the field from the parent scope.Thank you!
Hi Drew so the "inside" code should look like this?