function getCMSFields() { $fields = parent::getCMSFields(); $fieldLabels = $this->Config()->get("field_labels"); $fields->replaceField("CountryCode", new DropDownField("CountryCode", $fieldLabels["CountryCode"], EcommerceCountry::get_country_dropdown())); return $fields; }
/** * standard SS method * @return FieldList for CMS */ function getCMSFields() { $fields = parent::getCMSFields(); $fields->replaceField("Country", new DropDownField("Country", "based on a sale to ", EcommerceCountry::get_country_dropdown())); $fields->replaceField("Root.Main", new DropdownField("TaxType", "Tax Type", singleton($this->ClassName)->dbObject('TaxType')->enumValues())); $fields->removeByName("DefaultCountry"); $fields->addFieldToTab("Root.Debug", new ReadonlyField("DefaultCountryShown", "Prices are based on sale to", $this->DefaultCountry)); $fields->removeByName("DefaultRate"); $fields->addFieldToTab("Root.Debug", new ReadonlyField("DefaultRateShown", "Default rate", $this->DefaultRate)); $fields->removeByName("CurrentRate"); $fields->addFieldToTab("Root.Debug", new ReadonlyField("CurrentRateShown", "Rate for current order", $this->CurrentRate)); $fields->removeByName("RawTableValue"); $fields->addFieldToTab("Root.Debug", new ReadonlyField("RawTableValueShown", "Raw table value", $this->RawTableValue)); $fields->removeByName("DebugString"); $fields->addFieldToTab("Root.Debug", new ReadonlyField("DebugStringShown", "Debug String", $this->DebugString)); return $fields; }
/** * standard SS method * @return FieldList */ function getCMSFields() { $fields = parent::getCMSFields(); $fieldLabels = $this->Config()->get("field_labels"); $fields->replaceField("CountryCode", new DropDownField("CountryCode", $fieldLabels["CountryCode"], EcommerceCountry::get_country_dropdown())); $InclusiveOrExclusive = "Inclusive"; if ($this->EcomConfig()->ShopPricesAreTaxExclusive) { $InclusiveOrExclusive = "Exclusive"; } $fields->replaceField("InclusiveOrExclusive", new ReadonlyField("InclusiveOrExclusive", "This tax is: ..., you can change this setting in the e-commerce configuration.")); return $fields; }
/** * returns the country name from a code * @return String **/ public static function find_title($code) { $code = strtoupper($code); $options = EcommerceCountry::get_country_dropdown($showAllCountries = true); // check if code was provided, and is found in the country array if (isset($options[$code])) { return $options[$code]; } elseif ($code) { return $code; } else { return _t("Ecommerce.COUNTRY_NOT_FOUND", "[COUNTRY NOT FOUND]"); } }
function run($request) { $count = 0; $array = EcommerceCountry::get_country_dropdown(); $allowedArray = EcommerceCountry::get()->filter(array("DoNotAllowSales" => 1)); if ($allowedArray->count()) { foreach ($allowedArray as $obj) { $obj->DoNotAllowSales = 0; $obj->write(); DB::alteration_message("Disallowing sales to " . $obj->Name); } } else { DB::alteration_message("Could not find any countries that are not allowed", "created"); } }