0

I show product on my HomePage by using following method :

  {{block type="xxxx/catalog_product_list" category_id="283" template="catalog/product/list.phtml"}}

By using a category i can choose the order of my product (Category Products > Position)


The problem is that if i sort by desc or asc a product list then the homepage product order is changed based on product ID (desc or asc)

I want my homepage product to keep the Category Products > Position order even if we sort product list by desc or asc, is it possible ?

Thx

2 Answers 2

1

This has been coming for _beforeToHtml function Mage_Catalog_Block_Product_List.Here magento is set product listing sorty

below code:

if ($sort = $this->getSortBy()) {
    $toolbar->setDefaultOrder($sort);
}

If i set parameter for home page product list just like

if ($dir = $this->getDefaultDirection()) {
    $toolbar->setDefaultDirection($dir);
}

If i set parameter for home page product list just like

sort_by="position"
default_direction="desc"

then it may be work...

{{block type="xxxx/catalog_product_list" category_id="283" template="catalog/product/list.phtml"  sort_by="position" default_direction="desc" }}
0

Use this Code:

if ($sort = $this->getSortBy()) {
    $toolbar->setDefaultOrder($sort);
}

If i set parameter for home page product list just like

if ($dir = $this->getDefaultDirection()) {
    $toolbar->setDefaultDirection($dir);
}
1
  • Isn't is exactly the same Amit Bera has posted?
    – sv3n
    Commented Jul 25, 2017 at 12:39

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.