Mage_Tax_Model_Calculation_Rate Class Reference

Inheritance diagram for Mage_Tax_Model_Calculation_Rate:

Mage_Core_Model_Abstract Varien_Object

List of all members.

Public Member Functions

 saveTitles ($titles=null)
 getTitleModel ()
 getTitles ()
 deleteAllRates ()

Protected Member Functions

 _construct ()
 _beforeSave ()
 _afterSave ()
 _afterDelete ()

Protected Attributes

 $_titles = null
 $_titleModel = null


Detailed Description

Tax Rate Model

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

Definition at line 32 of file Rate.php.


Member Function Documentation

_afterDelete (  )  [protected]

After rate delete redeclared for dispatch tax_settings_change_after event

Returns:
Mage_Tax_Model_Calculation_Rate

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 81 of file Rate.php.

00082     {
00083         Mage::dispatchEvent('tax_settings_change_after');
00084         return parent::_afterDelete();
00085     }

_afterSave (  )  [protected]

Save rate titles

Returns:
Mage_Tax_Model_Calculation_Rate

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 68 of file Rate.php.

00069     {
00070         $this->saveTitles();
00071         Mage::dispatchEvent('tax_settings_change_after');
00072         return parent::_afterSave();
00073     }

_beforeSave (  )  [protected]

Prepare location settings before save rate

Returns:
Mage_Tax_Model_Calculation_Rate

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 50 of file Rate.php.

00051     {
00052         parent::_beforeSave();
00053         $country = $this->getTaxCountryId();
00054         $region = $this->getTaxRegionId();
00055         $regionModel = Mage::getModel('directory/region');
00056         $regionModel->load($region);
00057         if ($regionModel->getCountryId() != $country) {
00058             $this->setTaxRegionId('*');
00059         }
00060         return $this;
00061     }

_construct (  )  [protected]

Varien model constructor

Reimplemented from Varien_Object.

Definition at line 40 of file Rate.php.

00041     {
00042         $this->_init('tax/calculation_rate');
00043     }

deleteAllRates (  ) 

Definition at line 124 of file Rate.php.

00125     {
00126         $this->_getResource()->deleteAllRates();
00127         Mage::dispatchEvent('tax_settings_change_after');
00128         return $this;
00129     }

getTitleModel (  ) 

Definition at line 108 of file Rate.php.

00109     {
00110         if (is_null($this->_titleModel)) {
00111             $this->_titleModel = Mage::getModel('tax/calculation_rate_title');
00112         }
00113         return $this->_titleModel;
00114     }

getTitles (  ) 

Definition at line 116 of file Rate.php.

00117     {
00118         if (is_null($this->_titles)) {
00119             $this->_titles = $this->getTitleModel()->getCollection()->loadByRateId($this->getId());
00120         }
00121         return $this->_titles;
00122     }

saveTitles ( titles = null  ) 

Definition at line 87 of file Rate.php.

00088     {
00089         if (is_null($titles)) {
00090             $titles = $this->getTitle();
00091         }
00092 
00093         $this->getTitleModel()->deleteByRateId($this->getId());
00094         if (is_array($titles) && $titles) {
00095             foreach ($titles as $store=>$title) {
00096                 if ($title !== '') {
00097                     $this->getTitleModel()
00098                         ->setId(null)
00099                         ->setTaxCalculationRateId($this->getId())
00100                         ->setStoreId((int) $store)
00101                         ->setValue($title)
00102                         ->save();
00103                 }
00104             }
00105         }
00106     }


Member Data Documentation

$_titleModel = null [protected]

Definition at line 35 of file Rate.php.

$_titles = null [protected]

Definition at line 34 of file Rate.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