Public Member Functions | |
__construct () | |
addVisibleInCatalogFilterToCollection (Mage_Eav_Model_Entity_Collection_Abstract $collection) | |
addVisibleInSearchFilterToCollection (Mage_Eav_Model_Entity_Collection_Abstract $collection) | |
addVisibleInSiteFilterToCollection (Mage_Eav_Model_Entity_Collection_Abstract $collection) | |
getVisibleInCatalogIds () | |
getVisibleInSearchIds () | |
getVisibleInSiteIds () | |
getFlatColums () | |
getFlatIndexes () | |
getFlatUpdateSelect ($store) | |
setAttribute ($attribute) | |
getAttribute () | |
addValueSortToCollection ($collection, $dir= 'asc') | |
Static Public Member Functions | |
static | getOptionArray () |
static | getAllOption () |
static | getAllOptions () |
static | getOptionText ($optionId) |
Public Attributes | |
const | VISIBILITY_NOT_VISIBLE = 1 |
const | VISIBILITY_IN_CATALOG = 2 |
const | VISIBILITY_IN_SEARCH = 3 |
const | VISIBILITY_BOTH = 4 |
Protected Attributes | |
$_attribute |
Definition at line 35 of file Visibility.php.
__construct | ( | ) |
Initialize object
Reimplemented from Varien_Object.
Definition at line 53 of file Visibility.php.
00054 { 00055 parent::__construct(); 00056 $this->setIdFieldName('visibility_id'); 00057 }
addValueSortToCollection | ( | $ | collection, | |
$ | dir = 'asc' | |||
) |
Add Value Sort To Collection Select
Mage_Eav_Model_Entity_Collection_Abstract | $collection | |
string | $dir direction |
Definition at line 249 of file Visibility.php.
00250 { 00251 if ($this->getAttribute()->isScopeGlobal()) { 00252 $tableName = $this->getAttribute()->getAttributeCode() . '_t'; 00253 $collection->getSelect() 00254 ->joinLeft( 00255 array($tableName => $this->getAttribute()->getBackend()->getTable()), 00256 "`e`.`entity_id`=`{$tableName}`.`entity_id`" 00257 . " AND `{$tableName}`.`attribute_id`='{$this->getAttribute()->getId()}'" 00258 . " AND `{$tableName}`.`store_id`='0'", 00259 array()); 00260 $valueExpr = $tableName . '.value'; 00261 } 00262 else { 00263 $valueTable1 = $this->getAttribute()->getAttributeCode() . '_t1'; 00264 $valueTable2 = $this->getAttribute()->getAttributeCode() . '_t2'; 00265 $collection->getSelect() 00266 ->joinLeft( 00267 array($valueTable1 => $this->getAttribute()->getBackend()->getTable()), 00268 "`e`.`entity_id`=`{$valueTable1}`.`entity_id`" 00269 . " AND `{$valueTable1}`.`attribute_id`='{$this->getAttribute()->getId()}'" 00270 . " AND `{$valueTable1}`.`store_id`='0'", 00271 array()) 00272 ->joinLeft( 00273 array($valueTable2 => $this->getAttribute()->getBackend()->getTable()), 00274 "`e`.`entity_id`=`{$valueTable2}`.`entity_id`" 00275 . " AND `{$valueTable2}`.`attribute_id`='{$this->getAttribute()->getId()}'" 00276 . " AND `{$valueTable2}`.`store_id`='{$collection->getStoreId()}'", 00277 array() 00278 ); 00279 $valueExpr = new Zend_Db_Expr("IFNULL(`{$valueTable2}`.`value`, `{$valueTable1}`.`value`)"); 00280 } 00281 00282 $collection->getSelect()->order($valueExpr . ' ' . $dir); 00283 return $this; 00284 }
addVisibleInCatalogFilterToCollection | ( | Mage_Eav_Model_Entity_Collection_Abstract $ | collection | ) |
Add visible in catalog filter to collection
Mage_Eav_Model_Entity_Collection_Abstract | $collection |
Definition at line 66 of file Visibility.php.
00067 { 00068 $collection->setVisibility($this->getVisibleInCatalogIds()); 00069 // $collection->addAttributeToFilter('visibility', array('in'=>$this->getVisibleInCatalogIds())); 00070 return $this; 00071 }
addVisibleInSearchFilterToCollection | ( | Mage_Eav_Model_Entity_Collection_Abstract $ | collection | ) |
Add visibility in searchfilter to collection
Mage_Eav_Model_Entity_Collection_Abstract | $collection |
Definition at line 80 of file Visibility.php.
00081 { 00082 $collection->setVisibility($this->getVisibleInSearchIds()); 00083 //$collection->addAttributeToFilter('visibility', array('in'=>$this->getVisibleInSearchIds())); 00084 return $this; 00085 }
addVisibleInSiteFilterToCollection | ( | Mage_Eav_Model_Entity_Collection_Abstract $ | collection | ) |
Add visibility in site filter to collection
Mage_Eav_Model_Entity_Collection_Abstract | $collection |
Definition at line 94 of file Visibility.php.
00095 { 00096 $collection->setVisibility($this->getVisibleInSiteIds()); 00097 //$collection->addAttributeToFilter('visibility', array('in'=>$this->getVisibleInSiteIds())); 00098 return $this; 00099 }
static getAllOption | ( | ) | [static] |
Retrieve all options
Definition at line 151 of file Visibility.php.
00152 { 00153 $options = self::getOptionArray(); 00154 array_unshift($options, array('value'=>'', 'label'=>'')); 00155 return $options; 00156 }
static getAllOptions | ( | ) | [static] |
Retireve all options
Definition at line 163 of file Visibility.php.
00164 { 00165 $res = array(); 00166 $res[] = array('value'=>'', 'label'=> Mage::helper('catalog')->__('-- Please Select --')); 00167 foreach (self::getOptionArray() as $index => $value) { 00168 $res[] = array( 00169 'value' => $index, 00170 'label' => $value 00171 ); 00172 } 00173 return $res; 00174 }
getAttribute | ( | ) |
getFlatColums | ( | ) |
Retrieve Column(s) for Flat
Definition at line 193 of file Visibility.php.
00194 { 00195 return array(); 00196 }
getFlatIndexes | ( | ) |
Retrieve Indexes for Flat
Definition at line 203 of file Visibility.php.
00204 { 00205 return array(); 00206 }
getFlatUpdateSelect | ( | $ | store | ) |
Retrieve Select For Flat Attribute update
Mage_Catalog_Model_Resource_Eav_Attribute | $attribute | |
int | $store |
Definition at line 215 of file Visibility.php.
static getOptionArray | ( | ) | [static] |
Retrieve option array
Definition at line 136 of file Visibility.php.
00137 { 00138 return array( 00139 self::VISIBILITY_NOT_VISIBLE=> Mage::helper('catalog')->__('Nowhere'), 00140 self::VISIBILITY_IN_CATALOG => Mage::helper('catalog')->__('Catalog'), 00141 self::VISIBILITY_IN_SEARCH => Mage::helper('catalog')->__('Search'), 00142 self::VISIBILITY_BOTH => Mage::helper('catalog')->__('Catalog, Search') 00143 ); 00144 }
static getOptionText | ( | $ | optionId | ) | [static] |
Retrieve option text
int | $optionId |
Definition at line 182 of file Visibility.php.
00183 { 00184 $options = self::getOptionArray(); 00185 return isset($options[$optionId]) ? $options[$optionId] : null; 00186 }
getVisibleInCatalogIds | ( | ) |
Retrieve visible in catalog ids array
Definition at line 106 of file Visibility.php.
00107 { 00108 return array(self::VISIBILITY_IN_CATALOG, self::VISIBILITY_BOTH); 00109 }
getVisibleInSearchIds | ( | ) |
Retrieve visible in search ids array
Definition at line 116 of file Visibility.php.
00117 { 00118 return array(self::VISIBILITY_IN_SEARCH, self::VISIBILITY_BOTH); 00119 }
getVisibleInSiteIds | ( | ) |
Retrieve visible in site ids array
Definition at line 126 of file Visibility.php.
00127 { 00128 return array(self::VISIBILITY_IN_SEARCH, self::VISIBILITY_IN_CATALOG, self::VISIBILITY_BOTH); 00129 }
setAttribute | ( | $ | attribute | ) |
Set attribute instance
Mage_Catalog_Model_Resource_Eav_Attribute | $attribute |
Definition at line 226 of file Visibility.php.
00227 { 00228 $this->_attribute = $attribute; 00229 return $this; 00230 }
$_attribute [protected] |
Definition at line 47 of file Visibility.php.
const VISIBILITY_BOTH = 4 |
Definition at line 40 of file Visibility.php.
const VISIBILITY_IN_CATALOG = 2 |
Definition at line 38 of file Visibility.php.
const VISIBILITY_IN_SEARCH = 3 |
Definition at line 39 of file Visibility.php.
const VISIBILITY_NOT_VISIBLE = 1 |
Definition at line 37 of file Visibility.php.