ePages 6.11.0 - DE_EPAGES/Shop/API/Object/Shop.pm

Package DE_EPAGES::Shop::API::Object::Shop

object interface for Shop.

Base
DE_EPAGES::Object::API::Object::Site

Functions

activateCurrency
activeLocaleByLanguage
addCountry
addCurrency
addLanguage
addRegion
backofficeLocales
businessHours
className
countries
currencies
dbPackage
deactivateCurrency
defaultCountry
existsCountry
existsCurrency
existsLanguage
existsRegion
existsSiteLocale
exportXMLChildElements
exportableChildren
featureCurrentValue
featureIncrementValue
featureIsDirty
featureIsVisible
featureMaxValue
featureTestValue
features
formatter
infoCountry
isCurrencyActive
isTemporaryClosed
languages
localeByLanguage
regions
removeCountry
removeCurrency
removeLanguage
removeRegion
updateCountry
updateCurrency
updateSiteLocale

activateCurrency

Sets a currency active in the storefront.

Syntax
$Shop->activateCurrency($CurrencyID);
Input
$CurrencyID (char(3))
Currency identifier

activeLocaleByLanguage

Returns the first ACTIVE locale for a given language, sorted by position.

Syntax
$LocaleID = $Shop->localeByLanguage($LanguageID);
Return
$LocaleID (string)
locale identifier

addCountry

Adds a Country to the shop.

Syntax
$Shop->addCountry($CountryID,$Position,$IsDefault);
Example
$Shop->addCountry(4,10,1);
Input
$CountryID (int)
Country identifier
$Position (int)
Position in the list
$IsDefault (int)
default country for shop

addCurrency

Adds a currency to the shop.

Syntax
$Shop->addCurrency($CurrencyID);
Example
$Shop->addCurrency('EUR');
Input
$CurrencyID (char(3))
Currency identifier

addLanguage

Adds a Language to the shop. If the shop has only one storefront language (feature Langauges=1), then the current language is removed before the new language is added. In this case also the default locale is changed.

Syntax
$Shop->addLanguage($LanguageID);
Example
$Shop->addLanguage(32);
Input
$LanguageID (int)
Language identifier
Return
$Language (object)
language object

addRegion

Adds a region to the shop.

Syntax
$Shop->addRegion($Alias);
Example
$Shop->addRegion('EU-Countries');
Input
$Alias (string)
the Alias for the Region
Return
$Region (object)
region object

backofficeLocales

Returns all locales that can be used in the back-office of the shop.

Syntax
$aLocales = $Shop->backofficeLocales;
Return
$aLocales (ref.array.object)
list of SiteLocale objects

businessHours

Returns shop calendar (child BusinessHours), if not exists then the calendar will be created.

Syntax
$Calendar = $Shop->businessHours;
Return
$Calendar (object)
calendar object

className

Returns the class name, used for DAL access.

Syntax
$ClassName = $Shop->className;
Return
$ClassName (String)
class name

countries

Returns all countries that are assigned to the shop.

Syntax
$aCountryID = $Shop->countries;
Return
$aCountryID (ref.array.cahr(3))
list of country identifiers

currencies

Returns all currencies that are assigned to the shop.

Syntax
$aCurrencyID = $Shop->currencies;
Return
$aCurrencyID (ref.array.cahr(3))
list of currency identifiers

dbPackage

Returns the database package, used for DAL access.

Syntax
$DbPackage = $Shop->dbPackage;
Return
$DbPackage (String)
database package name

deactivateCurrency

Sets a currency inactive in the storefront.

Syntax
$Shop->deactivateCurrency($CurrencyID);
Input
$CurrencyID (char(3))
Currency identifier

defaultCountry

Return id of default country of the shop.

Syntax
$Shop->defaultCountry();
Return
$CountryID (int)
CountryID

existsCountry

Asks if a Country exists for the shop.

Syntax
$Shop->existsCountry($CountryID);
Input
$CountryID (int)
Country identifier

existsCurrency

Asks if a currency exists in the shop.

Syntax
$Shop->existsCurrency($CurrencyID);
Input
$CurrencyID (char(3))
Currency identifier

existsLanguage

Asks if a Language exists for the shop.

Syntax
$Exists = $Shop->existsLanguage($LanguageID);
Input
$LanguageID (int)
Language identifier
Return
$Exists (boolean)
true if the language is enabled in the shop

existsRegion

Asks if a Region exists for the shop.

Syntax
$Shop->existsRegion($Alias);
Input
$Alias (string)
Region alias

existsSiteLocale

Returns true if the site supports the given locale. Returns false if the shop does not support the languageof the locale, because the number of languages per shop is restricted by a feature.

Syntax
$Exists = $Site->existsSiteLocale($LocaleID);
Example
if( $Site->existsSiteLocale('en_GB') ) { ... }
Input
$LocaleID (string)
locale id, e.g. 'en_GB'
Return
$Exists (boolean)
true if the locale is supported by the site

exportXMLChildElements

Add xml elements for children (asks each with planXMLExport to add to driver).

Syntax
$Object->exportXMLChildElements( $Driver, $hAttributes );
Input
$Driver (object)
xml export driver with support function addObject
$hAttributes (ref.hash.string)
plain attributes

exportableChildren

Don't export the folder "Languages".

Syntax
$aChildren = $Object->exportableChildren
Return
$aChildren (array ref)
children of the object

featureCurrentValue

Returns or sets the currently used value of a shop feature. The function also checks if the new value is larger than the previous value and larger than the limit of featureMaxValue for this shop. The error FeatureLimitExceeded is thrown if $NewValue > featureMaxValue && $NewValue > featureCurrentValue.

Syntax
$CurrentValue = $Shop->featureCurrentValue( $Feature );
$Shop->featureCurrentValue( $Feature, $NewValue );
$Shop->featureCurrentValue( $Feature, $NewValue, $AllowToExceed );
Example
if( $Shop->featureCurrentValue( $FeatureProducts ) < $MaxValue ) { ... };
my $CountProducts = CountShopProducts( $Shop );
$Shop->featureCurrentValue( $FeatureProducts, $CountProducts );
Input
$Feature (object)
feature object
$NewValue (int)
currently used value
$AllowToExceed (boolean)
(optional, default: false) don't thow an error if the
new value exceeds the maximum allowed. Set this flag to true when
objects are deleted
Return
$CurrentValue (int)
currently used value

featureIncrementValue

Increments or decrements the currently value of a shop feature. The function also checks if the new value is larger than the previous value and larger than the limit of featureMaxValue for this shop. The error FeatureLimitExceeded is thrown if $NewValue > featureMaxValue && $NewValue > featureCurrentValue.

Syntax
$CurrentValue = $Shop->featureIncrementValue( $FeatureName, $IncValue );
$CurrentValue = $Shop->featureIncrementValue( $Feature, $IncValue );
Example
$Shop->featureIncrementValue('Products', 1);  # on insert product
$Shop->featureIncrementValue('Products', -1); # on delete product
Input
$Feature (object)
feature object
$FeatureName (string)
feature
$IncValue (int)
increment value (optional 1)
Return
$CurrentValue (int)
currently used value

featureIsDirty

Returns or sets the IsDirty flag for a feature. If this flag is true, then the current value of the feature may not be corrent and should be updated by the script resetDirtyShopFeatures.pl.

Syntax
$IsDirty = $Shop->featureIsDirty( $Feature );
$Shop->featureIsDirty( $Feature, $IsDirty );
Example
$Shop->featureIsDirty( 'GallerySize', 1 );
Input
$Feature (object)
feature object
$IsDirty (int)
true if the feature current value is not up to date
Return
$IsDirty (int)
true if the feature current value is not up to date

featureIsVisible

Returns true shop feature is visible.

Syntax
$IsVisible = $Shop->featureIsVisible( $Feature );
$Shop->featureIsVisible( $Feature );
Input
$Feature (object)
feature object
Return
$IsVisible (boolean)
visible

featureMaxValue

Returns or sets the maximum value of a shop feature. It is not an error to set the featureMaxValue to a value less than featureCurrentValue.

Syntax
$MaxValue = $Shop->featureMaxValue( $Feature );
$Shop->featureMaxValue( $Feature, $NewValue, $IsVisible );
Example
if( $Shop->featureMaxValue( $FeatureProducts ) > $CurrentValue ) { ... };
my $OldMaxValue = $Shop->featureMaxValue( $FeatureProducts );
$Shop->featureMaxValue( $FeatureProducts, $OldMaxValue + 10 );
my $NewMaxValue = $Shop->featureMaxValue( $FeatureProducts );
Input
$Feature (object)
feature object
$NewValue (int)
maximum allowed value
$IsVisible (boolean)
is visible at mbo
Return
$MaxValue (int)
maximum allowed value

featureTestValue

Throws error if feature is more used as possible.

Syntax
$Shop->featureTestValue( $Feature );
Input
$Feature (object)
feature object
$Feature (string)
feature alias

features

Returns all features that are assigned to the shop.

Syntax
$aFeature = $Shop->features;
Return
$aFeature (ref.array.object)
list of feature objects

formatter

Returns the money formatter for the currency.

Syntax
$Formatter = $Shop->formatter($CurrencyID);
Input
$CurrencyID (char(3))
currency code
Return
$Formatter (object)
money formatter

infoCountry

Return information about a country of the shop.

Syntax
$Shop->infoCountry($CountryID);
Input
$CountryID (int)
Country identifier
Return
$hShopCountry (reference to hash)
with following keys:
  • ShopID - shop id (part of primary key)- int
  • CountryID - country identifier - iso num c (part of primary key)- int
  • Position - position (optional)- int
  • IsDefault - is default (optional)- int

isCurrencyActive

Asks if the currency is active in the storefront.

Syntax
$Shop->isCurrencyActive($CurrencyID);
Input
$CurrencyID (char(3))
Currency identifier

isTemporaryClosed

Returns true if the site is closed temporary. In this case all pages should be delivered with the HTTP status 503 (Service Temporarily Unavailable) to prevent search engines from caching the "shop closed" message.

Syntax
$IsClosed = $Site->isTemporaryClosed;
Return
$IsClosed (boolean)
true if site is closed

languages

Returns all languages that are assigned to the shop.

Syntax
$aLanguageID = $Shop->languages;
Return
$aLanguageID (ref.array.int)
list of language identifier

localeByLanguage

Returns the first locale for a given language, sorted by position.

Syntax
$LocaleID = $Shop->localeByLanguage($LanguageID);
Return
$LocaleID (string)
locale identifier

regions

Returns all regions that are assigned to the shop.

Syntax
$aRegions = $Shop->regions;
Return
$aRegions (ref.array.object)
list of region objects

removeCountry

Removes a Country from the shop.

Syntax
$Shop->removeCountry($CountryID);
Input
$CountryID (int)
Country identifier

removeCurrency

Removes a currency from the shop.

Syntax
$Shop->removeCurrency($CurrencyID);
Input
$CurrencyID (char(3))
Currency identifier

removeLanguage

Removes a Language from the shop.

Syntax
$Shop->removeLanguage($LanguageID);
Input
$LanguageID (int)
Language identifier

removeRegion

Removes a Region from the shop.

Syntax
$Shop->removeRegion($Alias);
Input
$Alias (string)
Region alias

updateCountry

Update the position of a country in the shop or set a country default.

Syntax
$Shop->updateCountry($CountryID, $Position, $IsDefault);
Input
$CountryID (int)
Country identifier
$Position (int)
position in the list
$IsDefault (int)
true if a country is default

updateCurrency

Update the position of the currency in the shop.

Syntax
$Shop->updateCurrency($CurrencyID, $Position);
Input
$CurrencyID (int)
Currency identifier
$Position (int)
position in the list

updateSiteLocale

Update the position of the sitelocale in the shop.

Syntax
$Shop->updateSiteLocale($LocaleID, $Position);
Input
$LocaleID (int)
Locale identifier
$Position (int)
position in the list