Page 1 of 1

Sorter - Automatically sort A-z

Posted: Thu Jan 07, 2010 1:59 pm
by chrisdicken
Hi Norman

Using the sorting tool, is there any way to automatically sort search results as being A-Z once they are all loaded? Maybe a script that runs once they are all loaded?

Thanks in advance

Chris

Re: Sorter - Automatically sort A-z

Posted: Thu Jan 07, 2010 6:46 pm
by norman
The sort tool remember the users preference and uses that on all subseqent pages.

It may be possible to preset A-Z as the default. However you might get into a catch-22 situation in that the code that presets it would then override what customers prefer on subsequent page views.

Re: Sorter - Automatically sort A-z

Posted: Thu Jan 07, 2010 8:46 pm
by norman
Here's how:

Edit file sortedproductsupport.js (in your Site folder) and look for thr line:

Code: Select all

		if ( searchlastsorttype == null ) searchlastsorttype = 'default';

Amend it to be:

Code: Select all

		if ( searchlastsorttype == null ) searchlastsorttype = 'alpha';
This should mean that as long as the user hasn't set a preference then A..Z will be used.

Re: Sorter - Automatically sort A-z

Posted: Sun Jan 10, 2010 3:49 pm
by chrisdicken
That's great. This particular client only ever wants A-Z on the search results, so customers changing sort preferences won't be an issue.

Many thanks.

Chris

Re: Sorter - Automatically sort A-z

Posted: Mon Jan 11, 2010 12:10 am
by norman
Super. Remind the client that the search results are displayed in fixed count pages. Best set the count to a large number so that they all turn up in the first page.

Re: Sorter - Automatically sort A-z

Posted: Tue Jan 12, 2010 11:42 am
by chrisdicken
Hmmm - doesn't seem to be working.

Could you just take a very quick look at

http://dev.page45.com/actinic-test/store/

(try searching for 'Pilgrim')

And see what I've missed

The file at...

http://dev.page45.com/actinic-test/stor ... support.js

... definitely seems to have the correction in it.

Sorry to be a pain

Chris

Re: Sorter - Automatically sort A-z

Posted: Tue Jan 12, 2010 1:32 pm
by norman
There's some code missing from your Search Results layout. You have trimmed down the set of search links to be only SORT BY: Price | A-Z. In doing that you've removed the tags <span id="searchsortwidget"> and </span> which need to surround these links. Unless the add-on sees this span it doesn't know that there's anything to setup and uses the default.

Re: Sorter - Automatically sort A-z

Posted: Wed Jan 13, 2010 10:49 am
by chrisdicken
My bad - thanks again for all your help and support.