0

Currently my list of options to Order the results on the Category page are: position, name, price, color & newest.

I can't find the option (and Google doens't help me either) to place price as the first option in this list. So it's about the showing the sort options.

I can change the toolbar.phtml file and adjust the sorting in there on the frontend myself, but I assume there must be a more elegant way of adjusting this in the code. Anyone has a suggestion to help me on the right track?

2 Answers 2

2

This is pretty old, but I wanted to share this anyway. For whomever that might find it useful.

To expand on David Manners' second and third method, this is how I solved it. Add this to toolbar.phtml:

$availableOrders = array(
    'name' => 'Naam',
    'price' => 'Prijs',
    'position' => 'Nieuwste'
);
$this->setAvailableOrders($availableOrders);
1

These fields are created by the function Mage_Catalog_Model_Config::getAttributeUsedForSortByArray so to change these you have a couple of options.

Rewrite Mage_Catalog_Model_Config

Nice and simple here rewrite the model Mage_Catalog_Model_Config and change the function getAttributeUsedForSortByArray to do what you need. Or better yet dispatch your own before and after events and then create an observer that manipulates the orders.

Change the toolbar template

The toolbar uses the template catalog/product/list/toolbar.phtml technically you could change the template used and display the options how you want.

Use the setAvailableOrders function

Now the toolbar block has a function setAvailableOrders so what you could do is simply call this function and set the orders that you want. It takes and array of attribute and label.

array(
    'attribute_1' => 'Label 1',
    'attribute_2' => 'Label 2'
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.