magento 网格中的自定义排序列表

发布于 2024-12-09 00:53:30 字数 1335 浏览 6 评论 0原文

我有像下面这样的 magento 网格排序选项

  1. 最佳价值
  2. 价格
  3. 名称

我想像下面这样修改它

  1. 我的口哨清单
  2. 价格:从高到低
  3. 价格:从低到高
  4. 设计师:Az
  5. 设计师:ZA

设计师,价格是属性,所以可以添加它列表,但如何使其升序和降序排序。

如何按“我的愿望清单”对产品进行排序?

我尝试过此操作

$this->getOrderUrl('mywishlist', 'asc')

,但不起作用。

     $tbl_wishlist_item = Mage::getSingleton('core/resource')->getTableName('wishlist_item');
     $tbl_wishlist = Mage::getSingleton('core/resource')->getTableName('wishlist');
     $tbl_catindex = Mage::getSingleton('core/resource')->getTableName('catalog_category_product_index');
     $tbl_price_index = Mage::getSingleton('core/resource')->getTableName('catalog_product_index_price');

 $collection = Mage::getResourceModel('catalog/product_collection');
  $collection->getSelect()
             ->join(array('t2' => $tbl_wishlist_item),'e.entity_id = t2.product_id','*')
             ->join(array('t3' => $tbl_wishlist),'t2.wishlist_id = t3.wishlist_id','*')
             ->join(array('t4' => $tbl_catindex),'e.entity_id = t4.product_id','*')
             ->where('t4.category_id = 3 AND t3.customer_id='.$customer_id);

我尝试了这个集合,它对产品的正确数量进行了排序。但是没有显示任何产品对象,例如名称、图像、价格等。问题是什么。

I am having magento grid sort option like bellow

  1. Best Value
  2. Price
  3. Name

I want to modify it like bellow

  1. My whislist
  2. Price: High to Low
  3. Price:Low to High
  4. Designer:A-z
  5. Designer:Z-A

Designer,Price are attributes so can add it list but how to make it ascending and descending sorting.

How can i sort product by "My Wishlist" ?

I tried this

$this->getOrderUrl('mywishlist', 'asc')

But not working.

     $tbl_wishlist_item = Mage::getSingleton('core/resource')->getTableName('wishlist_item');
     $tbl_wishlist = Mage::getSingleton('core/resource')->getTableName('wishlist');
     $tbl_catindex = Mage::getSingleton('core/resource')->getTableName('catalog_category_product_index');
     $tbl_price_index = Mage::getSingleton('core/resource')->getTableName('catalog_product_index_price');

 $collection = Mage::getResourceModel('catalog/product_collection');
  $collection->getSelect()
             ->join(array('t2' => $tbl_wishlist_item),'e.entity_id = t2.product_id','*')
             ->join(array('t3' => $tbl_wishlist),'t2.wishlist_id = t3.wishlist_id','*')
             ->join(array('t4' => $tbl_catindex),'e.entity_id = t4.product_id','*')
             ->where('t4.category_id = 3 AND t3.customer_id='.$customer_id);

I tried this collection it sorts the correct number of product.But does n't show any products objects like name,image,price and etc. What is the problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文