Public Member Functions | |
validateUserValue ($values) | |
prepareForCart () | |
getFormattedOptionValue ($value) |
Definition at line 34 of file Text.php.
getFormattedOptionValue | ( | $ | value | ) |
Return formatted option value for quote option
string | $value Prepared for cart option value |
Reimplemented from Mage_Catalog_Model_Product_Option_Type_Default.
Definition at line 81 of file Text.php.
00082 { 00083 return Mage::helper('core')->htmlEscape($value); 00084 }
prepareForCart | ( | ) |
Prepare option value for cart
Reimplemented from Mage_Catalog_Model_Product_Option_Type_Default.
Definition at line 66 of file Text.php.
00067 { 00068 if ($this->getIsValid() && strlen($this->getUserValue()) > 0) { 00069 return $this->getUserValue(); 00070 } else { 00071 return null; 00072 } 00073 }
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 from Mage_Catalog_Model_Product_Option_Type_Default.
Definition at line 43 of file Text.php.
00044 { 00045 parent::validateUserValue($values); 00046 00047 $option = $this->getOption(); 00048 $value = trim($this->getUserValue()); 00049 if (strlen($value) == 0 && $option->getIsRequire() && !$this->getProduct()->getSkipCheckRequiredOption()) { 00050 $this->setIsValid(false); 00051 Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option(s)')); 00052 } 00053 if (strlen($value) > $option->getMaxCharacters() && $option->getMaxCharacters() > 0) { 00054 $this->setIsValid(false); 00055 Mage::throwException(Mage::helper('catalog')->__('Length of text is too long')); 00056 } 00057 $this->setUserValue($value); 00058 return $this; 00059 }