I am having magento grid sort option like bellow
- Best Value
- Price
- Name
I want to modify it like bellow
- My whislist
- Price: High to Low
- Price:Low to High
- Designer:A-z
- 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.
精彩评论