Sorting in OXID eShop

Reset the sorting

Task

It should be possible to reset a sorting set by the customer.

Solution

With the help of an OXID eShop module the sorting can be reset

For this it is necessary to overwrite the method getSorting in the controllers alist, manufacturerlist and search

<?php

..

public function getSorting($sSortIdent)
{
    $sortBy = oxRegistry::getConfig()->getRequestParameter($this->getSortOrderByParameterName());
    if ('none' === $sortBy) {
        $aSorting = oxRegistry::getSession()->getVariable('aSorting');
        unset($aSorting[$sSortIdent]);
        oxRegistry::getSession()->setVariable('aSorting', $aSorting);

        return null;
    }

    return parent::getSorting($sSortIdent);
}

Then, in the corresponding template (flow theme: widget/locator/sort.tpl), another link must be added with the parameter listorderby=none, which can be used to reset the sorting.