Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Tax_Block_Adminhtml_Frontend_Region_Updater
  • Mage_Tax_Block_Checkout_Discount
  • Mage_Tax_Block_Checkout_Grandtotal
  • Mage_Tax_Block_Checkout_Shipping
  • Mage_Tax_Block_Checkout_Subtotal
  • Mage_Tax_Block_Checkout_Tax
  • Mage_Tax_Block_Sales_Order_Tax
  • Mage_Tax_Helper_Data
  • Mage_Tax_Model_Calculation
  • Mage_Tax_Model_Calculation_Rate
  • Mage_Tax_Model_Calculation_Rate_Title
  • Mage_Tax_Model_Calculation_Rule
  • Mage_Tax_Model_Class
  • Mage_Tax_Model_Class_Source_Customer
  • Mage_Tax_Model_Class_Source_Product
  • Mage_Tax_Model_Config
  • Mage_Tax_Model_Config_Price_Include
  • Mage_Tax_Model_Mysql4_Calculation
  • Mage_Tax_Model_Mysql4_Calculation_Collection
  • Mage_Tax_Model_Mysql4_Calculation_Rate
  • Mage_Tax_Model_Mysql4_Calculation_Rate_Collection
  • Mage_Tax_Model_Mysql4_Calculation_Rate_Title
  • Mage_Tax_Model_Mysql4_Calculation_Rate_Title_Collection
  • Mage_Tax_Model_Mysql4_Calculation_Rule
  • Mage_Tax_Model_Mysql4_Calculation_Rule_Collection
  • Mage_Tax_Model_Mysql4_Class
  • Mage_Tax_Model_Mysql4_Class_Collection
  • Mage_Tax_Model_Mysql4_Report_Collection
  • Mage_Tax_Model_Mysql4_Report_Tax
  • Mage_Tax_Model_Mysql4_Report_Updatedat_Collection
  • Mage_Tax_Model_Mysql4_Sales_Order_Tax
  • Mage_Tax_Model_Mysql4_Sales_Order_Tax_Collection
  • Mage_Tax_Model_Mysql4_Setup
  • Mage_Tax_Model_Observer
  • Mage_Tax_Model_Resource_Calculation
  • Mage_Tax_Model_Resource_Calculation_Collection
  • Mage_Tax_Model_Resource_Calculation_Rate
  • Mage_Tax_Model_Resource_Calculation_Rate_Collection
  • Mage_Tax_Model_Resource_Calculation_Rate_Title
  • Mage_Tax_Model_Resource_Calculation_Rate_Title_Collection
  • Mage_Tax_Model_Resource_Calculation_Rule
  • Mage_Tax_Model_Resource_Calculation_Rule_Collection
  • Mage_Tax_Model_Resource_Class
  • Mage_Tax_Model_Resource_Class_Collection
  • Mage_Tax_Model_Resource_Report_Collection
  • Mage_Tax_Model_Resource_Report_Tax
  • Mage_Tax_Model_Resource_Report_Tax_Createdat
  • Mage_Tax_Model_Resource_Report_Tax_Updatedat
  • Mage_Tax_Model_Resource_Report_Updatedat_Collection
  • Mage_Tax_Model_Resource_Sales_Order_Tax
  • Mage_Tax_Model_Resource_Sales_Order_Tax_Collection
  • Mage_Tax_Model_Resource_Sales_Order_Tax_Item
  • Mage_Tax_Model_Resource_Sales_Order_Tax_Item_Collection
  • Mage_Tax_Model_Resource_Setup
  • Mage_Tax_Model_Sales_Order_Tax
  • Mage_Tax_Model_Sales_Order_Tax_Item
  • Mage_Tax_Model_Sales_Pdf_Grandtotal
  • Mage_Tax_Model_Sales_Pdf_Shipping
  • Mage_Tax_Model_Sales_Pdf_Subtotal
  • Mage_Tax_Model_Sales_Pdf_Tax
  • Mage_Tax_Model_Sales_Total_Quote_Discount
  • Mage_Tax_Model_Sales_Total_Quote_Nominal_Subtotal
  • Mage_Tax_Model_Sales_Total_Quote_Nominal_Tax
  • Mage_Tax_Model_Sales_Total_Quote_Shipping
  • Mage_Tax_Model_Sales_Total_Quote_Subtotal
  • Mage_Tax_Model_Sales_Total_Quote_Tax
  • Mage_Tax_Model_System_Config_Source_Algorithm
  • Mage_Tax_Model_System_Config_Source_Apply
  • Mage_Tax_Model_System_Config_Source_PriceType
  • Mage_Tax_Model_System_Config_Source_Tax_Country
  • Mage_Tax_Model_System_Config_Source_Tax_Display_Type
  • Mage_Tax_Model_System_Config_Source_Tax_Region

Exceptions

  • Mage_Tax_Exception
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Tax
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Tax Rule Model
 29:  *
 30:  * @method Mage_Tax_Model_Resource_Calculation_Rule _getResource()
 31:  * @method Mage_Tax_Model_Resource_Calculation_Rule getResource()
 32:  * @method string getCode()
 33:  * @method Mage_Tax_Model_Calculation_Rule setCode(string $value)
 34:  * @method int getPriority()
 35:  * @method Mage_Tax_Model_Calculation_Rule setPriority(int $value)
 36:  * @method int getPosition()
 37:  * @method Mage_Tax_Model_Calculation_Rule setPosition(int $value)
 38:  *
 39:  * @category    Mage
 40:  * @package     Mage_Tax
 41:  * @author      Magento Core Team <core@magentocommerce.com>
 42:  */
 43: class Mage_Tax_Model_Calculation_Rule extends Mage_Core_Model_Abstract
 44: {
 45:     protected $_ctcs                = null;
 46:     protected $_ptcs                = null;
 47:     protected $_rates               = null;
 48: 
 49:     protected $_ctcModel            = null;
 50:     protected $_ptcModel            = null;
 51:     protected $_rateModel           = null;
 52: 
 53:     protected $_calculationModel    = null;
 54: 
 55:     /**
 56:      * Varien model constructor
 57:      */
 58:     protected function _construct()
 59:     {
 60:         $this->_init('tax/calculation_rule');
 61:     }
 62: 
 63:     /**
 64:      * After save rule
 65:      * Redeclared for populate rate calculations
 66:      *
 67:      * @return Mage_Tax_Model_Calculation_Rule
 68:      */
 69:     protected function _afterSave()
 70:     {
 71:         parent::_afterSave();
 72:         $this->saveCalculationData();
 73:         Mage::dispatchEvent('tax_settings_change_after');
 74:         return $this;
 75:     }
 76: 
 77:     /**
 78:      * After rule delete
 79:      * redeclared for dispatch tax_settings_change_after event
 80:      *
 81:      * @return Mage_Tax_Model_Calculation_Rule
 82:      */
 83:     protected function _afterDelete()
 84:     {
 85:         Mage::dispatchEvent('tax_settings_change_after');
 86:         return parent::_afterDelete();
 87:     }
 88: 
 89:     public function saveCalculationData()
 90:     {
 91:         $ctc = $this->getData('tax_customer_class');
 92:         $ptc = $this->getData('tax_product_class');
 93:         $rates = $this->getData('tax_rate');
 94: 
 95:         Mage::getSingleton('tax/calculation')->deleteByRuleId($this->getId());
 96:         foreach ($ctc as $c) {
 97:             foreach ($ptc as $p) {
 98:                 foreach ($rates as $r) {
 99:                     $dataArray = array(
100:                         'tax_calculation_rule_id'   =>$this->getId(),
101:                         'tax_calculation_rate_id'   =>$r,
102:                         'customer_tax_class_id'     =>$c,
103:                         'product_tax_class_id'      =>$p,
104:                     );
105:                     Mage::getSingleton('tax/calculation')->setData($dataArray)->save();
106:                 }
107:             }
108:         }
109:     }
110: 
111:     public function getCalculationModel()
112:     {
113:         if (is_null($this->_calculationModel)) {
114:             $this->_calculationModel = Mage::getSingleton('tax/calculation');
115:         }
116:         return $this->_calculationModel;
117:     }
118: 
119:     public function getRates()
120:     {
121:         return $this->getCalculationModel()->getRates($this->getId());
122:     }
123: 
124:     public function getCustomerTaxClasses()
125:     {
126:         return $this->getCalculationModel()->getCustomerTaxClasses($this->getId());
127:     }
128: 
129:     public function getProductTaxClasses()
130:     {
131:         return $this->getCalculationModel()->getProductTaxClasses($this->getId());
132:     }
133: }
134: 
135: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0