0


so i have a page that is slow to load. I have tried various alterations to this code but nothing has seemed to work for me. I read that 'Switchee' may be a solution, but i am not so sure.

So I have six 'product' channels, and within each there is one field that asks 'is this a new product?' It is a dropdown field, with 'NO' being the default. If a new entry in any channel is created, and the user selects 'YES' for this field, the product will appear on the 'What's New' page.


{exp:channel:entries channel="fprod" disable="category_fields|member_data|pagination|trackbacks" dynamic="no"}
{if f_wn == "YES"}
Product title, thumbnail, category (brand), etc.
{/if}
{/exp:channel:entries}

{exp:channel:entries channel="bprod" disable="category_fields|member_data|pagination|trackbacks"}
{if b_wn == "YES"}
Product title, thumbnail, category (brand), etc.
{/if}
{/exp:channel:entries}

{exp:channel:entries channel="nprod" disable="category_fields|member_data|pagination|trackbacks"}
{if n_wn == "YES"}
Product title, thumbnail, category (brand), etc.
{/if}
{/exp:channel:entries}

{exp:channel:entries channel="hprod" disable="category_fields|member_data|pagination|trackbacks"}
{if h_wn == "YES"}
Product title, thumbnail, category (brand), etc.
{/if}
{/exp:channel:entries}

{exp:channel:entries channel="eprod" disable="category_fields|member_data|pagination|trackbacks"}
{if e_wn == "YES"}
Product title, thumbnail, category (brand), etc.
{/if}
{/exp:channel:entries}

{exp:channel:entries channel="aprod" disable="category_fields|member_data|pagination|trackbacks"}
{if a_wn == "YES"}
Product title, thumbnail, category (brand), etc.
{/if}
{/exp:channel:entries}


This works fine but apart from the slow load time, the client wants the most recently added 'new' product to appear at the top of the page (not just at the top of its related channel results.

Could someone please help in improving this, if possible? Would be much appreciated!

2 Answers 2

1

Without going to a custom query you could try one master exp:channel:entries tag like:

{exp:channel:entries channel="fprod|brod|drod|etc" disable="category_fields|member_data|pagination|trackbacks" dynamic="no"
orderby="entry_date"}
{if f_wn == "YES"}
Product title, thumbnail, category (brand), etc.
{/if}
{if p_wn == "YES"}
Product title, thumbnail, category (brand), etc.
{/if}
{if d_wn == "YES"}
Product title, thumbnail, category (brand), etc.
{/if}
{/exp:channel:entries}

Basically we're doing away with multiple channel calls and rolling them into one call. As well as ordering the results by "entry_date". You can set mutlipe sort and order values as per the docs

If you wish to retain separate channel calls then a custom query would be quicker – assuming you're not wanting to retrieve every single field in an entry.

It does however not group your entries by any channel associated data.

0
1

You could achieve this with Low Search, the Field Search filter and enabling smart_field_search. That will apply the search:field parameters only to the channels the field is assigned to.

{exp:low_search:results
    channel="aprod|bprod|cprod"
    search:a_wn="=YES"
    search:b_wn="=YES"
    search:c_wn="=YES"
    smart_field_search="yes"
}

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.