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: /**
 29:  * Tax rate collection
 30:  *
 31:  * @category    Mage
 32:  * @package     Mage_Tax
 33:  * @author      Magento Core Team <core@magentocommerce.com>
 34:  */
 35: class Mage_Tax_Model_Resource_Calculation_Rate_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
 36: {
 37:     /**
 38:      * Resource initialization
 39:      */
 40:     protected function _construct()
 41:     {
 42:         $this->_init('tax/calculation_rate');
 43:     }
 44: 
 45:     /**
 46:      * Join country table to result
 47:      *
 48:      * @return Mage_Tax_Model_Resource_Calculation_Rate_Collection
 49:      */
 50:     public function joinCountryTable()
 51:     {
 52:         $this->_select->join(
 53:             array('country_table' => $this->getTable('directory/country')),
 54:             'main_table.tax_country_id = country_table.country_id',
 55:             array('country_name' => 'iso2_code')
 56:         );
 57: 
 58:         return $this;
 59:     }
 60: 
 61:     /**
 62:      * Join Region Table
 63:      *
 64:      * @return Mage_Tax_Model_Resource_Calculation_Rate_Collection
 65:      */
 66:     public function joinRegionTable()
 67:     {
 68:         $this->_select->joinLeft(
 69:             array('region_table' => $this->getTable('directory/country_region')),
 70:             'main_table.tax_region_id = region_table.region_id',
 71:             array('region_name' => 'code')
 72:         );
 73:         return $this;
 74:     }
 75: 
 76:     /**
 77:      * Join rate title for specified store
 78:      *
 79:      * @param Mage_Core_Model_Store|string|int $store
 80:      * @return Mage_Tax_Model_Resource_Calculation_Rate_Collection
 81:      */
 82:     public function joinTitle($store = null)
 83:     {
 84:         $storeId = (int)Mage::app()->getStore($store)->getId();
 85:         $this->_select->joinLeft(
 86:             array('title_table' => $this->getTable('tax/tax_calculation_rate_title')),
 87:             $this->getConnection()->quoteInto('main_table.tax_calculation_rate_id = title_table.tax_calculation_rate_id AND title_table.store_id = ?', $storeId),
 88:             array('title' => 'value')
 89:         );
 90: 
 91:         return $this;
 92:     }
 93: 
 94:     /**
 95:      * Joins store titles for rates
 96:      *
 97:      * @return Mage_Tax_Model_Resource_Calculation_Rate_Collection
 98:      */
 99:     public function joinStoreTitles()
100:     {
101:         $storeCollection =  Mage::app()->getStores(true);
102:         foreach ($storeCollection as $store) {
103:             $tableAlias    = sprintf('title_table_%s', $store->getId());
104:             $joinCondition = implode(' AND ', array(
105:                 "main_table.tax_calculation_rate_id = {$tableAlias}.tax_calculation_rate_id",
106:                 $this->getConnection()->quoteInto($tableAlias . '.store_id = ?', $store->getId())
107:             ));
108:             $this->_select->joinLeft(
109:                 array($tableAlias => $this->getTable('tax/tax_calculation_rate_title')),
110:                 $joinCondition,
111:                 array($tableAlias => 'value')
112:             );
113:         }
114:         return $this;
115:     }
116: 
117:     /**
118:      * Add rate filter
119:      *
120:      * @param int $rateId
121:      * @return Mage_Tax_Model_Resource_Calculation_Rate_Collection
122:      */
123:     public function addRateFilter($rateId)
124:     {
125:         if (is_int($rateId) && $rateId > 0) {
126:             return $this->addFieldToFilter('main_table.tax_rate_id', $rateId);
127:         }
128: 
129:         return $this;
130:     }
131: 
132:     /**
133:      * Retrieve option array
134:      *
135:      * @return array
136:      */
137:     public function toOptionArray()
138:     {
139:         return $this->_toOptionArray('tax_calculation_rate_id', 'code');
140:     }
141: 
142:     /**
143:      * Retrieve option hash
144:      *
145:      * @return array
146:      */
147:     public function toOptionHash()
148:     {
149:         return $this->_toOptionHash('tax_calculation_rate_id', 'code');
150:     }
151: 
152:     /**
153:      * Convert items array to hash for select options
154:      * unsing fetchItem method
155:      *
156:      * @see     _toOptionHashOptimized()
157:      *
158:      * @return  array
159:      */
160:     public function toOptionHashOptimized()
161:     {
162:         return $this->_toOptionHashOptimized('tax_calculation_rate_id', 'code');
163:     }
164: }
165: 
166: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0