Sorter - Automatically sort A-z

Miscellaneous Actinic / SellerDeck patches and anything not covered above.
Post Reply
chrisdicken
Posts: 25
Joined: Wed May 28, 2008 5:30 pm

Sorter - Automatically sort A-z

Post 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
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Re: Sorter - Automatically sort A-z

Post 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.
Norman
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Re: Sorter - Automatically sort A-z

Post 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.
chrisdicken
Posts: 25
Joined: Wed May 28, 2008 5:30 pm

Re: Sorter - Automatically sort A-z

Post 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
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Re: Sorter - Automatically sort A-z

Post 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.
Norman
chrisdicken
Posts: 25
Joined: Wed May 28, 2008 5:30 pm

Re: Sorter - Automatically sort A-z

Post 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
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Re: Sorter - Automatically sort A-z

Post 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.
Norman
chrisdicken
Posts: 25
Joined: Wed May 28, 2008 5:30 pm

Re: Sorter - Automatically sort A-z

Post by chrisdicken »

My bad - thanks again for all your help and support.
Post Reply