public function add_rate() { $data = $this->post(); $errors = $this->validate($data); $this->error = null; //clear errors $this->error = $errors; if (!$errors->has()) { if ($this->post('taxRateID')) { //update StoreTaxRate::add($data); $this->redirect('/dashboard/store/settings/tax/updated'); } else { //first we send the data to the shipping method type. StoreTaxRate::add($data); $this->redirect('/dashboard/store/settings/tax/success'); } } else { if ($this->post('taxRateID')) { $this->edit($this->post('taxRateID')); } else { //first we send the data to the shipping method type. $this->add(); } } }
public static function migrateOldTaxRates(Package $pkg) { $taxEnabled = Config::get('vividstore.taxenabled'); //if it wasn't even enabled, then why bother. if ($taxEnabled) { $taxCountry = Config::get('vividstore.taxcountry'); $taxState = Config::get('vividstore.taxstate'); $taxCity = Config::get('vividstore.taxcity'); $taxAddress = Config::get('vividstore.taxAddress'); $taxMatch = Config::get('vividstore.taxMatch'); $taxbased = Config::get('vividstore.taxBased'); $taxrate = Config::get('vividstore.taxrate'); $taxCaculation = Config::get('vividstore.calculation'); $taxName = Config::get('vividstore.taxName'); $data = array('taxEnabled' => true, 'taxLabel' => $taxName, 'taxRate' => $taxrate, 'taxBased' => $taxbased, 'taxAddress' => $taxAddress, 'taxCountry' => $taxCountry, 'taxState' => $taxState, 'taxCity' => $taxCity); $taxRate = StoreTaxRate::add($data); $taxClass = StoreTaxClass::getByHandle('default'); $taxClass->addTaxClassRate($taxRate->getTaxRateID()); } }