I am editing "You may also be interested" section (Up-sells products section) in the Product Detail page. I need to remove the current product from "You may also interested" section.
Up-sells products section displays the current product of category product (which most viewed). But I have issue when I go to "You may also be interested" section on product detail page; the current product is also getting displayed on this. I just need to remove the current product from "You may also be interested" section.
Example: I have 4 products in Up-sells section:
Test1, Test2, Test3, Test4
I am getting this but when I go to Test1 product detail page, then I need to not display Test1 under "You may also be interested" section.
Here is the code I've used so far:
$products = Mage::getResourceModel('reports/product_collection')
->addAttributeToSelect('*')
//->addAttributeToFilter('entity_id', array('neq' => $product_id))
->addViewsCount()
->joinField('category_id',
'catalog/category_product',
'category_id',
'product_id=entity_id',
null,
'left'
)
//->addAttributeToFilter('category_ids',array('finset'=>$category_ids))
//->addCategoryFilter($category)
->setStoreId($storeId)
->addStoreFilter($storeId)
//
->setPageSize(4)
->addAttributeToFilter('category_id', array('in' => $category_ids ));
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);