/** * List all system currencies * @return ActionResponse */ public function index() { $response = new ActionResponse(); $taxesForms = array(); $taxes = array(); foreach (Tax::getAllTaxes() as $tax) { $taxes[] = $tax->toArray(); $taxesForms[] = $this->createTaxForm($tax); } $response->set("taxesForms", $taxesForms); $response->set("taxes", $taxes); $newTax = Tax::getNewInstance(''); $response->set("newTaxForm", $this->createTaxForm($newTax)); $response->set("newTax", $newTax->toArray()); return $this->appendTaxRates($response); }
/** * @return RequestValidator */ private function createTaxRateFormValidator() { $validator = $this->getValidator('shippingService', $this->request); $taxes = Tax::getAllTaxes(); $classes = TaxClass::getAllClasses(); foreach ($taxes as $tax) { $this->setFieldValidation($validator, $tax, null); foreach ($classes as $class) { $this->setFieldValidation($validator, $tax, $class); } } return $validator; }