1

I'm trying to sort the products in search result by "Position". Obviously this works in product listing but i found out that it is commented in Block Result.php:

/**
 * Set search available list orders
 *
 * @return Mage_CatalogSearch_Block_Result
 */
public function setListOrders()
{
    $category = Mage::getSingleton('catalog/layer')
        ->getCurrentCategory();
    /* @var $category Mage_Catalog_Model_Category */
    $availableOrders = $category->getAvailableSortByOptions();
    unset($availableOrders['position']);
    $availableOrders = array_merge(array(
        'relevance' => $this->__('Relevance')
    ), $availableOrders);

    $this->getListBlock()
        ->setAvailableOrders($availableOrders)
        ->setDefaultDirection('desc')
        ->setSortBy('relevance');

    return $this;
}

I removed the unset($availableOrders['position']); but Magento throws an SQL error.

Does anyone know how can I achieve this?

Thanks a lot!

1 Answer 1

2

category product Collection is coming over on a category and Position is an variance of current category .and catalogsearch is coming on all product here category is not set.that way it is not possible

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.