I have a site running playa module and it's painfully slow to run any queries.

Here is my tag code:

{exp:channel:entries channel="sous_sous_categorie" url_title="{segment_4}" dynamic="no"}

                    {if {exp:playa:total_parents}}
                        {if segment_2 != "nouveautes"}
                        <h1 class="rang">{embed="kanuk/.get_sous-sous-cat-lang" url_title="{url_title}"}</h1>
                        <div class="article">
                            {exp:playa:parents channel="article" var_prefix="article"}

                                <?php $article_entry_id = "{article:entry_id}"; ?>

                                    {if "{segment_2}" == "{article:url_title}"}                                 
                                            {embed="kanuk/.coat_render" last_entry_id="<?php echo $article_entry_id; ?>"}

                            {if segment_2 != "nouveautes"}
                                </div><!-- END article -->


Which loads:

{exp:channel:entries channel="article" entry_id="{embed:last_entry_id}" dynamic="no"}
    {if "{url_title}" == "{segment_3}" || "{segment_3}" == ""}
    <div class="manteau" style="">
        {embed="kanuk/.coat_render2" last_entry_id="{embed:last_entry_id}"} 
    </div><!-- END manteau -->

which loads:

{exp:channel:entries channel="article" entry_id="{embed:last_entry_id}" dynamic="no"} {categorie}
{if title == "Nouveautés"} {/if} {/categorie}

                <ul class="couleurList">
                    <li><div style="width:48px; height:30px; background-color:{swatch}" data-load="{couleur_{language_code}}" alt="{couleur_{language_code}}"></div></li>
            {images_produit cover_only="yes"}<img src="{image:url:medium}" width="220" height="280" alt="{title}">{/images_produit}
            <div class="manteauNom">{title}</div>

            <div class="manteauPrix">
                <div class="prixreg">
                    {if "{language_code}" == "en"}
                    {if:elseif "{language_code}" == "fr"}
                        {prix_regulier} $

Could you offer any hints / best practices to speed up page load time?

I'm convinced nesting these queries 3 layer deep is not helping but I don't know of another way of achieving my goal !

  • What types of fields are categorie and sous_categorie in this case? Are these playa fields? Also, could you elaborate a bit more on what the code is accomplishing? – Kara Todd Oct 26 '13 at 2:01
  • @KaraTodd Categorie & sous_categorie are Playa Fields, Simply using these fields to establish product categories to create store hierarchy. See: kanuk.com/Collection/femmes/vetements-legers Which is a live page of the code base I've include above ! – Charles-Philippe Girard Oct 27 '13 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.