SilverCart\Model\Customer\Customer
Contains additional datafields for SilverCart customers and corresponding methods.
- Author: Sebastian Diel <sdiel@pixeltricks.de>
- Copyright: 2017 pixeltricks GmbH
- License: see license file in modules root directory
Synopsis
class Customer
extends DataExtension
implements
TemplateGlobalProvider,PermissionProvider
{
- // constants
- const GROUP_CODE_ADMINISTRATORS = 'administrators';
- const GROUP_CODE_ANONYMOUS = 'anonymous';
- const GROUP_CODE_B2B = 'b2b';
- const GROUP_CODE_B2C = 'b2c';
- const PERMISSION_CREATE = 'SILVERCART_CUSTOMER_CREATE';
- const PERMISSION_EDIT = 'SILVERCART_CUSTOMER_EDIT';
- const PERMISSION_DELETE = 'SILVERCART_CUSTOMER_DELETE';
- const PERMISSION_VIEW = 'SILVERCART_CUSTOMER_VIEW';
- const SESSION_KEY_SHIPPING_COUNTRY_ID = 'SilverCart.ShippingCountryID';
- // members
- protected array $groupNames = ;
- protected array $groupIDs = ;
- protected array $groupCacheKey = ;
- protected array $doesNotHaveToPayTaxes = ;
- private static array $db = ;
- private static array $has_one = ;
- private static array $has_many = ;
- private static array $belongs_many_many = ;
- private static array $api_access = ;
- private static array $casting = ;
- private static string $default_sort = "CustomerNumber DESC";
- private static string $default_customer_group_code = self::GROUP_CODE_B2C;
- private static string $default_customer_group_code_b2b = self::GROUP_CODE_B2B;
- private static array $valid_customer_group_codes = ;
- private static array $shoppingCartList = ;
- protected static string|null $registrationOptInConfirmationBaseLink = NULL;
- protected array $getCMSFieldsIsCalled = ;
- // methods
- public static Country|null currentShippingCountry()
- public static void setCurrentShippingCountry()
- public static string getRegistrationOptInConfirmationBaseLink()
- public static void setRegistrationOptInConfirmationBaseLink()
- public array providePermissions()
- public bool|null canView()
- public false canCreate()
- public bool canEdit()
- public bool canDelete()
- public bool canBeDeletedAutomatically()
- public void updateCMSFields()
- public void updateRestrictCMSFields()
- public void updateFieldLabels()
- public void updateSearchableFields()
- public void updateSummaryFields()
- public bool getCMSFieldsIsCalled()
- public DBHTMLText getLoginAttemptInformation()
- public DataList getLoginAttempts()
- public string getCustomerNumber()
- public DBHTMLText getShippingAddressSummary()
- public DBHTMLText getInvoiceAddressSummary()
- public string getGroupNames()
- public string getGroupIDs()
- public string getGroupCacheKey()
- public static string get_group_cache_key()
- public string getSalutationText()
- public string getAnonymousName()
- public string getNameWithSalutation()
- public string getSummaryTitle()
- public boolean isRegisteredCustomer()
- public boolean isAnonymousCustomer()
- public boolean isInZone()
- public static Member createAnonymousCustomer()
- public static mixed currentAnonymousCustomer()
- public static string default_customer_group_code()
- public static string default_customer_group_code_b2b()
- public static Group default_customer_group()
- public static Group default_customer_group_b2b()
- public boolean isB2BCustomer()
- public bool isValidCustomer()
- public static Member|null currentRegisteredCustomer()
- public static Member|null currentUser()
- public static DataList CustomerGroups()
- public static int currentUserID()
- public ArrayList getPurchasedProducts()
- public float getPurchasedProductQuantity()
- public boolean isPurchasedProduct()
- public ShoppingCart getCart()
- public static DataList getCustomerGroups()
- public static SearchContext getRestfulSearchContext()
- public string getTranslatedSalutation()
- public CustomerConfig getCustomerConfig()
- public bool hasFinishedNewsletterOptIn()
- public bool hasOnlyOneStandardAddress()
- public bool hasOpenOrders()
- public bool showPricesGross()
- public boolean doesNotHaveToPayTaxes()
- public string getPriceType()
- public void onBeforeWrite()
- public void onAfterWrite()
- public void onAfterDelete()
- public bool isAdmin()
- public static bool is_admin()
- public static array get_template_global_variables()
- public void sendChangePasswordEmail()
- public void sendDeletionConfirmation()
- public void requireDefaultChangePasswordEmail()
- public string createOptInConfirmationHash()
- public string getRegistrationOptInConfirmationLink()
- public void sendRegistrationOptInEmail()
- public bool confirmRegistrationOptIn()
- public void moveShoppingCartTo()
Hierarchy
Extends
- SilverStripe\ORM\DataExtension
Implements
- SilverStripe\View\TemplateGlobalProvider
- SilverStripe\Security\PermissionProvider
Constants
Name | Value |
---|---|
GROUP_CODE_ADMINISTRATORS | 'administrators' |
GROUP_CODE_ANONYMOUS | 'anonymous' |
GROUP_CODE_B2B | 'b2b' |
GROUP_CODE_B2C | 'b2c' |
PERMISSION_CREATE | 'SILVERCART_CUSTOMER_CREATE' |
PERMISSION_EDIT | 'SILVERCART_CUSTOMER_EDIT' |
PERMISSION_DELETE | 'SILVERCART_CUSTOMER_DELETE' |
PERMISSION_VIEW | 'SILVERCART_CUSTOMER_VIEW' |
SESSION_KEY_SHIPPING_COUNTRY_ID | 'SilverCart.ShippingCountryID' |
Members
private
- $api_access
—
array
api access - $belongs_many_many
—
array
belongs many many attributes - $casting
—
array
casted attributes -
$db
DB attributes - $default_customer_group_code
—
string
Code of default B2C customer group - $default_customer_group_code_b2b
—
string
Code of default B2B customer group - $default_sort
—
string
Default sort. - $has_many
—
array
has many attributes - $has_one
—
array
has one attributes - $shoppingCartList
—
array
Holds the current shopping carts for every requested Member. - $valid_customer_group_codes
—
array
List of codes of valid customer group.
protected
- $doesNotHaveToPayTaxes
—
array
Determines whether the customer has to pay taxes or not - $getCMSFieldsIsCalled
—
array
Stores the called status seperated by customer ID. - $groupCacheKey
—
string
Group ID string to use as cache key part - $groupIDs
—
array
List of related group IDs - $groupNames
—
array
Comma separated string of related group names - $registrationOptInConfirmationBaseLink
—
SilverCart\Model\Customer\string|null
Registration opt-in confirmation base link.
Methods
public
- CustomerGroups() — Returns all customer groups.
- canBeDeletedAutomatically() — Indicates wether this user can be deleted automatically.
- canCreate() — Order should not be created via backend
- canDelete() — Indicates wether the current user can delete this object.
- canEdit() — Indicates wether the current user can edit this object.
- canView() — Indicates wether the current user can view this object.
- confirmRegistrationOptIn() — Confirms the registration opt-in by the given $hash.
- createAnonymousCustomer() — Creates an anonymous customer if there's no currentMember object.
- createOptInConfirmationHash() — Creates a registration opt-in confirmation hash.
- currentAnonymousCustomer() — Returns the Member object if the current Member is an anonymous customer.
- currentRegisteredCustomer() — Function similar to Customer::currentUser(); Determins if we deal with a registered customer who has opted in. Returns the member object or false.
- currentShippingCountry() — Returns the current shipping country
- currentUser() — Returns the current user.
- currentUserID() — Returns the currently logged in user's ID.
- default_customer_group() — Returns the default B2C group.
- default_customer_group_b2b() — Returns the default B2B group.
- default_customer_group_code() — Returns the default customer group code.
- default_customer_group_code_b2b() — Returns the default customer group code B2B.
- doesNotHaveToPayTaxes() — Returns whether the customer has to pay tax or not.
- getAnonymousName() — Returns the localized salutation string.
- getCMSFieldsIsCalled() — Returns whether the method self::getCMSFields() is called for the current customer context.
- getCart() — Get the customers shopping cart or create one if it doesn't exist yet.
- getCustomerConfig() — Get the customer's configuration object or create one if it doesn't exist yet.
- getCustomerGroups() — Returns all customer groups of the current customer as a DataList.
- getCustomerNumber() — Returns the customer number.
- getGroupCacheKey() — Returns the related groups as a cache key string.
- getGroupIDs() — Returns the related groups as comma separated list.
- getGroupNames() — Returns the related groups as comma separated list.
- getInvoiceAddressSummary() — return the orders invoice address as complete string.
- getLoginAttemptInformation() — Returns the login attempt information.
- getLoginAttempts() — Returns the Member's LoginAttempts.
- getNameWithSalutation() — Returns the customer's full name with salutation.
- getPriceType() — Returns the members price type
- getPurchasedProductQuantity() — Returns this customer's total purchased quantity of the given $product.
- getPurchasedProducts() — Returns a customers purchased products
- getRegistrationOptInConfirmationBaseLink() — Returns the registration opt-in confirmation base link.
- getRegistrationOptInConfirmationLink() — Returns the registration opt-in confirmation link.
- getRestfulSearchContext() — Defines which attributes of an object can be accessed via api
- getSalutationText() — Returns the localized salutation string.
- getShippingAddressSummary() — return the orders shipping address as complete string.
- getSummaryTitle() — Returns the customer's full name with salutation.
- getTranslatedSalutation() — Returns the translated salutation.
- get_group_cache_key() — Returns the group cache key for the current session Member context.
- get_template_global_variables() — Returns the globals to use in template.
- hasFinishedNewsletterOptIn() — Indicates wether the customer has finished the newsletter opt-in or not.
- hasOnlyOneStandardAddress() — Indicates wether the customer has defined only one address to be both invoice and shipping address.
- hasOpenOrders() — Returns whether this customer has open orders.
- isAdmin() — Returns true if this user is an administrator.
- isAnonymousCustomer() — Returns whether the current customer is a anonymous one.
- isB2BCustomer() — Returns whether this customer is a B2B customer.
- isInZone() — Returns whether the current customer is in the given zone.
- isPurchasedProduct() — Returns whether the given product is already purchased by customer or not
- isRegisteredCustomer() — Returns whether the current customer is a registered one.
- isValidCustomer() — Returns whether this is a valid customer.
- is_admin() — Returns true if the current user is an administrator.
- moveShoppingCartTo() — Moves the shopping cart of $this->owner to $customer.
- onAfterDelete() — Delete the attributed shopping cart if existant.
- onAfterWrite() — Attributes a shopping cart to the Member if none is attributed yet.
- onBeforeWrite() — If the user is not anonymous a customer number is attributed to the Member if none is yet given.
- providePermissions() — Set permissions.
- requireDefaultChangePasswordEmail() — Creates the change password email in backend.
- sendChangePasswordEmail() — Sends an email to the customer, containing a link to change the password.
- sendDeletionConfirmation() — Sends the deletion confirmation/notification to the customer and shop owner.
- sendRegistrationOptInEmail() — Sends the registration opt in email.
- setCurrentShippingCountry() — Sets the current shipping country context.
- setRegistrationOptInConfirmationBaseLink() — Sets the registration opt-in confirmation base link.
- showPricesGross() — used to determine weather something should be shown on a template or not
- updateCMSFields() — manipulate the cms fields of the decorated class
- updateFieldLabels() — manipulate the field labels of the decorated class
- updateRestrictCMSFields() — Updates the CMS fields to use BEFORE the scaffolding is called.
- updateSearchableFields() — Defines additional searchable fields.
- updateSummaryFields() — overwrite the summary fields