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

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" }}
| improve this answer | |
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);
}
| improve this answer | |
  • Isn't is exactly the same Amit Bera has posted? – sv3n Jul 25 '17 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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