No results

The no-results page can be used to display a custom ‘no results’ message as result of a search in one or more productlists. It’s possible to display very specific information when a product can’t be found. Possible appliances are (but are not limited to):

  • display the phone number of your sales department
  • prepare for an email to the sales department
  • show additional search instructions to the customer
  • logging unfound search terms by calling a script on your own server

Versions before 2.4

In shops before version 2.4, the no-results part of a productlist consists of a separate template. This template is called with the extension myshop-block:noresults. From this template only the body is used and injected in the place where the extension was called.

The example below shows how to implement the noresults block extension in your productlist template.

<html>
        <head>
                <title>Simple Productlist example with no-results message</title>
        </head>
        <body>
                <table style="myshop-block:productlist" border="1">
                        <thead>
                                <tr>
                                        <td style="myshop-label:1;font-weight:bold"></td>
                                        <td style="myshop-label:2;font-weight:bold"></td>
                                </tr>
                        </thead>
                        <tbody>
                                <tr style="myshop-block:product">
                                        <td style="myshop-value:1;color:red"></td>
                                        <td style="myshop-value:2"></td>
                                </tr>
                        </tbody>
                </table>
                <span style="myshop-block:noresults"/>
        </body>
</html>

The second step is creating and uploading an XHTML page with the custom message (through the editor for setting the custom layout). The example below shows the code of a page with a custom message, including the search categories or keywords the customer used.

<html>
        <head>
                <title>No-results example with search terms displayed</title>
        </head>
        <body>
                <table style="myshop-not-has:results" widt"100%">
                        <tr>
                                <td valign="top" align="center">
                                        The search selection
                                        <span style="myshop-repeat:search-selection">
                                                <span style="myshop-has-value:search-field">
                                                        - <span style="myshop-search-field:value"/>
                                                </span>
                                                <span style="myshop-has-value:search-field-max">
                                                        - <span style="myshop-search-field:value-max"/>
                                                </span>
                                        </span>
                                        and/or the search word &quote;<span style="myshop-eval:{$SearchValue};;font-weight:bold;color:red;"></span>&quote; you searched for did not raise any results. <br/><br/>
                                        Try again with different search terms or contact us by calling 123-1234567 (office hours) and we will assist you further. You can also send an email to <a href="mailto:info@an_example.com">info@an_example.com</a>
                                </td>
                        </tr>
                </table>
        </body>
</html>

The extension myshop-not-has:results makes sure that this message is only displayed when nothing is found. The message will always be displayed if this is omitted.

The search term can only be displayed when either extended or global search is used for the productlist.

Versions 2.4 and higher

From version 2.4 on the use of a separate template containing the no result message was removed, instead the normal productlist template may contain the message to be displayed when no results are found, using the extension myshop-has:results.

The following example is the default code that is found at the end of all 3.x productlist templates.

<div style="myshop-not-has:results" class="myshp_list_no_results">
        <br/><br/>
        <span style="myshop-resource:noresult">
                Helaas, er zijn geen resultaten.
        </span>
</div>

The extension myshop-not-has:results marks the ‘noresults’ part, the resource ‘noresult’ contains a simple message in the language the shop, stating that no results were found.
In order to change the text you should remove the myshop-resource extension.

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment