Mage_GoogleOptimizer_Model_Code_Product Class Reference

Inheritance diagram for Mage_GoogleOptimizer_Model_Code_Product:

Mage_GoogleOptimizer_Model_Code Mage_Core_Model_Abstract Varien_Object

List of all members.

Public Member Functions

 getAttributes ()

Public Attributes

const DEFAULT_COUNT_OF_ATTRIBUTES = 8

Protected Member Functions

 _afterLoad ()
 _beforeSave ()
 _validate ()

Protected Attributes

 $_entityType = 'product'


Detailed Description

Definition at line 34 of file Product.php.


Member Function Documentation

_afterLoad (  )  [protected]

Processing object after load data

Returns:
Mage_Core_Model_Abstract

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 39 of file Product.php.

00040     {
00041         if ($data = $this->getAdditionalData()) {
00042             $data = unserialize($data);
00043             if (isset($data['attributes'])) {
00044                 $this->setAttributes($data['attributes']);
00045             }
00046         }
00047         return parent::_afterLoad();
00048     }

_beforeSave (  )  [protected]

Processing object before save data

Returns:
Mage_Core_Model_Abstract

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 50 of file Product.php.

00051     {
00052         if (!($attributes = $this->getData('attributes'))) {
00053             $attributes = array();
00054         }
00055         $this->setData('additional_data', serialize(array(
00056                 'attributes' => $attributes))
00057             );
00058         parent::_beforeSave();
00059     }

_validate (  )  [protected]

Validate sctipts that assigned on entity

Returns:
bool

Reimplemented from Mage_GoogleOptimizer_Model_Code.

Definition at line 61 of file Product.php.

00062     {
00063         $_validationResult = parent::_validate();
00064         if (!$_validationResult) {
00065             return false;
00066         }
00067         $attributesFlag = false;
00068         if ($attributes = $this->getAttributes()) {
00069             $attributesCount = 0;
00070             foreach ($attributes as $_attributeId=>$_attributeValue) {
00071                 if ($_attributeValue != '') {
00072                     $attributesCount++;
00073                 }
00074             }
00075             if ($attributesCount && $attributesCount <= self::DEFAULT_COUNT_OF_ATTRIBUTES) {
00076                 $attributesFlag = true;
00077             }
00078         }
00079         if ($this->_validateEntryFlag && !$attributesFlag) {
00080             return false;
00081         }
00082         if (!$this->_validateEntryFlag && $attributesFlag) {
00083             return false;
00084         }
00085         return true;
00086     }

getAttributes (  ) 

Return empty array if attributes is not defined

Returns:
array

Definition at line 93 of file Product.php.

00094     {
00095         if ($attributes = $this->_getData('attributes')) {
00096             return $attributes;
00097         }
00098         return array();
00099     }


Member Data Documentation

$_entityType = 'product' [protected]

Reimplemented from Mage_GoogleOptimizer_Model_Code.

Definition at line 37 of file Product.php.

Definition at line 36 of file Product.php.


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

Generated on Sat Jul 4 17:24:18 2009 for Magento by  doxygen 1.5.8