SilverCart\Admin\Model\Config
The class SilverCart\Admin\Model\Config is the Handler for central configurations of SilverCart.
Configuration parameter which are defined as a value of $db must have a static
getter named like the attribute (without a 'get' in front of it).
If a 'get' is put in front of the methods name, it will cause a crash in case
of misconfiguration, because SilverStripes 'magic' getter will be overwritten
and called in backend by SilverStripes default logic. This will trigger an
configuration error, when no configuration is given.
- Author: Sebastian Diel <sdiel@pixeltricks.de>
- Copyright: 2017 pixeltricks GmbH
- License: see license file in modules root directory
Synopsis
class Config
{
- // constants
- const PRICE_TYPE_GROSS = 'gross';
- const PRICE_TYPE_NET = 'net';
- const WEIGHT_UNIT_GRAM = 'g';
- const WEIGHT_UNIT_KILOGRAM = 'kg';
- const WEIGHT_UNIT_POUND = 'lbs';
- const DIMENSION_UNIT_CENTIMETER = 'cm';
- const DIMENSION_UNIT_INCH = 'in';
- const ENUMERATION_WEIGHT_UNIT = 'Enum("' . self::WEIGHT_UNIT_GRAM . ',' . self::WEIGHT_UNIT_POUND . '","' . self::WEIGHT_UNIT_GRAM . '");
- const ENUMERATION_DIMENSION_UNIT = 'Enum("' . self::DIMENSION_UNIT_CENTIMETER . ',' . self::DIMENSION_UNIT_INCH . '","' . self::DIMENSION_UNIT_CENTIMETER . '");
- // members
- public static array $productsPerPageOptions = ;
- public static ArrayList $productsPerPageOptionsForTemplate = NULL;
- public static integer $productsPerPageDefault = 18;
- public static integer $productsPerPageUnlimitedNumber = 999999;
- public static array $registeredMenus = ;
- public static array $hiddenRegisteredMenus = ;
- public static array $menuNonCmsIdentifiers = ;
- public static array $required_configuration_fields = ;
- public static boolean $defaultLayoutEnabled = true;
- public static boolean $defaultLayoutLoaded = false;
- public static $addToCartMaxQuantity = NULL;
- public static $defaultCurrency = NULL;
- public static $defaultCurrencySymbol = NULL;
- public static $defaultPricetype = NULL;
- public static $emailSender = NULL;
- public static $emailSenderName = NULL;
- public static $enableBusinessCustomers = NULL;
- public static $enablePackstation = NULL;
- public static $globalEmailRecipient = NULL;
- public static $priceType = NULL;
- public static $config = NULL;
- public static $enableSSL = NULL;
- public static $minimumOrderValue = NULL;
- public static $freeOfShippingCostsFrom = NULL;
- public static $useFreeOfShippingCostsFrom = NULL;
- public static $useMinimumOrderValue = NULL;
- public static $productsPerPage = NULL;
- public static $silvercartVersion = NULL;
- public static $silvercartMinorVersion = NULL;
- public static $silvercartFullVersion = NULL;
- public static $enableStockManagement = NULL;
- public static $isStockManagementOverbookable = NULL;
- public static $redirectToCartAfterAddToCart = NULL;
- public static $redirectToCheckoutWhenInCart = NULL;
- public static $demandBirthdayDateOnRegistration = NULL;
- public static $useMinimumAgeToOrder = NULL;
- public static $minimumAgeToOrder = NULL;
- public static $useDefaultLanguageAsFallback = NULL;
- public static boolean $forceLoadingOfDefaultLayout = false;
- public static $productDescriptionFieldForCart = NULL;
- public static boolean $useProductDescriptionFieldForCart = true;
- public static boolean $useStrictSearchRelevance = false;
- public static $defaultMailRecipient = NULL;
- public static $defaultMailOrderNotificationRecipient = NULL;
- public static $defaultMailRevocationRecipient = NULL;
- public static $defaultMailRegistrationRecipient = NULL;
- public static $defaultContactMessageRecipient = NULL;
- public static $userAgentBlacklist = NULL;
- public static $skipPaymentStepIfUnique = NULL;
- public static $skipShippingStepIfUnique = NULL;
- public static $invoiceAddressIsAlwaysShippingAddress = NULL;
- public static $displayWeightsInKilogram = NULL;
- public static boolean $showTaxAndDutyHint = false;
- public static $colorScheme = NULL;
- public static $silvercartLogo = NULL;
- // methods
- public static bool Check()
- public static string DefaultCurrency()
- public static string DefaultCurrencySymbol()
- public static string DefaultPriceType()
- public static boolean DemandBirthdayDateOnRegistration()
- public static boolean UseMinimumAgeToOrder()
- public static boolean MinimumAgeToOrder()
- public static boolean MinimumAgeToOrderError()
- public static boolean CheckMinimumAgeToOrder()
- public static string EmailSender()
- public static string EmailSenderName()
- public static boolean EnableSSL()
- public static bool EnableStockManagement()
- public static bool isStockManagementOverbookable()
- public static mixed MinimumOrderValue()
- public static Boolean UseFreeOfShippingCostsFrom()
- public static Money FreeOfShippingCostsFrom()
- public static string SilverCartVersion()
- public static string SilverCartMinorVersion()
- public static string SilverCartFullVersion()
- public static bool UseMinimumOrderValue()
- public static string UserAgentBlacklist()
- public static string GlobalEmailRecipient()
- public static int ProductsPerPage()
- public static int ProductGroupsPerPage()
- public static int DisplayedPaginationPages()
- public static string productDescriptionFieldForCart()
- public static string useProductDescriptionFieldForCart()
- public static bool useStrictSearchRelevance()
- public static string DefaultMailRecipient()
- public static string DefaultMailOrderNotificationRecipient()
- public static string DefaultMailRevocationRecipient()
- public static string DefaultMailRegistrationRecipient()
- public static string DefaultContactMessageRecipient()
- public static bool SkipPaymentStepIfUnique()
- public static bool SkipShippingStepIfUnique()
- public static bool InvoiceAddressIsAlwaysShippingAddress()
- public static bool DisplayWeightsInKilogram()
- public static bool ShowTaxAndDutyHint()
- public static string Pricetype()
- public static string ColorScheme()
- public static bool ShopLogo()
- public static SiteConfig getConfig()
- public static bool devBuildIsRunning()
- public static bool configTableExists()
- public static array getHiddenRegisteredMenus()
- public static array getRegisteredMenus()
- public static array getMenuNonCmsIdentifiers()
- public static Image getNoImage()
- public static ProductCondition getStandardProductCondition()
- public static bool getRedirectToCartAfterAddToCartAction()
- public static bool RedirectToCartAfterAddToCart()
- public static bool RedirectToCheckoutWhenInCart()
- public static int getProductsPerPageDefault()
- public static void setProductsPerPageOptions()
- public static array getProductsPerPageOptions()
- public static array getProductsPerPageOptionsForTemplate()
- public static int getProductsPerPageUnlimitedNumber()
- public static void triggerError()
- public static void disableDefaultLayout()
- public static bool DefaultLayoutEnabled()
- public static bool DefaultLayoutLoaded()
- public static void setDefaultLayoutLoaded()
- public static void setMenuNonCmsIdentifier()
- public static void enableTestData()
- public static void disableTestData()
- public static void addGroupView()
- public static void addGroupHolderView()
- public static void removeGroupView()
- public static void registerMenu()
- public static void registerHiddenMenu()
- public static void removeGroupHolderView()
- public static int addToCartMaxQuantity()
- public static boolean enableBusinessCustomers()
- public static boolean enablePackstation()
- public static void setDefaultGroupView()
- public static void setDefaultGroupHolderView()
- public static boolean isInstallationCompleted()
- public static bool isValidUrl()
- public static boolean isUserAgentBlacklisted()
- public static void Log()
- public static string DefaultLanguage()
- public static string Locale()
- public static bool useDefaultLanguageAsFallback()
Hierarchy
Uses
- SilverStripe\Core\Extensible
Constants
Name | Value |
---|---|
PRICE_TYPE_GROSS | 'gross' |
PRICE_TYPE_NET | 'net' |
WEIGHT_UNIT_GRAM | 'g' |
WEIGHT_UNIT_KILOGRAM | 'kg' |
WEIGHT_UNIT_POUND | 'lbs' |
DIMENSION_UNIT_CENTIMETER | 'cm' |
DIMENSION_UNIT_INCH | 'in' |
ENUMERATION_WEIGHT_UNIT | 'Enum("' . self::WEIGHT_UNIT_GRAM . ',' . self::WEIGHT_UNIT_POUND . '","' . self::WEIGHT_UNIT_GRAM . '") |
ENUMERATION_DIMENSION_UNIT | 'Enum("' . self::DIMENSION_UNIT_CENTIMETER . ',' . self::DIMENSION_UNIT_INCH . '","' . self::DIMENSION_UNIT_CENTIMETER . '") |
Members
public
-
$addToCartMaxQuantity
The configuration fields should have a static attribute to set after its first call (to prevent redundant logic). - $colorScheme
- $config
- $defaultContactMessageRecipient
- $defaultCurrency
- $defaultCurrencySymbol
-
$defaultLayoutEnabled
Put here all static attributes which have no db field. - $defaultLayoutLoaded
- $defaultMailOrderNotificationRecipient
- $defaultMailRecipient
- $defaultMailRegistrationRecipient
- $defaultMailRevocationRecipient
- $defaultPricetype
- $demandBirthdayDateOnRegistration
- $displayWeightsInKilogram
- $emailSender
- $emailSenderName
- $enableBusinessCustomers
- $enablePackstation
- $enableSSL
- $enableStockManagement
- $forceLoadingOfDefaultLayout
- $freeOfShippingCostsFrom
- $globalEmailRecipient
- $invoiceAddressIsAlwaysShippingAddress
- $isStockManagementOverbookable
- $minimumAgeToOrder
- $minimumOrderValue
- $priceType
- $productDescriptionFieldForCart
- $productsPerPage
- $productsPerPageDefault
—
int
The default setting for the CustomerConfig option 'productsPerPage'. - $productsPerPageOptions
—
array
Contains the possible values for products per page selectors for storefront users. - $productsPerPageOptionsForTemplate
—
SilverStripe\ORM\ArrayList
Contains the possible values for products per page selectors for storefront users. - $productsPerPageUnlimitedNumber
—
int
Used as SQL limit number for unlimited products per page. - $redirectToCartAfterAddToCart
- $redirectToCheckoutWhenInCart
- $registeredMenus
—
array
Contains all registered menus for the storeadmin. - $required_configuration_fields
—
array
Define all required configuration fields in this array. The given fields will be handled in self::Check(). - $showTaxAndDutyHint
- $silvercartFullVersion
- $silvercartLogo
- $silvercartMinorVersion
- $silvercartVersion
- $skipPaymentStepIfUnique
- $skipShippingStepIfUnique
- $useDefaultLanguageAsFallback
- $useFreeOfShippingCostsFrom
- $useMinimumAgeToOrder
- $useMinimumOrderValue
- $useProductDescriptionFieldForCart
- $useStrictSearchRelevance
- $userAgentBlacklist
Methods
public
- Check() — This method checks the required configuration. If there is any missing configuration, an error will be displayed.
- CheckMinimumAgeToOrder() — Checks whether the given birthdate is allowed to order.
- ColorScheme() — Returns the current ColorScheme.
- DefaultContactMessageRecipient() — Returns the default contact message recipient
- DefaultCurrency() — Returns the configured default currency.
- DefaultCurrencySymbol() — Returns the configured default currency symbol.
- DefaultLanguage() — getter for the default language Returns a default locale for multilingual DataObjects
- DefaultLayoutEnabled() — Returns whether the base layout is enabled or not.
- DefaultLayoutLoaded() — Returns whether the base layout is loaded or not.
- DefaultMailOrderNotificationRecipient() — Returns the default mail order notification recipient
- DefaultMailRecipient() — Returns the default mail recipient
- DefaultMailRegistrationRecipient() — Returns the default mail registration recipient
- DefaultMailRevocationRecipient() — Returns the default mail revocation recipient
- DefaultPriceType() — Returns the configured default price type.
- DemandBirthdayDateOnRegistration() — Indicates wether the birthday date should be demanded on registration.
- DisplayWeightsInKilogram() — Returns the DisplayWeightsInKilogram property
- DisplayedPaginationPages() — returns the configurated setting for displayedPaginationPages
- EmailSender() — Returns the configured email sender.
- EmailSenderName() — Returns the configured email sender.
- EnableSSL() — Returns if SSL should be used.
- EnableStockManagement() — Returns if stock management is enabled
- FreeOfShippingCostsFrom() — Returns the free of shipping costs from value if specified.
- GlobalEmailRecipient() — Returns the configured default global email recipient.
- InvoiceAddressIsAlwaysShippingAddress() — Returns the InvoiceAddressIsAlwaysShippingAddress property
- Locale() — Returns the configs locale
- Log() — writes a log entry
- MinimumAgeToOrder() — Returns the minimum age to order.
- MinimumAgeToOrderError() — Returns the minimum age to order.
- MinimumOrderValue() — Returns the minimum order value if specified
- Pricetype() — determins weather a customer gets prices shown gross or net dependent on customer's invoice address or class
- ProductGroupsPerPage() — Returns the configured default setting that determines the default page size for product groups.
- ProductsPerPage() — Returns the configured default setting that determines the default page size for products.
- RedirectToCartAfterAddToCart() — Returns whether to redirect to cart after adding a product into.
- RedirectToCheckoutWhenInCart() — Returns whether to redirect to checkout after going to cart.
- ShopLogo() — Returns the current SilverCart logo.
- ShowTaxAndDutyHint() — Returns whether to show tax and duty hint in checkout or not.
- SilverCartFullVersion() — Returns the full SilverCart version number.
- SilverCartMinorVersion() — Returns the SilverCart minor version.
- SilverCartVersion() — Returns the SilverCart version.
- SkipPaymentStepIfUnique() — Returns the SkipPaymentStepIfUnique property
- SkipShippingStepIfUnique() — Returns the SkipShippingStepIfUnique property
- UseFreeOfShippingCostsFrom() — Returns if the free of shipping costs from setting should be used.
- UseMinimumAgeToOrder() — Returns whether there is a minimum age to order.
- UseMinimumOrderValue() — Returns if the minimum order value shall be used.
- UserAgentBlacklist() — Returns the user agent blacklist
- addGroupHolderView() — adds a new group view type for product group lists to the handler.
- addGroupView() — adds a new group view type for product lists to the handler.
- addToCartMaxQuantity() — Returns the maximum number of products that can be added to cart for one product.
- configTableExists() — Returns whether the SiteConfig table exists.
- devBuildIsRunning() — Returns whether dev/build is currently running.
- disableDefaultLayout() — Disables the base layout of SilverCart. This is important if the layout stands in conflict with your projects default layout.
- disableTestData() — disables the creation of test data on /dev/build. This is set by default, so you do not have to disable creation of test data if it was not enabled before.
- enableBusinessCustomers() — Returns wether to enable business customers or not.
- enablePackstation() — Returns wether to enable packstations or not.
- enableTestData() — enables the creation of test data on /dev/build
- getConfig() — Returns the SiteConfig or triggers an error if not existent.
- getHiddenRegisteredMenus() — Returns all hidden registered menus for the storeadmin.
- getMenuNonCmsIdentifiers() — Returns the Non-CMS menu identifiers.
- getNoImage() — Returns the default no-image visualisation.
- getProductsPerPageDefault() — Returns the default value for the CustomerConfig option 'productsPerPage'.
- getProductsPerPageOptions() — Returns an associative array with values for products per page, e.g.
- getProductsPerPageOptionsForTemplate() — Returns an ArrayList with values for products per page, e.g.
- getProductsPerPageUnlimitedNumber() — Returns the number that is used as unlimited value for the products per page setting.
- getRedirectToCartAfterAddToCartAction() — Alias for RedirectToCartAfterAddToCart.
- getRegisteredMenus() — Returns all registered menus for the storeadmin.
- getStandardProductCondition() — Returns the standard product condition.
- isInstallationCompleted() — Checks if the installation is complete. We assume a complete installation if the Member table has the field "ShoppingCartID" that is decorated via "Customer".
- isStockManagementOverbookable() — May a products stock quantity be below zero?
- isUserAgentBlacklisted() — Returns whether the given UserAgent string is blacklisted.
- isValidUrl() — check if a url is reachable This can be used to timeout SOAP connection An http code between 200 and 299 is considered a valid connection.
- productDescriptionFieldForCart() — Returns product description field for shopping cart and order positions.
- registerHiddenMenu() — Registers a menu.
- registerMenu() — Registers a menu.
- removeGroupHolderView() — removes a group view for product group lists from the handler
- removeGroupView() — removes a group view for product lists from the handler
- setDefaultGroupHolderView() — set the group view to use by default for product group lists
- setDefaultGroupView() — set the group view to use by default for product lists
- setDefaultLayoutLoaded() — Sets whether the base layout is loaded or not.
- setMenuNonCmsIdentifier() — Set a Non-CMS menu identifier.
- setProductsPerPageOptions() — used to set self::$productsPerPageOptions, set $includeAllProductsOption true if 'All' should be included
- triggerError() — Diplays an error rendered with SilverCart's error template.
- useDefaultLanguageAsFallback() — Determin wether the default language should be used for multilingual DataObjects in case a translation does not exist.
- useProductDescriptionFieldForCart() — Returns product description field for shopping cart and order positions.
- useStrictSearchRelevance() — Returns whether to use strict search relevance or not