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.

Search results links aren't working...any ideas?

October 20, 2010 7:49am

Subscribe [4]
  • #1 / Oct 20, 2010 7:49am

    melonian

    37 posts

    Hi guys!

    I’m having issues with a Simple search form. I get the correct responses, but the links to each specific page is not correct, so it’s completely useless.

    But for starters… I’m running Expression Engine v2.1.0

    Main page is http://www.nordicbranding.se/index.php  (i haven’t styled the search field yet, so don’t mind it’s own ugliness)...

    Page with the results of a search showing the correct products:

    http://www.nordicbranding.se/index.php/search/results/332d70a013dde1fc75ce0a1e5f0f0c1e/

    However, the links to each particular product are not correct.
    The link offered is: http://www.nordicbranding.se/index.php/search/results/332d70a013dde1fc75ce0a1e5f0f0c1e/russell_arbetstroeja

    The correct URL should be: http://www.nordicbranding.se/profilklader/arbetsklader/tee_och_trojor/russell_arbetstroeja

    I’ve tried auto_path, id_auto_path, permalink and all, and nothing seems to produce the correct URL to the product specefici page.

    Any ideas??
    Thanks in advance!

  • #2 / Oct 20, 2010 7:52am

    melonian

    37 posts

    Also tried this:

    <a href="{if page_url}{page_url}{if:else}{auto_path}{/if}">

    didn’t work though…

    just in case 😉

  • #3 / Oct 20, 2010 3:50pm

    Ingmar

    29245 posts

    Have you set the Search URL for your channels correctly? Can you show us a little more of your code, how are you linking to the results?

  • #4 / Oct 21, 2010 8:06pm

    melonian

    37 posts

    Hi Ingmar,

    this is the Search form code I’m using:

    {exp:search:simple_form channel="reklamartiklar|profilklader|sportswear"} <label for="keywords">Search:</label>
      <input type="text" name="keywords" id="keywords" value="" size="18" maxlength="100" /><input type="submit" value="submit" class="submit" > {/exp:search:simple_form}

    and this is the results page:

    {exp:search:search_results}
                        {if count == "1"}
                                    <h2>Search Results for "<strong>{exp:search:keywords}</strong>":</h2>
    <p>                {/if}</p>
    
    <p><div class="prod_box"></p><h3><a href="http://{url_title}">{title}</a></h3>
    <p><a href="http://{auto_path}">{intro_pic}</a><br />
    <div class="from">från<br />
    <span>{from_swe} :-</span></div><br />
    </div>                            </p>
    
    <p>                    {/exp:search:search_results}

    Url_title,auto_path, id_auto_path and a few other tests aren’t really working. However, the rest of information is completely correct…Images, text, etc…

    Thanks in advance for the help.

  • #5 / Oct 22, 2010 3:03pm

    Sue Crocker

    26054 posts

    melonian, which build/version of EE are we talking about - what’s not working with url_title?

  • #6 / Oct 22, 2010 3:35pm

    melonian

    37 posts

    melonian, which build/version of EE are we talking about - what’s not working with url_title?

    Hey Sue,

    Build is: 20100712

    url_title prints the following URL on the search results :
    /search/results/332d70a013dde1fc75ce0a1e5f0f0c1e/russell_arbetstroeja

    If I follow the normal path on the navigation, when all products from the particular category are displayed, url_title prints the following:
    /profilklader/arbetsklader/tee_och_trojor/russell_arbetstroeja

    Needless to say, the later is the correct one.

    So, basically, what I’m trying here, is that on the Search Results page, the proper links to the products are produced automatically… just like when I present the products.
    The rest of the items wors flawlessly (images, titles, etc)...it’s only the links to the actual products that are wrong, but that renders the whole search engine useless, because the user will find the products he’s searching for, but won’t be able to reach the correct page because the URLs of the links aren’t working.

    Thanks for checking and if you need any clarification or have any other question, just let me know.

  • #7 / Oct 23, 2010 1:08pm

    Greg Salt

    3988 posts

    Hi Melonian,

    Have you set the correct search paths for each channel?

    Cheers

    Greg

  • #8 / Oct 24, 2010 8:32pm

    melonian

    37 posts

    Hi Greg,

    Well, yeah, but the problem is the categories… now what I’ve managed is to get the correct URL for those products that only reside in a parent category (that meaning that they’re on a main category, and not on a child category).

    {categories limit="1"}
    <h3><a href="http://{channel_url}{category_url_title}/{url_title}/">{title}</a></h3>
    <p>{/categories}

    however, category_url_title only shows 1 segment of the categories, instead of category_parent/category_child

    If i don’t limit=“1” then I get TWO links, one with the parent category without the child and another one with the child and not the parent. So none of them work.
    Also I cannot force the child category URL to be parent/child…

    So I’m a bit at loss with this…

  • #9 / Oct 24, 2010 10:04pm

    melonian

    37 posts

    Hi guys,

    I solved this with a rather whacky solution:

    I added a Category Custom Field called “parent” where i’d store the segment/ of the parents. On all subcategories, I add that “segment/” and would leave it empty for categories that are parents.

    Then on the search results I’d go this way:

    {exp:search:search_results}
                        {if count == "1"}
                                    <h2>Search Results for "<strong>{exp:search:keywords}</strong>":</h2>
    <p>                {/if}</p>
    
    <p><div class="prod_box"><br />
    {categories show="not 10|19" limit="2"}</p><h3><a href="http://{channel_url}{category_url_title}/{url_title}/">{title}</a></h3>
    
    <p><a href="http://{channel_url}{parent}{category_url_title}/{url_title}/">{intro_pic}</a><br />
    {/categories}<br />
    <div class="from">från<br />
    <span>{from_swe} :-</span></div><br />
    </div>                            </p>
    
    <p>                    {/exp:search:search_results}

    So, I on the categories tag I do not show the categories that have childs (otherwise it’d repeat those products, but since I need to show the child and it always starts with the parent, I still need to limit=“2”)...then the url goes like this:

    {channel_url}{parent}{category_url_title}/{url_title}/

    So, it takes the channel URL, followed by the Custom Category Field, which is the parent “segment/” So if it’s a child category, it’ll offer the parent segment, if it’s already a parent, the Custom Field will be empty, so it won’t display anything. The the category_ulr_title which adds the segment for the Category (child or parent) and the the url_title of each product.

    I know it’s quite strange, so I’d really would love to know the easy way to do this, because I’m sure there’s an easy way to do this without having to do all this juggling.

    Cheers

  • #10 / Oct 25, 2010 4:35pm

    Ingmar

    29245 posts

    The “normal” way would be to link to a single template page, per channel. If you want to use separate links per category your solutions is one way to do this. Is it working as expected now? In that case I wouldn’t worry too much.

  • #11 / Oct 25, 2010 5:09pm

    melonian

    37 posts

    Hey Ingmar,

    Well, the problem is that they’re shown by category, so if I link to a single template, then the links won’t take the categories and thus will result in a 404.

    My solution ain’t sexy, but at least works, which for now is more than I expected 😉

    thanks anyway, though.

    Cheers

  • #12 / Oct 25, 2010 5:14pm

    Ingmar

    29245 posts

    I am glad to hear that. Don’t hesitate to post again as needed, please 😊

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

ExpressionEngine News!

#eecms, #events, #releases