1

My EE site has 3 ranges of products separated into different channels. I also have a separate channel for featured products, which is basically contains a Playa field for dragging and dropping products from all ranges. There will only be 6 featured products.

On the first page of products, I want to show the 6 featured products, followed by 3 of the "normal" products, followed by pagination. I've marked the featured products entry as sticky, and have used a normal channel entries loop to retrieve all products for all ranges like this:

{exp:channel:entries channel="featured|channel-1|channel-2|channel-3" limit="9" orderby="title" sort="asc"}

However, as the featured products channel is classed as one entry, despite containing 6 products, the loop displays all 6 featured products plus 8 "normal" products. Is there a way to treat the entries in the Playa field as separate without using special statuses or categories? Any help is very much appreciated!

Thanks in advance!

1 Answer 1

1

A bit of a weird setup to be honest - but you can make this work with a conditional limit.

{exp:channel:entries limit="{if segment_2}9{if:else}4{/if}" channel="featured|channel-1|channel-2|channel-3" orderby="title" sort="asc"}

(This assumes that this code is in the index template of a template group.)

3
  • Thanks Derek. I know, it is a bit odd, I've come into this project after a lot of it has already been set up. Just one question - if I set the limit to 4 initially, won't this make the pagination create incorrect links, ie. it'll work on the basis of 4 items per page rather than 9?
    – MoreMike
    Nov 26, 2014 at 15:35
  • Only for the first page - so the first pagination URL will be /P4, but subsequent pages will be /P13, /P22, etc. (EE determines the offset on each page load.) Nov 26, 2014 at 15:38
  • Hi Derek, I've been trying out the code, but as suspected, the pagination links are, in effect, multiplied, so on the first page there are say page numbers up to 60, then on the second and subsequent pages, this reduces to 27. Is there any way to make this work?
    – MoreMike
    Dec 1, 2014 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.