Public Member Functions | |
setOption ($option) | |
getOption () | |
setProduct ($product) | |
getProduct () | |
getQuoteItemOption () | |
getQuoteItem () | |
getRequest () | |
getConfigData ($key) | |
validateUserValue ($values) | |
prepareForCart () | |
isCustomizedView () | |
getFormattedOptionValue ($optionValue) | |
getCustomizedView ($optionInfo) | |
getPrintableOptionValue ($optionValue) | |
getEditableOptionValue ($optionValue) | |
parseOptionValue ($optionValue, $productOptionValues) | |
prepareOptionValueForRequest ($optionValue) | |
getOptionPrice ($optionValue, $basePrice) | |
getOptionSku ($optionValue, $skuDelimiter) | |
getProductOptions () | |
Protected Member Functions | |
_getChargableOptionPrice ($price, $isPercent, $basePrice) | |
Protected Attributes | |
$_option | |
$_product | |
$_productOptions = array() |
Definition at line 34 of file Default.php.
_getChargableOptionPrice | ( | $ | price, | |
$ | isPercent, | |||
$ | basePrice | |||
) | [protected] |
Return final chargable price for option
float | $price Price of option | |
boolean | $isPercent Price type - percent or fixed | |
float | $basePrice For percent price type |
Definition at line 343 of file Default.php.
00344 { 00345 if($isPercent) { 00346 return ($basePrice * $price / 100); 00347 } else { 00348 return $price; 00349 } 00350 }
getConfigData | ( | $ | key | ) |
Store Config value
string | $key Config value key |
Definition at line 156 of file Default.php.
00157 { 00158 return Mage::getStoreConfig('catalog/custom_options/' . $key); 00159 }
getCustomizedView | ( | $ | optionInfo | ) |
Return option html
array | $optionInfo |
Reimplemented in Mage_Catalog_Model_Product_Option_Type_File.
Definition at line 225 of file Default.php.
getEditableOptionValue | ( | $ | optionValue | ) |
Return formatted option value ready to edit, ready to parse (ex: Admin re-order, see Mage_Adminhtml_Model_Sales_Order_Create)
string | $optionValue Prepared for cart option value |
Reimplemented in Mage_Catalog_Model_Product_Option_Type_Date, Mage_Catalog_Model_Product_Option_Type_File, and Mage_Catalog_Model_Product_Option_Type_Select.
Definition at line 248 of file Default.php.
getFormattedOptionValue | ( | $ | optionValue | ) |
Return formatted option value for quote option
string | $optionValue Prepared for cart option value |
Reimplemented in Mage_Catalog_Model_Product_Option_Type_Date, Mage_Catalog_Model_Product_Option_Type_File, Mage_Catalog_Model_Product_Option_Type_Select, and Mage_Catalog_Model_Product_Option_Type_Text.
Definition at line 214 of file Default.php.
getOption | ( | ) |
Option Instance getter
Mage_Core_Exception |
Definition at line 77 of file Default.php.
00078 { 00079 if ($this->_option instanceof Mage_Catalog_Model_Product_Option) { 00080 return $this->_option; 00081 } 00082 Mage::throwException(Mage::helper('catalog')->__('Wrong option instance type in options group')); 00083 }
getOptionPrice | ( | $ | optionValue, | |
$ | basePrice | |||
) |
Return Price for selected option
string | $optionValue Prepared for cart option value | |
float | $basePrice For percent price type |
Reimplemented in Mage_Catalog_Model_Product_Option_Type_Select.
Definition at line 283 of file Default.php.
00284 { 00285 $option = $this->getOption(); 00286 00287 return $this->_getChargableOptionPrice( 00288 $option->getPrice(), 00289 $option->getPriceType() == 'percent', 00290 $basePrice 00291 ); 00292 }
getOptionSku | ( | $ | optionValue, | |
$ | skuDelimiter | |||
) |
Return SKU for selected option
string | $optionValue Prepared for cart option value | |
string | $skuDelimiter Delimiter for Sku parts |
Reimplemented in Mage_Catalog_Model_Product_Option_Type_Select.
Definition at line 301 of file Default.php.
00302 { 00303 return $this->getOption()->getSku(); 00304 }
getPrintableOptionValue | ( | $ | optionValue | ) |
Return printable option value
string | $optionValue Prepared for cart option value |
Reimplemented in Mage_Catalog_Model_Product_Option_Type_Date, Mage_Catalog_Model_Product_Option_Type_File, and Mage_Catalog_Model_Product_Option_Type_Select.
Definition at line 236 of file Default.php.
getProduct | ( | ) |
Product Instance getter
Mage_Core_Exception |
Definition at line 103 of file Default.php.
00104 { 00105 if ($this->_product instanceof Mage_Catalog_Model_Product) { 00106 return $this->_product; 00107 } 00108 Mage::throwException(Mage::helper('catalog')->__('Wrong product instance type in options group')); 00109 }
getProductOptions | ( | ) |
Return value => key all product options (using for parsing)
Definition at line 311 of file Default.php.
00312 { 00313 if (!isset($this->_productOptions[$this->getProduct()->getId()])) { 00314 foreach ($this->getProduct()->getOptions() as $_option) { 00315 /* @var $option Mage_Catalog_Model_Product_Option */ 00316 $this->_productOptions[$this->getProduct()->getId()][$_option->getTitle()] = array('option_id' => $_option->getId()); 00317 if ($_option->getGroupByType() == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT) { 00318 $optionValues = array(); 00319 foreach ($_option->getValues() as $_value) { 00320 /* @var $value Mage_Catalog_Model_Product_Option_Value */ 00321 $optionValues[$_value->getTitle()] = $_value->getId(); 00322 } 00323 $this->_productOptions[$this->getProduct()->getId()][$_option->getTitle()]['values'] = $optionValues; 00324 } else { 00325 $this->_productOptions[$this->getProduct()->getId()][$_option->getTitle()]['values'] = array(); 00326 } 00327 } 00328 } 00329 if (isset($this->_productOptions[$this->getProduct()->getId()])) { 00330 return $this->_productOptions[$this->getProduct()->getId()]; 00331 } 00332 return array(); 00333 }
getQuoteItem | ( | ) |
Getter for Quote Item
Definition at line 129 of file Default.php.
00130 { 00131 if ($this->_getData('quote_item') instanceof Mage_Sales_Model_Quote_Item) { 00132 return $this->_getData('quote_item'); 00133 } 00134 Mage::throwException(Mage::helper('catalog')->__('Wrong quote item instance in options group')); 00135 }
getQuoteItemOption | ( | ) |
Getter for Quote Item Option
Definition at line 116 of file Default.php.
00117 { 00118 if ($this->_getData('quote_item_option') instanceof Mage_Sales_Model_Quote_Item_Option) { 00119 return $this->_getData('quote_item_option'); 00120 } 00121 Mage::throwException(Mage::helper('catalog')->__('Wrong quote item option instance in options group')); 00122 }
getRequest | ( | ) |
Getter for Buy Request
Definition at line 142 of file Default.php.
00143 { 00144 if ($this->_getData('request') instanceof Varien_Object) { 00145 return $this->_getData('request'); 00146 } 00147 Mage::throwException(Mage::helper('catalog')->__('Wrong BuyRequest instance in options group')); 00148 }
isCustomizedView | ( | ) |
Flag to indicate that custom option has own customized output (blocks, native html etc.)
Reimplemented in Mage_Catalog_Model_Product_Option_Type_File.
Definition at line 203 of file Default.php.
parseOptionValue | ( | $ | optionValue, | |
$ | productOptionValues | |||
) |
Parse user input value and return cart prepared value, i.e. "one, two" => "1,2"
string | $optionValue | |
array | $productOptionValues Values for product option |
Reimplemented in Mage_Catalog_Model_Product_Option_Type_Date, Mage_Catalog_Model_Product_Option_Type_File, and Mage_Catalog_Model_Product_Option_Type_Select.
Definition at line 260 of file Default.php.
prepareForCart | ( | ) |
Prepare option value for cart
Mage_Core_Exception |
Reimplemented in Mage_Catalog_Model_Product_Option_Type_Date, Mage_Catalog_Model_Product_Option_Type_File, Mage_Catalog_Model_Product_Option_Type_Select, and Mage_Catalog_Model_Product_Option_Type_Text.
Definition at line 190 of file Default.php.
00191 { 00192 if ($this->getIsValid()) { 00193 return $this->getUserValue(); 00194 } 00195 Mage::throwException(Mage::helper('catalog')->__('Option validation failed to add product to cart')); 00196 }
prepareOptionValueForRequest | ( | $ | optionValue | ) |
Prepare option value for info buy request
string | $optionValue |
Reimplemented in Mage_Catalog_Model_Product_Option_Type_Date, Mage_Catalog_Model_Product_Option_Type_File, and Mage_Catalog_Model_Product_Option_Type_Select.
Definition at line 271 of file Default.php.
setOption | ( | $ | option | ) |
Option Instance setter
Mage_Catalog_Model_Product_Option | $option |
Definition at line 65 of file Default.php.
setProduct | ( | $ | product | ) |
Product Instance setter
Mage_Catalog_Model_Product | $product |
Definition at line 91 of file Default.php.
validateUserValue | ( | $ | values | ) |
Validate user input for option
Mage_Core_Exception |
array | $values All product option values, i.e. array (option_id => mixed, option_id => mixed...) |
Reimplemented in Mage_Catalog_Model_Product_Option_Type_Date, Mage_Catalog_Model_Product_Option_Type_File, Mage_Catalog_Model_Product_Option_Type_Select, and Mage_Catalog_Model_Product_Option_Type_Text.
Definition at line 168 of file Default.php.
00169 { 00170 Mage::getSingleton('checkout/session')->setUseNotice(false); 00171 00172 $this->setIsValid(false); 00173 00174 $option = $this->getOption(); 00175 if (!isset($values[$option->getId()]) && $option->getIsRequire() && !$this->getProduct()->getSkipCheckRequiredOption()) { 00176 Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option(s)')); 00177 } elseif (isset($values[$option->getId()])) { 00178 $this->setUserValue($values[$option->getId()]); 00179 $this->setIsValid(true); 00180 } 00181 return $this; 00182 }
$_option [protected] |
Definition at line 41 of file Default.php.
$_product [protected] |
Definition at line 48 of file Default.php.
$_productOptions = array() [protected] |
Definition at line 57 of file Default.php.