Miva Merchant 5 Module FAQs » Focus


{docurl}

Replacing the %category_list_auto token with a static list of categories

My store has thousands of categories. I'm using the token %category_list_auto|3|Any|% to display the list of categories to which the customer can restrict the search. But it takes a bit longer to display the list on the screen than I would like. Is there a way to speed this up?

Yes there is. To generate that list the module has to "recurse" through the categories; with 1000s of categories that's going to take soem time. The way to speed things up is to use a static list of categories instead of the automatically generated list. You could simply replace the %category_list_auto token wtih the static <select> list but we'll take advantage of Focus' templates to make it much "cleaner".

Do a "View source" on your Focus search page and find the select list for the SearchCategories (that's the field name for the list). Copy that entire list from, and including, the beginning <select name="SearchCategories"> to the ending </select>. Go into your admin, to the "Templates/New Tempaltes" tab. Paste the list into the "Html" field. Enter a code into the "Code:" field, we'll assume that you use the code "categories", enter a name for the new template, and click on "Update". That will create a new template containing your category list.

We want the list to behave like the %category_list_auto token in that the category selected by the customer will stay selected on teh subsequent pages. To do this we'll need to add a token to the new template. Immediately before the <select tag place the code:

%selected_add|

and immediately after the </select> tag add the code:

|%

So if you select list looked like:

<select name="SearchCategories">
<option value="one">One</option>
<option value="two">Two</option>
<option value="three">Three</option>
</select>


after adding the token around the list it will look like:

%selected_add|
<select name="SearchCategories">
<option value="one">One</option>
<option value="two">Two</option>
<option value="three">Three</option>
</select>
|%

Now, go to your "Live" template and find the %category_list_auto token. Remove that entire token (including the portions after %category_list_auto, such as %category_list_auto|3|Any|%) and replace it with the token:

%insert_token_code|categories|%

(if you didn't give your new template the code "categories" use your code in it's place).

With that change the category restriction list will be "static" and your page should load much faster.



Last update: 2008-10-09 14:34
Author: Thor
Revision: 1.0

Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 0 out of 5 (0 Votes )

completely useless 1 2 3 4 5 most valuable

You cannot comment on this entry