示例#1
0
 /**
  * Set collection to pager
  *
  * @param Varien_Data_Collection $collection
  * @return Mage_Catalog_Block_Product_List_Toolbar
  */
 public function setCollection($collection)
 {
     $this->_collection = $collection;
     $this->_collection->setCurPage($this->getCurrentPage());
     // we need to set pagination only if passed value integer and more that 0
     $limit = (int) $this->getLimit();
     if ($limit) {
         $this->_collection->setPageSize($limit);
     }
     if ($this->getCurrentOrder()) {
         $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
     }
     return $this;
 }
 /**
  * Set sort order
  *
  * @param string $field
  * @param string $direction
  * @param boolean $unshift
  * @return Enterprise_CatalogEvent_Model_Resource_Event_Collection
  */
 protected function _setOrder($field, $direction, $unshift = false)
 {
     if ($field == 'category_name' && $this->_categoryDataAdded) {
         $field = 'category_position';
     }
     return parent::setOrder($field, $direction, $unshift);
 }