开发者

custom sort list in magento grid

开发者 https://www.devze.com 2023-04-11 03:43 出处:网络
I am having magento grid sort option like bellow Best Value Price Name I want to modify it like bellow My whislist

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号