/** * Overriding parent's _isInRule since the importer deletes all[1] rules first * and then all[1] rates. * This halves the number of SQL calls per delete of a rate. * * [1] "all" = all rates and rules that were not just imported. * * @return bool */ protected function _isInRule() { if ($this->checkIsInRule) { return parent::_isInRule(); } return false; }
public function tax_calculation_rate() { $items = Mage::getModel('tax/calculation_rate')->getCollection()->getItems(); foreach ($items as $item) { $item->delete(); } $this->conn->query('ALTER TABLE `tax_calculation_rate` AUTO_INCREMENT=1'); foreach ($this->objects['tax_calculation_rate'] as $item) { $model = new Mage_Tax_Model_Calculation_Rate(); foreach ($item as $key => $value) { $model->setData($key, $value); } try { $model->save(); } catch (Exception $e) { mage::d($e->getMessage()); } } }