Static Public Member Functions | |
| static | factory ($product, $singleton=false) |
| static | priceFactory ($productType) |
| static | getOptionArray () |
| static | getAllOption () |
| static | getAllOptions () |
| static | getOptions () |
| static | getOptionText ($optionId) |
| static | getTypes () |
| static | getCompositeTypes () |
Public Attributes | |
| const | TYPE_SIMPLE = 'simple' |
| const | TYPE_BUNDLE = 'bundle' |
| const | TYPE_CONFIGURABLE = 'configurable' |
| const | TYPE_GROUPED = 'grouped' |
| const | TYPE_VIRTUAL = 'virtual' |
| const | DEFAULT_TYPE = 'simple' |
| const | DEFAULT_TYPE_MODEL = 'catalog/product_type_simple' |
| const | DEFAULT_PRICE_MODEL = 'catalog/product_type_price' |
Static Protected Attributes | |
| static | $_types |
| static | $_compositeTypes |
| static | $_priceModels |
Definition at line 34 of file Type.php.
| static factory | ( | $ | product, | |
| $ | singleton = false | |||
| ) | [static] |
Product type instance factory
| Mage_Catalog_Model_Product | $product | |
| bool | $singleton |
Definition at line 60 of file Type.php.
00061 { 00062 $types = self::getTypes(); 00063 00064 if (!empty($types[$product->getTypeId()]['model'])) { 00065 $typeModelName = $types[$product->getTypeId()]['model']; 00066 } else { 00067 $typeModelName = self::DEFAULT_TYPE_MODEL; 00068 } 00069 00070 if ($singleton === true) { 00071 $typeModel = Mage::getSingleton($typeModelName); 00072 } 00073 else { 00074 $typeModel = Mage::getModel($typeModelName); 00075 $typeModel->setProduct($product); 00076 } 00077 $typeModel->setConfig($types[$product->getTypeId()]); 00078 return $typeModel; 00079 }
| static getAllOption | ( | ) | [static] |
Definition at line 115 of file Type.php.
00116 { 00117 $options = self::getOptionArray(); 00118 array_unshift($options, array('value'=>'', 'label'=>'')); 00119 return $options; 00120 }
| static getAllOptions | ( | ) | [static] |
| static getCompositeTypes | ( | ) | [static] |
Return composite product type Ids
Definition at line 167 of file Type.php.
00168 { 00169 if (is_null(self::$_compositeTypes)) { 00170 self::$_compositeTypes = array(); 00171 $types = self::getTypes(); 00172 foreach ($types as $typeId=>$typeInfo) { 00173 if (array_key_exists('composite', $typeInfo) && $typeInfo['composite']) { 00174 self::$_compositeTypes[] = $typeId; 00175 } 00176 } 00177 } 00178 return self::$_compositeTypes; 00179 }
| static getOptionArray | ( | ) | [static] |
| static getOptions | ( | ) | [static] |
| static getOptionText | ( | $ | optionId | ) | [static] |
Definition at line 147 of file Type.php.
00148 { 00149 $options = self::getOptionArray(); 00150 return isset($options[$optionId]) ? $options[$optionId] : null; 00151 }
| static getTypes | ( | ) | [static] |
Definition at line 153 of file Type.php.
00154 { 00155 if (is_null(self::$_types)) { 00156 self::$_types = Mage::getConfig()->getNode('global/catalog/product/type')->asArray(); 00157 } 00158 00159 return self::$_types; 00160 }
| static priceFactory | ( | $ | productType | ) | [static] |
Product type price model factory
| string | $productType |
Definition at line 87 of file Type.php.
00088 { 00089 if (isset(self::$_priceModels[$productType])) { 00090 return self::$_priceModels[$productType]; 00091 } 00092 00093 $types = self::getTypes(); 00094 00095 if (!empty($types[$productType]['price_model'])) { 00096 $priceModelName = $types[$productType]['price_model']; 00097 } else { 00098 $priceModelName = self::DEFAULT_PRICE_MODEL; 00099 } 00100 00101 self::$_priceModels[$productType] = Mage::getModel($priceModelName); 00102 return self::$_priceModels[$productType]; 00103 }
| const DEFAULT_PRICE_MODEL = 'catalog/product_type_price' |
| const DEFAULT_TYPE = 'simple' |
| const DEFAULT_TYPE_MODEL = 'catalog/product_type_simple' |
| const TYPE_BUNDLE = 'bundle' |
| const TYPE_CONFIGURABLE = 'configurable' |
| const TYPE_GROUPED = 'grouped' |
| const TYPE_SIMPLE = 'simple' |
| const TYPE_VIRTUAL = 'virtual' |
1.5.8