Ejemplo n.º 1
0
 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
             TaxRate::add($data);
             $this->redirect('/dashboard/store/settings/tax/updated');
         } else {
             //first we send the data to the shipping method type.
             TaxRate::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();
         }
     }
 }
Ejemplo n.º 2
0
 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());
     }
 }
Ejemplo n.º 3
0
 public function add_class()
 {
     $this->set('task', t("Add"));
     $this->set('tc', new TaxClass());
     $this->set('taxRates', StoreTaxRate::getTaxRates());
 }
Ejemplo n.º 4
0
 public function taxClassContainsTaxRate(TaxRate $taxRate)
 {
     $trID = $taxRate->getTaxRateID();
     if (in_array($trID, $this->getTaxClassRateIDs())) {
         return true;
     } else {
         return false;
     }
 }