Sunnysideup\Ecommerce\Model\Address\EcommerceRegion
The regions can be states (e.g. we only sell within New York and Penn State), suburbs (pizza delivery place), or whatever other geographical borders you are using.
Synopsis
class EcommerceRegion
extends DataObject
implements
EditableEcommerceObject
{
- // members
- protected static array $_for_current_order_only_show_regions = ;
- private static array $api_access = ;
- private static string $visitor_region_provider = 'EcommerceRegion_VisitorRegionProvider';
- private static bool $show_freetext_region_field = true;
- private static string $table_name = 'EcommerceRegion';
- private static array $db = ;
- private static array $has_one = ;
- private static array $indexes = ;
- private static array $default_sort = ;
- private static string $singular_name = 'Region';
- private static string $plural_name = 'Regions';
- private static array $searchable_fields = ;
- private static array $field_labels = ;
- private static array $summary_fields = ;
- private static string $description = 'A region within a country. This can be a state or a province or the equivalent.';
- private static array $_for_current_order_do_not_show_regions = ;
- // methods
- public void i18n_singular_name()
- public void i18n_plural_name()
- public static bool show()
- public FieldList getCMSFields()
- public string CMSEditLink()
- public static bool code_allowed()
- public static bool regionid_allowed()
- public static string find_title()
- public static array list_of_allowed_entries_for_dropdown()
- public static array get_for_current_order_only_show_regions()
- public static void set_for_current_order_only_show_regions()
- public static array get_for_current_order_do_not_show_regions()
- public static void set_for_current_order_do_not_show_regions()
- public static int get_region_id()
- public static int get_region_from_ip()
- public static void get_region()
- protected void onBeforeWrite()
- protected static array get_default_array()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Implements
Members
private
- $_for_current_order_do_not_show_regions — array
- $api_access
—
array
what variables are accessible through http://mysite.com/api/ecommerce/v1/EcommerceRegion/. - $db
- $default_sort
—
array
standard SS variable. - $description
—
string
Standard SS variable. - $field_labels
—
array
standard SS variable. - $has_one
—
array
standard SS variable. - $indexes
—
array
standard SS variable. - $plural_name
—
string
standard SS variable. - $searchable_fields
—
array
standard SS variable. - $show_freetext_region_field — Sunnysideup\Ecommerce\Model\Address\bool
- $singular_name
—
string
standard SS variable. - $summary_fields
—
array
standard SS variable. - $table_name
—
string
standard SS variable. - $visitor_region_provider — string
protected
- $_for_current_order_only_show_regions
—
array
these variables and methods allow to to "dynamically limit the regions available, based on, for example: ordermodifiers, item selection, etc....
Methods
protected
- get_default_array() — This function returns back the default list of regions, filtered by the currently selected country.
- onBeforeWrite() — standard SS method cleans up codes.
public
- CMSEditLink() — link to edit the record.
- code_allowed() — checks if a code is allowed.
- find_title() — converts a code into a proper title.
- getCMSFields() — Standard SS FieldList.
- get_for_current_order_do_not_show_regions()
- get_for_current_order_only_show_regions()
- get_region()
- get_region_from_ip() — returns the country based on the Visitor Country Provider.
- get_region_id() — This function works out the most likely region for the current order.
- 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.
- regionid_allowed() — checks if a code is allowed.
- set_for_current_order_do_not_show_regions() — merges arrays...
- set_for_current_order_only_show_regions() — merges arrays...
- show() — do we use regions at all in this ecommerce application?