Mage_Tax_Model_Calculation_Rule Class Reference

Inheritance diagram for Mage_Tax_Model_Calculation_Rule:

Mage_Core_Model_Abstract Varien_Object

List of all members.

Public Member Functions

 saveCalculationData ()
 getCalculationModel ()
 getRates ()
 getCustomerTaxClasses ()
 getProductTaxClasses ()

Protected Member Functions

 _construct ()
 _afterSave ()
 _afterDelete ()

Protected Attributes

 $_ctcs = null
 $_ptcs = null
 $_rates = null
 $_ctcModel = null
 $_ptcModel = null
 $_rateModel = null
 $_calculationModel = null


Detailed Description

Tax Rule Model

Author:
Magento Core Team <core@magentocommerce.com>

Definition at line 32 of file Rule.php.


Member Function Documentation

_afterDelete (  )  [protected]

After rule delete redeclared for dispatch tax_settings_change_after event

Returns:
Mage_Tax_Model_Calculation_Rule

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 72 of file Rule.php.

00073     {
00074         Mage::dispatchEvent('tax_settings_change_after');
00075         return parent::_afterDelete();
00076     }

_afterSave (  )  [protected]

After save rule Redeclared for populate rate calculations

Returns:
Mage_Tax_Model_Calculation_Rule

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 58 of file Rule.php.

00059     {
00060         parent::_afterSave();
00061         $this->saveCalculationData();
00062         Mage::dispatchEvent('tax_settings_change_after');
00063         return $this;
00064     }

_construct (  )  [protected]

Varien model constructor

Reimplemented from Varien_Object.

Definition at line 47 of file Rule.php.

00048     {
00049         $this->_init('tax/calculation_rule');
00050     }

getCalculationModel (  ) 

Definition at line 100 of file Rule.php.

00101     {
00102         if (is_null($this->_calculationModel)) {
00103             $this->_calculationModel = Mage::getSingleton('tax/calculation');
00104         }
00105         return $this->_calculationModel;
00106     }

getCustomerTaxClasses (  ) 

Definition at line 113 of file Rule.php.

00114     {
00115         return $this->getCalculationModel()->getCustomerTaxClasses($this->getId());
00116     }

getProductTaxClasses (  ) 

Definition at line 118 of file Rule.php.

00119     {
00120         return $this->getCalculationModel()->getProductTaxClasses($this->getId());
00121     }

getRates (  ) 

Definition at line 108 of file Rule.php.

00109     {
00110         return $this->getCalculationModel()->getRates($this->getId());
00111     }

saveCalculationData (  ) 

Definition at line 78 of file Rule.php.

00079     {
00080         $ctc = $this->getData('tax_customer_class');
00081         $ptc = $this->getData('tax_product_class');
00082         $rates = $this->getData('tax_rate');
00083 
00084         Mage::getSingleton('tax/calculation')->deleteByRuleId($this->getId());
00085         foreach ($ctc as $c) {
00086             foreach ($ptc as $p) {
00087                 foreach ($rates as $r) {
00088                     $dataArray = array(
00089                         'tax_calculation_rule_id'   =>$this->getId(),
00090                         'tax_calculation_rate_id'   =>$r,
00091                         'customer_tax_class_id'     =>$c,
00092                         'product_tax_class_id'      =>$p,
00093                     );
00094                     Mage::getSingleton('tax/calculation')->setData($dataArray)->save();
00095                 }
00096             }
00097         }
00098     }


Member Data Documentation

$_calculationModel = null [protected]

Definition at line 42 of file Rule.php.

$_ctcModel = null [protected]

Definition at line 38 of file Rule.php.

$_ctcs = null [protected]

Definition at line 34 of file Rule.php.

$_ptcModel = null [protected]

Definition at line 39 of file Rule.php.

$_ptcs = null [protected]

Definition at line 35 of file Rule.php.

$_rateModel = null [protected]

Definition at line 40 of file Rule.php.

$_rates = null [protected]

Definition at line 36 of file Rule.php.


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

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