Guest User

Untitled

a guest
Nov 22nd, 2017
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. Mage_CatalogSearch_Block_Result:_getProductCollection()
  2.  
  3. protected function _getProductCollection()
  4. {
  5. if (is_null($this->_productCollection)) {
  6. $this->_productCollection = $this->getListBlock()->getLoadedProductCollection();
  7. }
  8. $activeCategories = Mage::getResourceModel('catalog/category_collection')
  9. ->addAttributeToFilter('is_active', 1)
  10. ->getColumnValues('entity_id');
  11.  
  12. $this->_productCollection->joinField(
  13. 'category_id', 'catalog/category_product', 'category_id',
  14. 'product_id = entity_id', null, 'left'
  15. )
  16. ->addAttributeToSelect('*')
  17. ->addAttributeToFilter('category_id', array(
  18. array('in' => $activeCategories),
  19. ));
  20. $this->_productCollection->getSelect()->group('entity_id');
  21. // echo "<pre>";
  22. // print_r($this->_productCollection->getData());
  23. // die;
  24. return $this->_productCollection;
  25. }
Add Comment
Please, Sign In to add comment