ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Optimizing loading time

November 16, 2012 2:49pm

Subscribe [1]
  • #1 / Nov 16, 2012 2:49pm

    GKenny

    78 posts

    Hi Guys

    I have a loading time problem. it not to big but just enough to annoyed my customer.

    Now the page load in about 8 to 10 sec.

    here the simplified code

    {exp:channel:categories channel="produits"}
     //Some Category title
     {exp:channel:entries channel="produits" category="{category_id}"}
      {exp:cartthrob:add_to_cart_form entry_id="{entry_id}"}
        //products data
      {/exp:cartthrob:add_to_cart_form}
     {/exp:channel:entries}
    {/exp:channel:categories}

    If I strip out the categories part the page load in 2.5 sec.

    The “channel categories” is there to group the entries and display title.
    Is there another way to group entry by category?

     

  • #2 / Nov 16, 2012 4:10pm

    glenndavisgroup

    436 posts

    Try this:

    {exp:channel:categories channel="produits" show_empty="no"}
     //Some Category title
     {exp:channel:entries channel="produits" category="{category_id}"}
      {exp:cartthrob:add_to_cart_form entry_id="{entry_id}"}
        //products data
      {/exp:cartthrob:add_to_cart_form}
     {/exp:channel:entries}
    {/exp:channel:categories}

    Or if that still not good try:

    {exp:channel:entries channel="produits" status="open"}
      {categories}
         {category_name}
      {/categories}
      {exp:cartthrob:add_to_cart_form entry_id="{entry_id}"}
        //products data
      {/exp:cartthrob:add_to_cart_form}
    {/exp:channel:entries}

    I hope that helps.

    Mike

  • #3 / Nov 19, 2012 8:46am

    GKenny

    78 posts

    Hi Mike thank for your suggestions.

    But that doesn’t work.

    What I want to display here is :

    -Menu (First level category)
      -Sub-menu (Second level category)
        -All entries associated with the second level category

    In a reasonable time.

  • #4 / Nov 20, 2012 11:16am

    Dan Decker

    7338 posts

    Hi GKenny,

    The page load time is due to nesting the 2 module tags, channel categories and channel entries. They really aren’t meant to be nested one inside the other like that.

    I think everything you are looking for is provided by the Category Archives tags?

    {exp:channel:category_archive channel="default_site" style="linear"}
        {categories}
            <h3>{category_name}</h3>
    <p>        {if category_description}<br />
                {category_description}<br />
            {/if}<br />
        {/categories}<br />
        {entry_titles}<br />
            <a href="http://{path=SITE_INDEX}">{title}</a></p>
    
    <p>    {/entry_titles}<br />
    {/exp:channel:category_archive}

    If that is off the mark, you would want to use an embed rather than a nested call.

    Cheers,

  • #5 / Nov 20, 2012 11:42am

    GKenny

    78 posts

    Hi Dan

    Thanks for the reply

    I already try with the Category archives tag. That almost work the only problem is in the entry_title you cannot have the entry_id to pass to cartthrob.

    Im not sure to understand with the embed

    I already try:

    {exp:channel:categories channel="produits" show_empty="no" category_group="1"}
     //Category title
     {embed="path to file with exp:channel:entries and cartthrob" category_id="{category_id}"}
    {/exp:channel:categories}

    and my embed file

    {exp:channel:entries channel="produits" category="{embed:category_id}"}
     {exp:cartthrob:add_to_cart_form entry_id="{entry_id}" return="{country_code}/cel/selection_item"}
      //cartthrob data
     {/exp:cartthrob:add_to_cart_form}
    {/exp:channel:entries}

    Is that ok?

    It seem to have the same loading time to me

    Did I miss something.

    Thanks in advance

  • #6 / Nov 20, 2012 12:20pm

    glenndavisgroup

    436 posts

    How about this:

    {exp:channel:category_archive channel="produits" show_empty="no" category_group="1"}
        {categories}
                <h3>{category_name}</h3>
    <p>                                                     <br />
            {exp:channel:entries channel="produits" category="{category_id}"}<br />
                 {exp:cartthrob:add_to_cart_form entry_id="{entry_id}" return="{country_code}/cel/selection_item"}<br />
                  //cartthrob data<br />
                 {/exp:cartthrob:add_to_cart_form}<br />
            {/exp:channel:entries}<br />
        {/categories}<br />
    {/exp:channel:category_archive}

    Mike

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases