Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Value_Collection Class Reference

Inheritance diagram for Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Value_Collection:

Mage_Core_Model_Mysql4_Collection_Abstract Varien_Data_Collection_Db Varien_Data_Collection

List of all members.

Public Member Functions

 getValues ($store_id)
 addTitlesToResult ($store_id)
 addTitleToResult ($store_id)
 addPriceToResult ($store_id)
 getValuesByOption ($optionIds, $store_id)
 addOptionToFilter ($option)

Protected Member Functions

 _construct ()


Detailed Description

Definition at line 35 of file Collection.php.


Member Function Documentation

_construct (  )  [protected]

Initialization here

Reimplemented from Mage_Core_Model_Mysql4_Collection_Abstract.

Definition at line 38 of file Collection.php.

00039     {
00040         $this->_init('catalog/product_option_value');
00041     }

addOptionToFilter ( option  ) 

Definition at line 127 of file Collection.php.

00128     {
00129         if (empty($option)) {
00130             $this->addFieldToFilter('option_id', '');
00131         } elseif (is_array($option)) {
00132             $this->addFieldToFilter('option_id', array('in' => $option));
00133         } elseif ($option instanceof Mage_Catalog_Model_Product_Option) {
00134             $this->addFieldToFilter('option_id', $option->getId());
00135         } else {
00136             $this->addFieldToFilter('option_id', $option);
00137         }
00138 
00139         return $this;
00140     }

addPriceToResult ( store_id  ) 

Definition at line 100 of file Collection.php.

00101     {
00102         $this->getSelect()
00103             ->joinLeft(array('default_value_price'=>$this->getTable('catalog/product_option_type_price')),
00104                 '`default_value_price`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`default_value_price`.store_id=?',0),
00105                 array('default_price'=>'price','default_price_type'=>'price_type'))
00106             ->joinLeft(array('store_value_price'=>$this->getTable('catalog/product_option_type_price')),
00107                 '`store_value_price`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`store_value_price`.store_id=?', $store_id),
00108                 array('store_price'=>'price','store_price_type'=>'price_type',
00109                 'price'=>new Zend_Db_Expr('IFNULL(`store_value_price`.price,`default_value_price`.price)'),
00110                 'price_type'=>new Zend_Db_Expr('IFNULL(`store_value_price`.price_type,`default_value_price`.price_type)')));
00111 
00112         return $this;
00113     }

addTitlesToResult ( store_id  ) 

Definition at line 64 of file Collection.php.

00065     {
00066         $this->getSelect()
00067             ->joinLeft(array('default_value_price'=>$this->getTable('catalog/product_option_type_price')),
00068                 '`default_value_price`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`default_value_price`.store_id=?',0),
00069                 array('default_price'=>'price','default_price_type'=>'price_type'))
00070             ->joinLeft(array('store_value_price'=>$this->getTable('catalog/product_option_type_price')),
00071                 '`store_value_price`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`store_value_price`.store_id=?', $store_id),
00072                 array('store_price'=>'price','store_price_type'=>'price_type',
00073                 'price'=>new Zend_Db_Expr('IFNULL(`store_value_price`.price,`default_value_price`.price)'),
00074                 'price_type'=>new Zend_Db_Expr('IFNULL(`store_value_price`.price_type,`default_value_price`.price_type)')))
00075             ->join(array('default_value_title'=>$this->getTable('catalog/product_option_type_title')),
00076                 '`default_value_title`.option_type_id=`main_table`.option_type_id',
00077                 array('default_title'=>'title'))
00078             ->joinLeft(array('store_value_title'=>$this->getTable('catalog/product_option_type_title')),
00079                 '`store_value_title`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`store_value_title`.store_id=?',$store_id),
00080                 array('store_title'=>'title','title'=>new Zend_Db_Expr('IFNULL(`store_value_title`.title,`default_value_title`.title)')))
00081             ->where('`default_value_title`.store_id=?',0);
00082 
00083         return $this;
00084     }

addTitleToResult ( store_id  ) 

Definition at line 86 of file Collection.php.

00087     {
00088         $this->getSelect()
00089             ->join(array('default_value_title'=>$this->getTable('catalog/product_option_type_title')),
00090                 '`default_value_title`.option_type_id=`main_table`.option_type_id',
00091                 array('default_title'=>'title'))
00092             ->joinLeft(array('store_value_title'=>$this->getTable('catalog/product_option_type_title')),
00093                 '`store_value_title`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`store_value_title`.store_id=?',$store_id),
00094                 array('store_title'=>'title','title'=>new Zend_Db_Expr('IFNULL(`store_value_title`.title,`default_value_title`.title)')))
00095             ->where('`default_value_title`.store_id=?',0);
00096 
00097         return $this;
00098     }

getValues ( store_id  ) 

Definition at line 43 of file Collection.php.

00044     {
00045         $this->getSelect()
00046             ->joinLeft(array('default_value_price'=>$this->getTable('catalog/product_option_type_price')),
00047                 '`default_value_price`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`default_value_price`.store_id=?',0),
00048                 array('default_price'=>'price','default_price_type'=>'price_type'))
00049             ->joinLeft(array('store_value_price'=>$this->getTable('catalog/product_option_type_price')),
00050                 '`store_value_price`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`store_value_price`.store_id=?', $store_id),
00051                 array('store_price'=>'price','store_price_type'=>'price_type',
00052                 'price'=>new Zend_Db_Expr('IFNULL(`store_value_price`.price,`default_value_price`.price)'),
00053                 'price_type'=>new Zend_Db_Expr('IFNULL(`store_value_price`.price_type,`default_value_price`.price_type)')))
00054             ->join(array('default_value_title'=>$this->getTable('catalog/product_option_type_title')),
00055                 '`default_value_title`.option_type_id=`main_table`.option_type_id',
00056                 array('default_title'=>'title'))
00057             ->joinLeft(array('store_value_title'=>$this->getTable('catalog/product_option_type_title')),
00058                 '`store_value_title`.option_type_id=`main_table`.option_type_id AND '.$this->getConnection()->quoteInto('`store_value_title`.store_id=?',$store_id),
00059                 array('store_title'=>'title','title'=>new Zend_Db_Expr('IFNULL(`store_value_title`.title,`default_value_title`.title)')))
00060             ->where('`default_value_title`.store_id=?',0);
00061         return $this;
00062     }

getValuesByOption ( optionIds,
store_id 
)

Definition at line 115 of file Collection.php.

00116     {
00117         if (!is_array($optionIds)) {
00118             $optionIds = array($optionIds);
00119         }
00120 
00121         $this->getSelect()
00122             ->where('`main_table`.option_type_id IN (?)', $optionIds);
00123 
00124         return $this;
00125     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:45 2009 for Magento by  doxygen 1.5.8