public function save_rule() { if ($this->viewAccess() && JeproshopTools::checkTaxToken()) { $app = JFactory::getApplication(); if ($app->input->get('tax_rules_group_id', 0)) { $tr = new JeproshopTaxRuleModelTaxRule(); $tr->add(); } } }
public function renderEditRule($tpl = NULL) { if (!isset($this->context)) { $this->context = JeproshopContext::getContext(); } $this->helper = new JeproshopHelper(); $countryModel = new JeproshopCountryModelCountry(); $countries = $countryModel->getCountries($this->context->language->lang_id); $taxModel = new JeproshopTaxModelTax(); $taxes = $taxModel->getTaxes((int) $this->context->language->lang_id); $this->assignRef('taxes', $taxes); $taxRuleModel = new JeproshopTaxRuleModelTaxRule(); $taxRules = $taxRuleModel->getTaxRuleList(); $this->assignRef('tax_rules', $taxRules); $this->assignRef('countries', $countries); $this->addToolBar(); $this->sideBar = JHtmlSidebar::render(); parent::display($tpl); }
public function hasUniqueTaxRuleForCountry($country_id, $state_id, $tax_rule_id = false) { $rules = JeproshopTaxRuleModelTaxRule::getTaxRulesByGroupId((int) JeproshopContext::getContext()->language->lang_id, (int) $this->tax_rules_group_id); foreach ($rules as $rule) { if ($rule->country_id == $country_id && $state_id == $rule->state_id && !$rule->behavior && (int) $tax_rule_id != $rule->tax_rule_id) { return true; } } return false; }