Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. /app/code/core/Mage/Catalog/Block/Product/List.php
  2.  
  3. protected function _getProductCollection()
  4. {
  5. if (is_null($this->_productCollection)) {
  6. $layer = $this->getLayer();
  7. /* @var $layer Mage_Catalog_Model_Layer */
  8. if ($this->getShowRootCategory()) {
  9. $this->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
  10. }
  11.  
  12. // if this is a product view page
  13. if (Mage::registry('product')) {
  14. // get collection of categories this product is associated with
  15. $categories = Mage::registry('product')->getCategoryCollection()
  16. ->setPage(1, 1)
  17. ->load();
  18. // if the product is associated with any category
  19. if ($categories->count()) {
  20. // show products from this category
  21. $this->setCategoryId(current($categories->getIterator()));
  22. }
  23. }
  24.  
  25. $origCategory = null;
  26. if ($this->getCategoryId()) {
  27. $category = Mage::getModel('catalog/category')->load($this->getCategoryId());
  28. if ($category->getId()) {
  29. $origCategory = $layer->getCurrentCategory();
  30. $layer->setCurrentCategory($category);
  31. $this->addModelTags($category);
  32. }
  33. }
  34. $this->_productCollection = $layer->getProductCollection();
  35.  
  36. $this->prepareSortableFieldsByCategory($layer->getCurrentCategory());
  37.  
  38. if ($origCategory) {
  39. $layer->setCurrentCategory($origCategory);
  40. }
  41. }
  42.  
  43. return $this->_productCollection;
  44. }
  45.  
  46. $this->_productCollection = $layer->getProductCollection();
  47.  
  48. $prodctCollection = $layer->getProductCollection();
  49. $this->_productCollection = $productCollection->addAttributeToFilter('is_master_record',1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement