Search code examples
intershop

Get position of slot item using ISSLOT tag


Actually I'm using isslotiterator and I have to use loop in loop to get the position of each slot item with the attribute counter.

I would like to know if it is possible to get the position with a <isslot>. Imagine that I have a slot with 3 entries.

So when I'm calling <isslot> in the slot item ISML I could do : #Pagelet:Position#

Then having as result : 1 / 2 / 3


Solution

  • No i don't think this is possible. <isslot> does not pass the location information down of the pagelet, it just renders it. To have more control of how slot items are rendered, the isslotiterator tag was introduced.

    You can get the position info from the SlotPageletAssignment object if u dont want to use a counter. Take a look at the Carousel component on the demo homepage.

    app_sf_responsive_cm/release/templates/default/component/common/Carousel.isml
    

    there u can see they use AssignmentsAlias key to get the SlotPageletAssignment

    <isslotiterator Slot="#Pagelet:SubSlot("app_sf_responsive_cm:slot.carousel.items.pagelet2-Slot")#" AssignmentsAlias="CarouselPageletAssignments">
    <isloop iterator="CarouselPageletAssignments" alias="CarouselPageletAssignment" counter="i">
        #CarouselPageletAssignment:Position# - #CarouselPageletAssignment:getSubPagelet#<br/>
    </isloop>