1

I'm using EE2's simple search like so.

{exp:search:simple_form result_page="search" search_in="title" status="open" channel="gg_store"}
     <input type="text" id="searchBox" name="keywords" placeholder="Search" />
     <input type="submit" id="searchSubmit" name="searchSubmit" value="GO" />
{/exp:search:simple_form}

and my search results, using {exp:store:product} looks like this...

{exp:search:search_results}
                {exp:store:product entry_id="{entry_id}"}
                    <div id="product-list">
                        <span class="itemtitle"><a href="{url_title_path='/the-collection/product-detail/'}">{title}</a></span>
                        <a href="{url_title_path='/the-collection/product-detail/'}">{gallery_image_1} <img src="{path}_252x252/{filename}.{extension}" width="100%" /> {/gallery_image_1}</a><br />
                        <?php echo StringLimiter('{e_comm_body}','160'); ?>
                        <br /><br />
                        <div style="float:right;">
                            <span class="BTN updateBTN">
                                <a href="{url_title_path='/{e_comm_type}/product-detail/'}">Learn More...</a>
                            </span>
                        </div><!-- //control-group -->
                        {if on_sale}
                            <del>{regular_price}</del>
                            <span class="price">{price}</span>
                        {if:else}
                            <span class="price">{price}</span>
                        {/if}
                    </div>
                {/exp:store:product}
        {/exp:search:search_results}

Here's my "issue", this works 90% of the time. I'm building a website that sells only a few items. They are stored in the gg_store channel.

If i search a term like mma, pads, shin, it seems to be working properly. But for whatever reason, certain terms throw a weird EE error. Terms like Gloves, Gear... and this is the error.

Parse error: syntax error, unexpected T_STRING in /system/expressionengine/libraries/Functions.php(683) : eval()'d code on line 321

I did narrow down, the reason that causes it... it's {e_comm_type}. If i remove that all of a sudden every search term i can think of starts working. {e_comm_type} is a custom field which stores info like "The Collection", "Victory Athletics", "Apparel".

Any idea's why and how to fix this? I need to use {e_comm_type} to properly set the url destination.

0

This sounds like a parse order bug. Unfortunately, there's not much you can do except work around it (unless you want to report it to EL, but I wouldn't hold your breath waiting for a fix :).

I would try putting the search result display template code into an embed, and passing through the variables you need. This solves 90% of parse order issues I've seen.

Something like this:

{exp:search:search_results}
    {embed="embed/.search_result"}
{/exp:search:search_results}
| improve this answer | |
  • Hmmm i'll give that a go later today. Thanks! – ipixel Mar 5 '13 at 12:32
  • This ended up being the way i did it after-all. It worked well. – ipixel Mar 26 '13 at 13:51

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.