2

I have a custom attribute called Select Photographer which appears in the category display settings area like so:

Select Photographer

This then allows users to use the Sort By to Group Photographers By Name A-Z or Group Photographers By Name Z-A in the front end.

Group by Photographer

Unfortunately, when selected as the default, it seems to auto sort by DSC. I'm not sure why this is the case, as this was put in by some freelancers who I have since parted ways with.

I have searched endlessly to try and find the responsible code for this, but can't find it anywhere. I'm thus wondering the best way to make this attribute default sort in the other direction ? Perhaps I should put an If statement in app/code/local/Mage/Catalog/Block/Product/List/Toolbar.php which says if the attribute is this, default sort by ASC?

public function setDefaultDirection($dir)
{
if (in_array(strtolower($dir), array('asc', 'desc'))) {
$this->_direction = strtolower($dir);
}
return $this;

The problem is, I don't want to affect the Sort By Group By Photographer options on the front end, only when this attribute is set via the back end. I also only want the change in sort order to occur for this attribute.

I have also tried simply making Group by Photographer A-Z option selected via the HTML, but that doesn't work either. Though, if there was a way to disable Magento's default sort by, it could be a viable work around.

Any help is much appreciated! Thanks

2

0

Your Answer

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

Browse other questions tagged or ask your own question.