Sunnysideup\Ecommerce\Model\Address\EcommerceCountry
For example: To what countries can be sold.
Synopsis
class EcommerceCountry
extends DataObject
implements
EditableEcommerceObject
{
- // members
- private static array $api_access = ;
- private static array $allowed_country_codes = ;
- private static string $visitor_country_provider = EcommerceCountryVisitorCountryProvider::class;
- private static string $default_country_code = 'NZ';
- private static string $table_name = 'EcommerceCountry';
- private static array $db = ;
- private static array $has_many = ;
- private static array $summary_fields = ;
- private static array $casting = ;
- private static array $searchable_fields = ;
- private static array $indexes = ;
- private static array $default_sort = ;
- private static string $singular_name = 'Country';
- private static string $plural_name = 'Countries';
- private static string $description = 'A country.';
- private static array $_countries_from_db_cache = ;
- private static array $_country_cache = ;
- private static array $_code_to_id_map = ;
- private static array $_allow_sales_cache = ;
- private static array $for_current_order_only_show_countries = ;
- private static array $for_current_order_do_not_show_countries = ;
- private static array $list_of_allowed_entries_for_dropdown_array = ;
- // methods
- public void i18n_singular_name()
- public void i18n_plural_name()
- public void canCreate()
- public void canView()
- public void canEdit()
- public bool canDelete()
- public static string get_country_from_ip()
- public static string get_ip()
- public static array get_country_dropdown()
- public static null|string get_fixed_country_code()
- public static string countryCode2name()
- public static string find_title()
- public static void reset_get_country_cache()
- public static void get_country_cache()
- public static void set_country_cache()
- public static string get_country()
- public static string get_country_default()
- public static null|EcommerceCountry|string get_country_from_mixed_var()
- public static null|DataObject|EcommerceCountry get_country_object()
- public static int get_country_id()
- public static void reset_allow_sales_cache()
- public static bool allow_sales()
- public void getCMSFields()
- public string CMSEditLink()
- public void requireDefaultRecords()
- public static void get_for_current_order_only_show_countries()
- public static void set_for_current_order_only_show_countries()
- public static void get_for_current_order_do_not_show_countries()
- public static void set_for_current_order_do_not_show_countries()
- public static array list_of_allowed_entries_for_dropdown()
- public static bool code_allowed()
- public bool AllowSales()
- public void getAllowSales()
- public string AllowSalesNice()
- public void getAllowSalesNice()
- protected void onBeforeWrite()
- protected static array get_default_array()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Implements
Tasks
Line | Task |
---|---|
+ | : how to translate this? |
830+ | add caching |
Members
private
- $_allow_sales_cache
—
array
Memory for allow country to check. - $_code_to_id_map
—
array
maps like this NZ => 1 AU => 2 etc... - $_countries_from_db_cache
- $_country_cache
—
array
Memory for the order's country. - $allowed_country_codes — array
- $api_access
—
array
what variables are accessible through http://mysite.com/api/ecommerce/v1/EcommerceCountry/. - $casting
—
array
standard SS variable. - $db
—
array
Standard SS Variable. - $default_country_code — string
- $default_sort
—
array
Standard SS Variable. - $description
—
string
Standard SS variable. - $for_current_order_do_not_show_countries
—
array
List of countries that should NOT be shown. - $for_current_order_only_show_countries
—
array
List of countries that should be shown. - $has_many
—
array
Standard SS Variable. - $indexes
—
array
Standard SS Variable. - $list_of_allowed_entries_for_dropdown_array — array
- $plural_name
—
string
Standard SS Variable. -
$searchable_fields
STANDARD SILVERSTRIPE STUFF. - $singular_name
—
string
Standard SS Variable. - $summary_fields
—
array
standard SS variable. -
$table_name
standard SS static definition. - $visitor_country_provider — string
Methods
protected
- get_default_array() — returns an array of Codes => Names of all countries that can be used.
- onBeforeWrite() — standard SS method cleans up codes.
public
- AllowSales() — Casted variable to show if sales are allowed to this country.
- AllowSalesNice() — Casted variable to show if sales are allowed to this country.
- CMSEditLink() — link to edit the record.
- allow_sales() — Checks if we are allowed to sell to the current country.
- canCreate() — Standard SS Method.
- canDelete() — Standard SS method.
- canEdit() — Standard SS Method.
- canView() — Standard SS Method.
- code_allowed() — checks if a code is allowed.
- countryCode2name()
- find_title() — returns the country name from a code.
- getAllowSales()
- getAllowSalesNice()
- getCMSFields()
- get_country() — This function works out the most likely country for the current order.
- get_country_cache()
- get_country_default() — A bling guess at the best country!
- get_country_dropdown() — e.g.
- get_country_from_ip() — returns the country based on the Visitor Country Provider.
- get_country_from_mixed_var()
- get_country_id() — returns the ID of the country or 0.
- get_country_object() — This function works out the most likely country for the current order and returns the Country Object, if any.
- get_fixed_country_code() — This function exists as a shortcut.
- get_for_current_order_do_not_show_countries()
- get_for_current_order_only_show_countries()
- get_ip() — returns the country based on the Visitor Country Provider.
- i18n_plural_name()
- i18n_singular_name()
- list_of_allowed_entries_for_dropdown() — takes the defaultArray and limits it with "only show" and "do not show" value, relevant for the current order.
- requireDefaultRecords() — standard SS method.
- reset_allow_sales_cache()
- reset_get_country_cache()
- set_country_cache()
- set_for_current_order_do_not_show_countries()
- set_for_current_order_only_show_countries()