Magento“排序依据"-如何使Magento忘记选择了哪个选项 [英] Magento 'Sort By' - How to make Magento forget which option was selected

查看:60
本文介绍了Magento“排序依据"-如何使Magento忘记选择了哪个选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前没有注意到的是Magento会记住您在类别列表页面上选择了排序依据"的选项.因此,如果您转到类别页面,并且可以说默认排序是按价格排序的,那么如果您将排序更改为按名称排序,则页面会重新加载,一切都很好.

Something that I have not noticed before is that Magento will remember which option you've selected to 'Sort By' on category list pages. So if you go to a category page, and lets say the default sort is ordered by price, if you change the sort to be ordered by name instead, the page reloads and all is well.

但是,如果您删除URL中的get变量并重新加载页面,它仍然会按名称排序,而不是恢复为价格.

However, if you remove the get variable(s) in the URL and reload the page, it still sorts by name instead of reverting back to price.

我当时认为这是我正在处理的网站所特有的问题,因为馆藏的建立和排序等工作中发生了一些自定义事件,但是我现在检查了其他一些Magento网站(其中一些我在网上随机找到的),他们都做同样的事情.

I was thinking this was a problem specific to the site I'm working on, as there are some custom things happening with collection building and sorting and such, but I've now checked a handful of other Magento sites (some of which I found at random on the web) and they all do the same thing.

有人知道这是如何被记住"的吗?这存储在用户的会话中吗?我认为这是缓存的一部分,但是此站点仍在开发中,因此缓存已禁用.

Does anyone know how this is being 'remembered'? Is this stored in user's session? I would think it's part of caching, but this site is still in development and thus caching is disabled.

这没什么大不了的,但是看起来确实像个错误.

It's not that big of a deal, but it does seem like a bug.

推荐答案

排序顺序参数存储在会话中.请参见Mage_Catalog_Block_Product_List_Toolbar::getCurrentOrder方法.您可以通过调用Mage_Catalog_Block_Product_List_Toolbar::disableParamsMemorizing方法或在目录会话中设置params_memorize_allowed来将其关闭.我的意思是Mage::getSingleton('catalog/session')->setParamsMemorizeAllowed(true)

The sort order parameter is stored in session. See Mage_Catalog_Block_Product_List_Toolbar::getCurrentOrder method. You can switch it off by calling Mage_Catalog_Block_Product_List_Toolbar::disableParamsMemorizing method or by setting params_memorize_allowed in catalog session. I mean Mage::getSingleton('catalog/session')->setParamsMemorizeAllowed(true)

这篇关于Magento“排序依据"-如何使Magento忘记选择了哪个选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆