Mage_Catalog_Model_Product_Option_Type_Text Class Reference

Inheritance diagram for Mage_Catalog_Model_Product_Option_Type_Text:

Mage_Catalog_Model_Product_Option_Type_Default Varien_Object

List of all members.

Public Member Functions

 validateUserValue ($values)
 prepareForCart ()
 getFormattedOptionValue ($value)


Detailed Description

Definition at line 34 of file Text.php.


Member Function Documentation

getFormattedOptionValue ( value  ) 

Return formatted option value for quote option

Parameters:
string $value Prepared for cart option value
Returns:
string

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

Returns:
mixed Prepared option value

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

Exceptions:
Mage_Core_Exception 
Parameters:
array $values All product option values, i.e. array (option_id => mixed, option_id => mixed...)
Returns:
Mage_Catalog_Model_Product_Option_Type_Default

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     }


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

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