$vatRule = eZVatRule::create(); } // Modify chosen categories array // so that it can be saved into the VAT rule. $addID = create_function('$i', "return array( 'id' => \$i ) ;"); $chosenCategories = array_map($addID, $chosenCategories); $vatRule->setAttribute('country_code', $chosenCountry); $vatRule->setAttribute('product_categories', $chosenCategories); $vatRule->setAttribute('vat_type', $chosenVatType); $vatRule->store(); return $module->redirectTo($module->functionURI('vatrules')); } while (false); } } if (is_numeric($ruleID)) { $tplVatRule = eZVatRule::fetch($ruleID); $tplCountry = $tplVatRule->attribute('country_code'); $tplCategoryIDs = $tplVatRule->attribute('product_categories_ids'); $tplVatTypeID = $tplVatRule->attribute('vat_type'); $pathText = ezpI18n::tr('kernel/shop/editvatrule', 'Edit VAT charging rule'); } else { $tplVatRule = null; $tplCountry = false; $tplVatTypeID = false; $tplCategoryIDs = array(); $pathText = ezpI18n::tr('kernel/shop/editvatrule', 'Create new VAT charging rule'); } if ($errors !== false) { $tplCountry = $chosenCountry; $tplCategoryIDs = $chosenCategories; $tplVatTypeID = $chosenVatType;