Changing the default sort for a category

Share tips and tricks with the AOM user community.
Post Reply
associate-o-matic
Admin
Admin
Posts: 1879
Joined: Fri Oct 01, 2004 10:40 pm
Contact:

Changing the default sort for a category

Post by associate-o-matic » Tue Nov 08, 2005 9:24 pm

To change the default sort, you'll need to venture into the PHP file /aom/cfg.default.php and edit it directly.

What you'd do is go to the section related to the Amazon category that covers your AOM category(s) (e.g. Books). If you wanted to change the default from "Bestselling" to "Featured Items" you'd change this...

$cfg['SortDefault']['list']['Amazon.com']['Books'] =
Array('salesrank' => 'Bestselling',
'relevancerank' => 'Featured Items',
'reviewrank' => 'Reviews (High to Low)',
'pricerank' => 'Price (Low to High)',
'inverse-pricerank' => 'Price (High to Low)',
'daterank' => 'Publication Date (Newer to Older)',
'titlerank' => 'Alphabetical (A-Z)',
'-titlerank' => 'Alphabetical (Z-A)',
);


To this...

$cfg['SortDefault']['list']['Amazon.com']['Books'] =
Array('relevancerank' => 'Featured Items',
'salesrank' => 'Bestselling',
'reviewrank' => 'Reviews (High to Low)',
'pricerank' => 'Price (Low to High)',
'inverse-pricerank' => 'Price (High to Low)',
'daterank' => 'Publication Date (Newer to Older)',
'titlerank' => 'Alphabetical (A-Z)',
'-titlerank' => 'Alphabetical (Z-A)',
);


Essentially, the first item in the PHP array is the default when AOM generates the page.

Justin
Associate-O-Matic is changing. For the better. 8)

Please CLICK HERE for our important announcement.

waroeng
Posts: 4
Joined: Sun Nov 09, 2008 1:08 am

Re: Changing the default sort for a category

Post by waroeng » Sun Nov 09, 2008 8:52 am

In some cases, i need to make a different sort between 2 tabs with same category.
does anyone know how to do that?

thanks!
waroeng
Associate-O-Matic is changing. For the better. 8)

Please CLICK HERE for our important announcement.

associate-o-matic
Admin
Admin
Posts: 1879
Joined: Fri Oct 01, 2004 10:40 pm
Contact:

Re: Changing the default sort for a category

Post by associate-o-matic » Mon Nov 10, 2008 5:33 pm

You could do this with some additional code in the /aom/cfg.default.php file.

What you could do is add a condition around the first sort option something like...

if (isset($this->clean['c']) AND $this->clean['c']=="123") {

... sort array here...

}
else if (isset($this->clean['c']) AND $this->clean['c']=="456") {

... other sort array here...

}

Where the 123 and 456 would be your specific Category IDs.
Associate-O-Matic is changing. For the better. 8)

Please CLICK HERE for our important announcement.

ch4rles
Experience Level 1
Experience Level 1
Posts: 24
Joined: Tue Jun 08, 2010 5:56 pm
Contact:

Re: Changing the default sort for a category

Post by ch4rles » Thu Jun 10, 2010 7:16 pm

Works great. Thank you!
Associate-O-Matic is changing. For the better. 8)

Please CLICK HERE for our important announcement.

asiaintel
Posts: 2
Joined: Thu Aug 05, 2010 3:39 pm

Re: Changing the default sort for a category

Post by asiaintel » Sun Dec 12, 2010 12:31 pm

I tried but it only worked on the homepage sort by, the category sort by did not do anything - is there anything wrong with the code:

if (isset($this->clean['c']) AND $this->clean['c']=="1") {

$cfg['Sort']['list']['Amazon.com']['Books'] = Array(
'daterank' => 'Publication Date (Newer to Older)',
'salesrank' => 'Bestselling',
'relevancerank' => 'Featured Items',
'reviewrank' => 'Reviews (High to Low)',
'pricerank' => 'Price (Low to High)',
'inverse-pricerank' => 'Price (High to Low)',
'titlerank' => 'Alphabetical (A-Z)',
'-titlerank' => 'Alphabetical (Z-A)',
);
}

else if (isset($this->clean['c']) AND $this->clean['c']=="2") {
$cfg['Sort']['list']['Amazon.com']['Books'] = Array(
'daterank' => 'Publication Date (Newer to Older)',
'salesrank' => 'Bestselling',
'relevancerank' => 'Featured Items',
'reviewrank' => 'Reviews (High to Low)',
'pricerank' => 'Price (Low to High)',
'inverse-pricerank' => 'Price (High to Low)',
'titlerank' => 'Alphabetical (A-Z)',
'-titlerank' => 'Alphabetical (Z-A)',
);

}
Associate-O-Matic is changing. For the better. 8)

Please CLICK HERE for our important announcement.

tekmiester
Experience Level 1
Experience Level 1
Posts: 14
Joined: Wed Dec 01, 2010 2:11 pm

Re: Changing the default sort for a category

Post by tekmiester » Fri Jan 14, 2011 7:51 pm

This doesn't seem to work. I get "The server is busy. Please refresh this page in a moment.

The value you specified for Sort is invalid. Valid values include -age-min, -price, pmrank, price, salesrank, titlerank."
Associate-O-Matic is changing. For the better. 8)

Please CLICK HERE for our important announcement.

tekmiester
Experience Level 1
Experience Level 1
Posts: 14
Joined: Wed Dec 01, 2010 2:11 pm

Re: Changing the default sort for a category

Post by tekmiester » Fri Jan 14, 2011 8:12 pm

Got it. 'relevancerank' was replaced by 'pmrank'
Associate-O-Matic is changing. For the better. 8)

Please CLICK HERE for our important announcement.

Greg
Posts: 3
Joined: Tue Mar 08, 2011 7:10 pm

Re: Changing the default sort for a category

Post by Greg » Mon Mar 14, 2011 12:16 pm

Is there a way to do this if your category is using an ASIN file?
Associate-O-Matic is changing. For the better. 8)

Please CLICK HERE for our important announcement.

mcarp555
Admin
Admin
Posts: 4088
Joined: Thu Sep 14, 2006 5:19 pm
Location: United Kingdom
Contact:

Re: Changing the default sort for a category

Post by mcarp555 » Mon Mar 14, 2011 12:48 pm

No; ASIN files are not sortable by the above method.
Associate-O-Matic is changing. For the better. 8)

Please CLICK HERE for our important announcement.

marcpusch
Experience Level 1
Experience Level 1
Posts: 14
Joined: Fri Feb 25, 2011 4:44 am

Re: Changing the default sort for a category

Post by marcpusch » Mon Mar 14, 2011 2:43 pm

Is that to say that ASIN lists can't be sorted at all?

Marc
Associate-O-Matic is changing. For the better. 8)

Please CLICK HERE for our important announcement.

mcarp555
Admin
Admin
Posts: 4088
Joined: Thu Sep 14, 2006 5:19 pm
Location: United Kingdom
Contact:

Re: Changing the default sort for a category

Post by mcarp555 » Mon Mar 14, 2011 3:55 pm

ASIN lists are a sort of 'Frankenstein' category that really isn't a category at all. So many of the things associated with a typical node-based category (sorting methods, 'Bestseller', 'Narrow by', and other sideboxes, etc.) do not apply.
Associate-O-Matic is changing. For the better. 8)

Please CLICK HERE for our important announcement.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests