The following code is causing a 8-9 second page load delay on our site and I’m trying to whittle this down however I’m not sure which conditionals to try to change in order to best affect the load times

I’ve tried using the ifelse addon from Devot:ee however it doesn’t seem to be helping at all (where I’ve placed it!)

There are about 80 categories and the code below picks out 4 of them. The channel that the products are pulled from has about 1000 entries

Using EE 2.9.0

    {exp:channel:categories channel="products" style="linear"}
    {exp:ifelse parse="inward"} 
    {if hp-featured == "Yes"}

        <h2 class="hpH2"><a href="{path=products/l/c/{category_url_title}}">Best Selling {category_name}</a></h2>
        {exp:low_reorder:entries set="product_order" category="{category_id}" dynamic="no" disable="member_data|pagination|primary_category|categories|category_fields|misc_content|news|homepage_adverts|about" limit="3" url_title="{embed:the_url_title}" }
        <style type="text/css">
        #MI{product_code} {position:absolute; z-index:2; visibility:hidden; width:215px; margin-top:195px; background:url(/images/bg-list-moreinfo.png); padding:3px 5px; text-align:center; font-weight:normal; font-size:11px;}
  <div class="productSingle" onmouseover="P7_autoLayers(0,'MI{product_code}')" onmouseout="P7_autoLayers(0)">
  <div id="MI{product_code}"><a href="{url_title_path='products/detail'}" title="{title} Prices and Ordering">more info &raquo;</a></div>
  <a href="{url_title_path='products/detail'}"><img src="{product_image:thumbnail}" alt="{if product_thumbnail_alt_tag !=""}{product_thumbnail_alt_tag}{if:else}{title}{/if}" title="{title}" width="225" height="225" border="0" /></a> <a href="{url_title_path='products/detail'}">{title}</a><br />
  {if '{bulk_discounts:total_rows}' == 5}
            {if field_row_count == 5}from {if saleprice}&pound;{saleprice}<s> &pound;{price}</s>{if:else}&pound;{price}{/if} per item{/if}
  {if '{bulk_discounts:total_rows}' == 4}
            {if field_row_count == 4}from {if saleprice}&pound;{saleprice}<s> &pound;{price}</s>{if:else}&pound;{price}{/if} per item{/if}
  {if '{bulk_discounts:total_rows}' == 3}
            {if field_row_count == 3}from {if saleprice}&pound;{saleprice}<s> &pound;{price}</s>{if:else}&pound;{price}{/if} per item{/if}


1 Answer 1


The code is slow because you are nesting tags. To speed up, you'll need to un-nest which will reduce the amount of queries. The linked blog post uses PHP in the template to achieve this. Nowadays, people tend to use Stash to do the same.

If you can't un-nest, you'll probably have to cache the hell out of that page.

  • Thanks Low How do I specify the category to show the entries for as my existing code uses {if hp-featured == "Yes"} but I can't see where I'd add this in your Nested tags PHP example Feb 24, 2015 at 10:20
  • 1
    I'd suggest looking into Stash instead of using PHP. That article is 5 years old; best practices moved away from using PHP in your templates.
    – Low
    Feb 24, 2015 at 11:26

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.