/**
  * Set collection parameters
  *
  * @param Mage_Eav_Model_Resource_Entity_Attribute_Option_Collection $collection
  * @return Mage_Eav_Model_Resource_Entity_Attribute_Option_Collection
  */
 public function prepareCollection(Mage_Eav_Model_Resource_Entity_Attribute_Option_Collection $collection)
 {
     if ($this->_pageSize && $this->_currentPage) {
         $collection->setPageSize($this->_pageSize)->setCurPage($this->_currentPage)->setOrder('main_table.sort_order', Zend_Db_Select::SQL_ASC);
         if (array_key_exists('sort_alpha_value', $collection->getSelect()->getPart(Zend_Db_Select::FROM))) {
             $collection->addOrder('sort_alpha_value.value', Zend_Db_Select::SQL_ASC);
         }
         $collection->setFlag(self::FLAG_REVERT_COLLECTION, true);
     }
     return $collection;
 }
 /**
  * Returns true if given option collection has store filter applied to select values per store.
  *
  * If so, the pagination must not be applied
  *
  * @see IntegerNet_AttributeOptionPager_Model_Observer::setPageOnCollection()
  * @see Mage_Eav_Model_Resource_Entity_Attribute_Option_Collection::setStoreFilter()
  *
  * @param Mage_Eav_Model_Resource_Entity_Attribute_Option_Collection $collection
  * @return bool
  * @throws Zend_Db_Select_Exception
  */
 public function isOptionCollectionStoreFiltered(Mage_Eav_Model_Resource_Entity_Attribute_Option_Collection $collection)
 {
     $joins = $collection->getSelect()->getPart(Zend_Db_Select::FROM);
     return array_key_exists('tsv', $joins) || array_key_exists('tdv', $joins);
 }