Magento获取当前Collection的排序方式
来源:互联网 发布:怎样在淘宝上找优惠券 编辑:程序博客网 时间:2024/05/18 01:47
在Magento中,平时获得collection的时候,我们会根据实际情况设置排序,使用setOrder。如果只是静态的,这个好说,直接写上即可。
现在需要使用ajax的加载product list,实现当前页面动态加载后面页面的内容。这个时候页面排序和排序方式用户可以自己选择的,就需要动态的获取,当前的排序方式。
$_productCollection = Mage::getResourceModel('catalog/product_collection') ->addAttributeToSelect('*') ->addAttributeToFilter('visibility', $visibility) ............. ->setStoreId($storeId) ->addStoreFilter($storeId) ->addCategoryFilter($_featcategory) //feature category to list first //set order as CurrentOrder ->setOrder(Mage::getBlockSingleton('catalog/product_list_toolbar')->getCurrentOrder(), Mage::getBlockSingleton('catalog/product_list_toolbar')->getCurrentDirection()) .......................
代码中如下两行分别获取order和direction,动态的设置collection
Mage::getBlockSingleton(‘catalog/product_list_toolbar’)->getCurrentOrder();
Mage::getBlockSingleton(‘catalog/product_list_toolbar’)->getCurrentDirection();
转载表明出处:www.hellokeykey.com
0 0
- Magento获取当前Collection的排序方式
- magento 让collection的排序方式按照ID数组的顺序排序
- Magento 获取当前页面body的class
- magento 获取当前store的信息
- magento获取当前路径
- magento获取当前路径
- magento获取指定attribute collection
- magento如何改变产品的排序方式
- magento:如何改变产品的排序方式
- magento 的特色产品获取方式
- Magento 获取当前的URL/Magento中获取URL相关参数的方法
- Magento 获取当前分类名称
- 有用的Magento Collection函数
- 关于magento collection的join
- Magento 如何在产品页获取当前产品的销量
- magento获取判断当前页或句柄handles的语法
- magento get current variable 获取当前的通用变量
- magento获取当前站点的所有产品分类列表
- 如何用bat文件快速发布.net创建的widows服务
- 传值调用
- wpa_supplicant 配置
- GridLayout
- Android内存泄漏分析及调试
- Magento获取当前Collection的排序方式
- Unity和android通信
- 让图片在页面中飘浮
- tomcat8 下访问jsp,报告serverlet fillter出错
- Could not execute JDBC batch update
- LoaderManager&Loader源码剖析(1) – Activity对LoaderManager的管理
- spring mvc json @ResponseBody 出现406错误 not acceptable ,解决方法,亲测可行
- sharedpreference中putStringSet和getStringSet的问题
- Qt:内建对话框