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.

alphabetic list

December 29, 2010 11:19am

Subscribe [2]
  • #1 / Dec 29, 2010 11:19am

    Cristian Garner

    1 posts

    Hi guys im trying to do an alphabetic list managed by categories, im new at this so maybe im just doing something wrong… what i do is print with php the letters with a link that sends me to a products list, when i have entries i get the products but when not i print a message that says no products with letter “D”, the problem is when there are entries related to other categories i got no message like if it was found in the query and then prints nothing… ill show u my code to see if u can see the problem.

    URL here is like—>{site_url}/index.php/instrumentos/producto2/category/violinistas/u

    {exp:channel:category_heading channel="instrumentos"}
        {exp:query sql="SELECT title, url_title AS urlt, cat_id FROM exp_channel_titles NATURAL JOIN exp_category_posts WHERE channel_id = '4' AND cat_id = '{category_id}' AND  title LIKE '{segment_5}%' ORDER BY title ASC"} 
        {embed="instrumentos/lista" link="{urlt}"}
        {if no_results}
             no product with letter {segment_5}{category_id}
        {/if}
    {/exp:query}
    {/exp:channel:category_heading}

    embed lista code

     
    {exp:channel:entries channel="instrumentos" limit ="1"  url_title="{embed:link}" }
        <h3>{nombre_instrumento}</h3>
    <p>     <br />
        {imagen_instrumento}<br />
        <br />
            Descripcion: {descripcion_instrumento}<br />
        <br />
        <br />
        Precio: {precio}<br />
         <br />
    {/exp:channel:entries}

  • #2 / Jan 05, 2011 8:24am

    e-man

    1816 posts

    URL here is like—>{site_url}/index.php/instrumentos/producto2/category/violinistas/u

    Let me see if I get this: the above url lists (or should list) all products in the violinistas category that have “u” as the first letter?

  • #3 / Jan 05, 2011 12:26pm

    Cristian Garner

    1 posts

    yes, it will list the products that starts with “u” from category “violinistas”, if there arent any products registered with “u” in any category it wont find anything and will print “no products starts with u”, the problem is that if there is a a product registered with “u” in another category it wont enter the {if no_results} and will list empty instead of the no products message

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

ExpressionEngine News!

#eecms, #events, #releases