/** * Load collection * * @param bool $printQuery * @param bool $logQuery * @return Mage_Catalog_Model_Resource_Category_Collection */ public function load($printQuery = false, $logQuery = false) { if ($this->isLoaded()) { return $this; } if ($this->_loadWithProductCount) { $this->addAttributeToSelect('all_children'); $this->addAttributeToSelect('is_anchor'); } parent::load($printQuery, $logQuery); if ($this->_loadWithProductCount) { $this->_loadProductCount(); } return $this; }
/** * Set Order field * * @param string $attribute * @param string $dir * @return Mage_Catalog_Model_Resource_Product_Collection */ public function setOrder($attribute, $dir = 'desc') { if ($attribute == 'price') { $this->addAttributeToSort($attribute, $dir); } else { parent::setOrder($attribute, $dir); } return $this; }
/** * Clear collection * * @return Mage_Catalog_Model_Resource_Product_Collection */ public function clear() { foreach ($this->_items as $i => $item) { if ($item->hasStockItem()) { $item->unsStockItem(); } $item = $this->_items[$i] = null; } foreach ($this->_itemsById as $i => $item) { $item = $this->_itemsById[$i] = null; } unset($this->_items, $this->_data, $this->_itemsById); $this->_data = array(); $this->_itemsById = array(); return parent::clear(); }