Repository to register consents and check for users response.
Plenty\Modules\Webshop\Consent\Contracts
public registerConsentGroup(string $key, string $label, array $options = []):void
Register a new group of consents.
string | $key | Unique identifier of the group |
string | $label | Displayed label of the group |
array | $options | Additional options of the group. Available options are:
|
public registerConsent(string $key, string $label, array $options = []):void
Register a new consent.
string | $key | Unique identifier of the consent. |
string | $label | Displayed label of the consent. |
array | $options | Additional options of the consent. Available options are:
|
public getConsentGroups():Collection
Get all consent groups including all consents.
public hasResponse():bool
Check if the user has already responded the consents.
public setResponse(string $key, bool $isConsented = false):void
Set the response for a consent or a group of consents.
string | $key | The key of the consent group and the consent, e.g. "group.consent" Use "*" as consent key to check if all entries of a group has a response, e.g. "group.*" |
bool | $isConsented | True if the user has accepted the consent or the group of consents |
public isConsented(string $key):bool
Check if the user has consented.
string | $key | The key of the consent group and the consent, e.g. "group.consent" Use "*" as consent key to check if all entries of a group has a response, e.g. "group.*" |
Repository to get and set checkout data
Plenty\Modules\Webshop\Contracts
public getCurrency():string
Get the currently used currency.
public setCurrency(string $currency):void
Set the currency.
string | $currency |
public getShippingCountryId():int
Get the id of the current shipping country. Default to the configured country id from the webstore configuration.
Repository to get and set contact information for the webshop
Plenty\Modules\Webshop\Contracts
public getContactId():int
Get the ID of the logged in contact or 0 for guests
public getContact():Contact
Get the logged in contact
public getContactClassId():int
Get the contact class ID of the logged in contact
public getContactClassData(int $contactClassId):array
Get the contact class data for the provided contact class ID
int | $contactClassId |
public getDefaultContactClassId():int
Get the default contact class ID of the webstore
public showNetPrices():bool
Get Information if net prices should be shown
Repository to get information about gift cards and corresponding order items
Plenty\Modules\Webshop\Contracts
public hasGiftCardPdf(int $orderId, int $orderItemId, int $campaignCodeOrderId):bool
Checks if a gift card document has already been created for this order item
int | $orderId | |
int | $orderItemId | |
int | $campaignCodeOrderId |
public getGiftCardInformation(int $orderItemId):array
Get Information about the gift card
int | $orderItemId |
public isReturnable(int $orderItemId):bool
Return true if its not a gift card or the codes are not redeemed
int | $orderItemId |
public getReturnQuantity(int $orderItemId):int
Returnable quantity for giftCard
int | $orderItemId |
Repository for webshop localization information
Plenty\Modules\Webshop\Contracts
public getLanguage():string
Get the currently used language of the webshop visitor
public getLocale():string
Get the current locale
public getLanguageCode(string $countryCode = null):string
Get a ISO language code by given country code.
string | $countryCode |
Repository for webshop session information
Plenty\Modules\Webshop\Contracts
public setSessionValue(string $key, $value):void
Set a value to a given key in the session
string | $key | The key from session |
$value | The value will set to given key |
public getSessionValue(string $key):void
Get a value from the session by a given key
string | $key | The key to read from the session |
public getCustomer():Customer
Get the customer session model
public getOrder():Order
Get the order session model
Generate url for items, variations and categories considering all affecting configurations.
Plenty\Modules\Webshop\Contracts
public buildItemUrl(int $itemId, string $lang = null):UrlQuery
Build item url. Generate and write url to item data if not defined yet.
int | $itemId | Id of the item to generate url for. |
string | $lang | Language to generate the url in. Defaults to current language from session. |
public buildCategoryUrl(int $categoryId, string $lang = null, int $webstoreId = null):UrlQuery
Build category url by recursively prepending url names of parent categories.
int | $categoryId | Id of the category to get url for. |
string | $lang | Language to generate the url in. Defaults to current language from session. |
int | $webstoreId | Webstore to get url names for. Defaults to current webstore id. |
public fillItemUrl(array $itemData):void
Store item data of loaded items to be reused when generating item or variation urls.
array | $itemData | Item data object returned from search request. |
public buildVariationUrl(int $itemId, int $variationId, string $lang = null):UrlQuery
Build variation url. Variation urls equal to item urls with the variation id appended.
int | $itemId | Id of the item to generate url for. |
int | $variationId | Id of the variation to generate url for. |
string | $lang | Language to generate the url in. Defaults to current language from session. |
public getSuffix(int $itemId, int $variationId, bool $withVariationId = true):string
Get the suffix to be appended to item or variation urls.
int | $itemId | item id to be used in the suffix. |
int | $variationId | variation id to be used in the suffix. Will be ignored when using Callisto urls. |
bool | $withVariationId | Set if the variation id should be included in the suffix. Not considered when using Callisto urls. |
Repository for webstore information
Plenty\Modules\Webshop\Contracts
public getWebstoreConfiguration():WebstoreConfiguration
Get the webstore configuration
public getActiveLanguageList():array
Get the activate languages of the webstore
public getDefaultShippingCountryId():int
Get the default shipping-country-Id of the webstore
Event for receiving or manupulating the order item
Plenty\Modules\Webshop\Events
public getOrderItem():array
Get order item data generated from the basket item.
public getBasketItem():array
Get basket item data used to generate the order item from.
Event to trigger validation of a vat number while creating new addresses. Failed validation will throw an exception.
Plenty\Modules\Webshop\Events
public getVatNumber():string
Get the vat number to validate.
Helper class for number formatting
Plenty\Modules\Webshop\Helpers
public formatDecimal(float $value, int $decimal_places = -1):string
Format the given value to decimal
float | $value | |
int | $decimal_places |
public formatMonetary($value, $currencyISO):string
Format the given value to currency
$value | ||
$currencyISO |
Helper to get plugin configuration values. Provides several methods to read configuration values and cast them into required type.
Plenty\Modules\Webshop\Helpers
public load():void
Initially load configuration values into member variables.
public getPluginName():string
Return the name of the plugin to get the configuration values for.
public getMultiSelectValue(string $key, array $possibleValues = [], array $default = []):array
Get values of a multiselect configuration.
string | $key | The key of the configuration to read. |
array | $possibleValues | List of possible configuration values. Will be returned if the configuration value is "all" |
array | $default | A default value to return if the configuration is not set yet. |
public getTextValue(string $key, string $default = "", string $transformDefault = ""):string
Get the value of a text configuration.
string | $key | The key of the configuration to read. |
string | $default | A default value to return if the configuration is not set yet. |
string | $transformDefault | A value to be interpreted as a default value. Use this if you have defined a value in your config.json that should be handled as default value. |
public getIntegerValue(string $key, int $default):int
Get the value of an integer configuration.
string | $key | The key of the configuration to read. |
int | $default | A default value to return if the configuration is not set yet. |
public getBooleanValue(string $key, bool $default = false):bool
Get the value of a boolean configuration.
string | $key | The key of the configuration to read. |
bool | $default | A default value to return if the configuration is not set yet. |
public getConfigValue(string $key, $default = null):void
Get a configuration value without any cast.
string | $key | The key of the configuration to read. |
$default | A default value to return if the configuration is not set yet. |
Convert plentymarkets unit keys into common unit codes.
Plenty\Modules\Webshop\Helpers
public static getHTML4Unit(string $unit = "SMM"):string
Return common code for a unit ('m','cm' 'mm').
string | $unit | The internal unit key. |
Helper to generate and manipulate urls to be used in the webshop.
Plenty\Modules\Webshop\Helpers
public static create(string $path = null, string $lang = null):UrlQuery
Create a new instance.
string | $path | The path of the url. |
string | $lang | The language of the generated url. Will be included automatically if it is different to the default language. |
public static shouldAppendTrailingSlash():bool
Check if a trailing slash should be appended to urls.
public append(string $suffix):Helpers
Append a string to the path the url without checking for slashes.
string | $suffix | String to append to the path. |
public join(string $path):Helpers
Append a new path to the existing one. Ensure having a slash as glue between existing path and the new segment.
string | $path | The new path to append. |
public toAbsoluteUrl(bool $includeLanguage = false):string
Return the absolute url by prepending the HTTPS domain of the current client.
bool | $includeLanguage | If true it will include the language at the beginning of the path. |
public toRelativeUrl(bool $includeLanguage = false):string
Return the path as a relative url.
bool | $includeLanguage | If true it will include the language at the beginning of the path. |
public getPath(bool $includeLanguage = false):string
Return the path. This equals the relative url without a leading slash.
bool | $includeLanguage | If true it will include the language at the beginning of the path. |
public equals(string $path):bool
Compare current path to a string independent of a trailing slash.
string | $path | String to compare the current path to. |
Hook to execute validation of vat numbers. Can be triggered by emitting ValidateVatNumber while creating new addresses.
Plenty\Modules\Webshop\Hooks
public handle(ValidateVatNumber $vatNumberEvent):void
Validate the given vat number
ValidateVatNumber | $vatNumberEvent | Event emitted while creating new addresses. |
Interface to add custom facets.
Plenty\Modules\Webshop\ItemSearch\Contracts
public getAggregation():AggregationInterface
Get the aggregation to apply the facet to the search results.
public mergeIntoFacetsList($result):array
Merge facet data into list of facets.
$result | Facet data |
public extractFilterParams($filtersList):void
Extract search filters from filter paramters to be applied to the search request.
$filtersList | List of value ids for this facet. Possible values can be set by mergeIntoFacetsList() |
Extend the search result by additional data or mutate raw data in search results.
Plenty\Modules\Webshop\ItemSearch\Extensions
Base factory to prepare and build search requests on variation data interface
Plenty\Modules\Webshop\ItemSearch\Factories
public inherit(array $inheritedProperties = []):BaseSearchFactory
Create a new factory instance based on properties of an existing factory.
array | $inheritedProperties | List of properties to inherit or null to inherit all properties. |
public withMutator(MutatorInterface $mutator, bool $excludeDependencies = false, int $position = 1000):Factories
Add a mutator to transform search results.
MutatorInterface | $mutator | The mutator itself |
bool | $excludeDependencies | Set to true to remove required data from the results after applying the mutator. Fields will only be removed if they are not requested by the result fields of the search request. |
int | $position | Position of the mutator. Mutators are executed in the order of their positions. |
public createFilter(string $filterClass, array $params = []):void
Add a filter. Will create a new instance of the filter class if not already created.
string | $filterClass | |
array | $params |
public withFilter(TypeInterface $filter):Factories
Add a filter. Will override existing filter instances.
TypeInterface | $filter |
public withResultFields($fields):Factories
Set fields to be contained in search result.
$fields | Reference to a json file to load fields from or a list of field names. |
public getResultFields():array
Get the requested result fields for this search request.
public hasResultField(string $field):bool
Check if result field is already included in the source of the search.
string | $field | The field to search for in result fields |
public getAdditionalResultFields():array
Get additional result fields required by webshop mutators.
public withExtension(string $extensionClass, array $extensionParams = []):Factories
Add an extension.
string | $extensionClass | Extension class to add. |
array | $extensionParams | Additional parameters to pass to extensions constructor |
public getExtensions():array
Get all registered extensions
public getMutators():array
Get all registered mutators
public withAggregation(AggregationInterface $aggregation):Factories
Add an aggregation
AggregationInterface | $aggregation |
public withSuggestion(SuggestionInterface $suggestion):Factories
Add a suggestion
SuggestionInterface | $suggestion |
public setPage(int $page, int $itemsPerPage):Factories
Set pagination parameters.
int | $page | |
int | $itemsPerPage |
public sortBy(string $field, string $order = \Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory::SORTING_ORDER_DESC):Factories
Add sorting parameters
string | $field | The field to order by |
string | $order | Direction to order results. Possible values: 'asc' or 'desc' |
public sortByMultiple(array $sortingList):Factories
Add multiple sorting parameters
array | $sortingList | List of sorting parameters. Each entry should have a 'field' and an 'order' property. |
public setOrder(array $idList):Factories
Set the order of the search results by ids.
array | $idList | List of variation ids. Search results will be sorted in the same order. |
public groupBy(string $field, array $sortings = []):Factories
Group results by field
string | $field | The field to group properties by. |
array | $sortings | List of sort criteria. Might contain string |
Prepare and build search requests to query facets
Plenty\Modules\Webshop\ItemSearch\Factories
public static create($facets):Factories
Create a factory instance depending on a given set of facet values.
$facets | List of active facet values. If string is given, it will be exploded by ',' to a list of values. |
public withMinimumCount():Factories
Register extension to filter facets by minimum hit count.
public static default(array $options = []):Factories
Get the default configuration of a search factory.
array | $options | Available options
|
public setAdminPreview(bool $isAdminPreview):Factories
Set preview mode for the search request.
bool | $isAdminPreview | Set to true to enable preview. |
public isActive():Factories
Filter active variations
public isInactive():Factories
Filter inactive variations
public hasItemId(int $itemId):Factories
Filter variation by a single item id
int | $itemId | Item id to filter by. |
public hasItemIds(array $itemIds):Factories
Filter variations by multiple item ids
array | $itemIds | List of item ids to filter by. |
public hasVariationId(int $variationId):Factories
Filter variation by a single variation id.
int | $variationId | The variation id to filter by. |
public hasVariationIds(array $variationIds):Factories
Filter variations by multiple variation ids.
array | $variationIds | List of variation ids to filter by. |
public hasAtLeastOneAvailability(array $availabilityIds):Factories
Filter variations by multiple availability ids.
array | $availabilityIds | List of availability ids to filter by. |
public hasSupplier(int $supplierId):Factories
Filter variations by multiple availability ids.
int | $supplierId | The supplier id to filter by. |
public hasManufacturer(int $manufacturerId):Factories
Filter manufacturers by id.
int | $manufacturerId | To filter by manufacturer |
public hasEachProperty(array $propertyIds):Factories
Filter variations by multiple property ids.
array | $propertyIds | The property ids to filter by. |
public isMain():Factories
Filter only main variations
public isChild():Factories
Filter only child variations
public isHiddenInCategoryList(bool $isHidden = true):Factories
Filter by visibility in category list.
bool | $isHidden | Visibility in category list to filter by. |
public isSalable():Factories
Filter variations by isSalable flag
public isVisibleForClient(int $clientId = null):Factories
Filter variations by visibility for client
int | $clientId | The client id to filter by. If null, default client id from config will be used. |
public hasNameInLanguage(string $type = "hasAnyNameInLanguage", string $lang = null):Factories
Filter variations having texts in a given language.
string | $type | The text field to filter by ('hasAny', 'hasName1', 'hasName2', 'hasName3') |
string | $lang | The language to filter by. If null, language defined in session will be used. |
public isInCategory(int $categoryId):Factories
Filter variations contained in a category.
int | $categoryId | A category id to filter variations by. |
public hasAtLeastOnePrice(array $priceIds):Factories
Filter variations having at least on price.
array | $priceIds | List of price ids to filter variations by |
public hasPriceForCustomer():Factories
Filter variations having at least one price accessible by current customer.
public hasPriceInRange(float $priceMin, float $priceMax):Factories
float | $priceMin | |
float | $priceMax |
public hasTag(int $tagId):Factories
int | $tagId |
public hasAnyTag(array $tagIds):Factories
array | $tagIds |
public groupByTemplateConfig():Factories
Group results depending on a config value.
public isCrossSellingItem(int $itemId, string $relation):Factories
Filter variations having a cross selling relation to a given item.
int | $itemId | Item id to filter cross selling items for |
string | $relation | The relation of cross selling items. |
public hasFacets($facetValues, int $clientId = null, string $lang = null):Factories
Filter variations by facets.
$facetValues | List of facet values. If string is given, it will be exploded by ';' | |
int | $clientId | Client id to filter facets by. If null, default client id from config will be used. |
string | $lang | Language to filter facets by. If null, active language from session will be used. |
public hasSearchString(string $query, string $lang = null, string $a = "", string $b = ""):Factories
Filter variations by given search string.
string | $query | The search string to filter variations by |
string | $lang | The language to apply search on. If null, default language from session will be used |
string | $a | The item search operator should be "or" or "and" |
string | $b |
public hasNameString(string $query, string $lang = null):Factories
Filter variations by searching names
string | $query | The search string |
string | $lang | Language to apply search on. If null, default language from session will be used. |
public withLanguage(string $lang = null):Factories
Only request given language.
string | $lang | Language to get texts for. If null, default language from session will be used. |
public withImages(int $clientId = null):Factories
Include images in result
int | $clientId | The client id to get images for. If null, default client id from config will be used. |
public withVariationAttributeMap(int $itemId, int $initialVariationId, array $afterKey = []):Factories
Includes VariationAttributeMap for variation select
int | $itemId | |
int | $initialVariationId | |
array | $afterKey |
public withPropertyGroups(array $displaySettings = []):Factories
array | $displaySettings |
public withOrderPropertySelectionValues():Factories
public withVariationProperties():Factories
public withUrls():Factories
Append URLs to result.
public withPrices(array $quantities = [], bool $setPriceOnly = false):Factories
Append prices to result.
array | $quantities | |
bool | $setPriceOnly |
public withCurrentCategory():Factories
Set result as current category
public withDefaultImage():Factories
Append default item image if images are requested by result fields and item does not have any image
public withBundleComponents():Factories
Add bundle component variations.
public withSetComponents():void
Add set component variations to item set entries.
public withLinkToContent():Factories
public withGroupedAttributeValues():Factories
public withReducedResults():Factories
public withAvailability():Factories
public withTags():Factories
public withCategories():Factories
public withSuggestions(string $query = "", string $lang = null):Factories
string | $query | |
string | $lang |
public withDidYouMeanSuggestions(string $query):Factories
string | $query |
public withSalableVariationCount():VariationSearchFactory
public inherit(array $inheritedProperties = []):BaseSearchFactory
Create a new factory instance based on properties of an existing factory.
array | $inheritedProperties | List of properties to inherit or null to inherit all properties. |
public withMutator(MutatorInterface $mutator, bool $excludeDependencies = false, int $position = 1000):Factories
Add a mutator to transform search results.
MutatorInterface | $mutator | The mutator itself |
bool | $excludeDependencies | Set to true to remove required data from the results after applying the mutator. Fields will only be removed if they are not requested by the result fields of the search request. |
int | $position | Position of the mutator. Mutators are executed in the order of their positions. |
public createFilter(string $filterClass, array $params = []):void
Add a filter. Will create a new instance of the filter class if not already created.
string | $filterClass | |
array | $params |
public withFilter(TypeInterface $filter):Factories
Add a filter. Will override existing filter instances.
TypeInterface | $filter |
public withResultFields($fields):Factories
Set fields to be contained in search result.
$fields | Reference to a json file to load fields from or a list of field names. |
public getResultFields():array
Get the requested result fields for this search request.
public hasResultField(string $field):bool
Check if result field is already included in the source of the search.
string | $field | The field to search for in result fields |
public getAdditionalResultFields():array
Get additional result fields required by webshop mutators.
public withExtension(string $extensionClass, array $extensionParams = []):Factories
Add an extension.
string | $extensionClass | Extension class to add. |
array | $extensionParams | Additional parameters to pass to extensions constructor |
public getExtensions():array
Get all registered extensions
public getMutators():array
Get all registered mutators
public withAggregation(AggregationInterface $aggregation):Factories
Add an aggregation
AggregationInterface | $aggregation |
public withSuggestion(SuggestionInterface $suggestion):Factories
Add a suggestion
SuggestionInterface | $suggestion |
public setPage(int $page, int $itemsPerPage):Factories
Set pagination parameters.
int | $page | |
int | $itemsPerPage |
public sortBy(string $field, string $order = \Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory::SORTING_ORDER_DESC):Factories
Add sorting parameters
string | $field | The field to order by |
string | $order | Direction to order results. Possible values: 'asc' or 'desc' |
public sortByMultiple(array $sortingList):Factories
Add multiple sorting parameters
array | $sortingList | List of sorting parameters. Each entry should have a 'field' and an 'order' property. |
public setOrder(array $idList):Factories
Set the order of the search results by ids.
array | $idList | List of variation ids. Search results will be sorted in the same order. |
public groupBy(string $field, array $sortings = []):Factories
Group results by field
string | $field | The field to group properties by. |
array | $sortings | List of sort criteria. Might contain string |
Prepare and build search requests to query variations
Plenty\Modules\Webshop\ItemSearch\Factories
public static default(array $options = []):Factories
Get the default configuration of a search factory.
array | $options | Available options
|
public setAdminPreview(bool $isAdminPreview):Factories
Set preview mode for the search request.
bool | $isAdminPreview | Set to true to enable preview. |
public isActive():Factories
Filter active variations
public isInactive():Factories
Filter inactive variations
public hasItemId(int $itemId):Factories
Filter variation by a single item id
int | $itemId | Item id to filter by. |
public hasItemIds(array $itemIds):Factories
Filter variations by multiple item ids
array | $itemIds | List of item ids to filter by. |
public hasVariationId(int $variationId):Factories
Filter variation by a single variation id.
int | $variationId | The variation id to filter by. |
public hasVariationIds(array $variationIds):Factories
Filter variations by multiple variation ids.
array | $variationIds | List of variation ids to filter by. |
public hasAtLeastOneAvailability(array $availabilityIds):Factories
Filter variations by multiple availability ids.
array | $availabilityIds | List of availability ids to filter by. |
public hasSupplier(int $supplierId):Factories
Filter variations by multiple availability ids.
int | $supplierId | The supplier id to filter by. |
public hasManufacturer(int $manufacturerId):Factories
Filter manufacturers by id.
int | $manufacturerId | To filter by manufacturer |
public hasEachProperty(array $propertyIds):Factories
Filter variations by multiple property ids.
array | $propertyIds | The property ids to filter by. |
public isMain():Factories
Filter only main variations
public isChild():Factories
Filter only child variations
public isHiddenInCategoryList(bool $isHidden = true):Factories
Filter by visibility in category list.
bool | $isHidden | Visibility in category list to filter by. |
public isSalable():Factories
Filter variations by isSalable flag
public isVisibleForClient(int $clientId = null):Factories
Filter variations by visibility for client
int | $clientId | The client id to filter by. If null, default client id from config will be used. |
public hasNameInLanguage(string $type = "hasAnyNameInLanguage", string $lang = null):Factories
Filter variations having texts in a given language.
string | $type | The text field to filter by ('hasAny', 'hasName1', 'hasName2', 'hasName3') |
string | $lang | The language to filter by. If null, language defined in session will be used. |
public isInCategory(int $categoryId):Factories
Filter variations contained in a category.
int | $categoryId | A category id to filter variations by. |
public hasAtLeastOnePrice(array $priceIds):Factories
Filter variations having at least on price.
array | $priceIds | List of price ids to filter variations by |
public hasPriceForCustomer():Factories
Filter variations having at least one price accessible by current customer.
public hasPriceInRange(float $priceMin, float $priceMax):Factories
float | $priceMin | |
float | $priceMax |
public hasTag(int $tagId):Factories
int | $tagId |
public hasAnyTag(array $tagIds):Factories
array | $tagIds |
public groupByTemplateConfig():Factories
Group results depending on a config value.
public isCrossSellingItem(int $itemId, string $relation):Factories
Filter variations having a cross selling relation to a given item.
int | $itemId | Item id to filter cross selling items for |
string | $relation | The relation of cross selling items. |
public hasFacets($facetValues, int $clientId = null, string $lang = null):Factories
Filter variations by facets.
$facetValues | List of facet values. If string is given, it will be exploded by ';' | |
int | $clientId | Client id to filter facets by. If null, default client id from config will be used. |
string | $lang | Language to filter facets by. If null, active language from session will be used. |
public hasSearchString(string $query, string $lang = null, string $a = "", string $b = ""):Factories
Filter variations by given search string.
string | $query | The search string to filter variations by |
string | $lang | The language to apply search on. If null, default language from session will be used |
string | $a | The item search operator should be "or" or "and" |
string | $b |
public hasNameString(string $query, string $lang = null):Factories
Filter variations by searching names
string | $query | The search string |
string | $lang | Language to apply search on. If null, default language from session will be used. |
public withLanguage(string $lang = null):Factories
Only request given language.
string | $lang | Language to get texts for. If null, default language from session will be used. |
public withImages(int $clientId = null):Factories
Include images in result
int | $clientId | The client id to get images for. If null, default client id from config will be used. |
public withVariationAttributeMap(int $itemId, int $initialVariationId, array $afterKey = []):Factories
Includes VariationAttributeMap for variation select
int | $itemId | |
int | $initialVariationId | |
array | $afterKey |
public withPropertyGroups(array $displaySettings = []):Factories
array | $displaySettings |
public withOrderPropertySelectionValues():Factories
public withVariationProperties():Factories
public withUrls():Factories
Append URLs to result.
public withPrices(array $quantities = [], bool $setPriceOnly = false):Factories
Append prices to result.
array | $quantities | |
bool | $setPriceOnly |
public withCurrentCategory():Factories
Set result as current category
public withDefaultImage():Factories
Append default item image if images are requested by result fields and item does not have any image
public withBundleComponents():Factories
Add bundle component variations.
public withSetComponents():void
Add set component variations to item set entries.
public withLinkToContent():Factories
public withGroupedAttributeValues():Factories
public withReducedResults():Factories
public withAvailability():Factories
public withTags():Factories
public withCategories():Factories
public withSuggestions(string $query = "", string $lang = null):Factories
string | $query | |
string | $lang |
public withDidYouMeanSuggestions(string $query):Factories
string | $query |
public withSalableVariationCount():VariationSearchFactory
public inherit(array $inheritedProperties = []):BaseSearchFactory
Create a new factory instance based on properties of an existing factory.
array | $inheritedProperties | List of properties to inherit or null to inherit all properties. |
public withMutator(MutatorInterface $mutator, bool $excludeDependencies = false, int $position = 1000):Factories
Add a mutator to transform search results.
MutatorInterface | $mutator | The mutator itself |
bool | $excludeDependencies | Set to true to remove required data from the results after applying the mutator. Fields will only be removed if they are not requested by the result fields of the search request. |
int | $position | Position of the mutator. Mutators are executed in the order of their positions. |
public createFilter(string $filterClass, array $params = []):void
Add a filter. Will create a new instance of the filter class if not already created.
string | $filterClass | |
array | $params |
public withFilter(TypeInterface $filter):Factories
Add a filter. Will override existing filter instances.
TypeInterface | $filter |
public withResultFields($fields):Factories
Set fields to be contained in search result.
$fields | Reference to a json file to load fields from or a list of field names. |
public getResultFields():array
Get the requested result fields for this search request.
public hasResultField(string $field):bool
Check if result field is already included in the source of the search.
string | $field | The field to search for in result fields |
public getAdditionalResultFields():array
Get additional result fields required by webshop mutators.
public withExtension(string $extensionClass, array $extensionParams = []):Factories
Add an extension.
string | $extensionClass | Extension class to add. |
array | $extensionParams | Additional parameters to pass to extensions constructor |
public getExtensions():array
Get all registered extensions
public getMutators():array
Get all registered mutators
public withAggregation(AggregationInterface $aggregation):Factories
Add an aggregation
AggregationInterface | $aggregation |
public withSuggestion(SuggestionInterface $suggestion):Factories
Add a suggestion
SuggestionInterface | $suggestion |
public setPage(int $page, int $itemsPerPage):Factories
Set pagination parameters.
int | $page | |
int | $itemsPerPage |
public sortBy(string $field, string $order = \Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory::SORTING_ORDER_DESC):Factories
Add sorting parameters
string | $field | The field to order by |
string | $order | Direction to order results. Possible values: 'asc' or 'desc' |
public sortByMultiple(array $sortingList):Factories
Add multiple sorting parameters
array | $sortingList | List of sorting parameters. Each entry should have a 'field' and an 'order' property. |
public setOrder(array $idList):Factories
Set the order of the search results by ids.
array | $idList | List of variation ids. Search results will be sorted in the same order. |
public groupBy(string $field, array $sortings = []):Factories
Group results by field
string | $field | The field to group properties by. |
array | $sortings | List of sort criteria. Might contain string |
Container to collect facet extensions
Plenty\Modules\Webshop\ItemSearch\Helpers
public getFacetExtensions():array
Get all registered facet extensions.
public addFacetExtension(FacetExtension $facetExtension):void
Add an extension to provide a custom facet.
FacetExtension | $facetExtension | The extension describing the facet behavior |
Collect templates to read required result fields for several views from.
Plenty\Modules\Webshop\ItemSearch\Helpers
public static get(string $template):string
Get the path to result fields file from a plugin
string | $template | The key of the template to get the path for. |
public static load(string $template):array
Load result fields from a template file. Result field templates can be registered from a plugin.
string | $template | The key of the template to load file contents for. |
public setTemplate(string $event, string $template, bool $overwriteExistingData = true):void
Set the path of a template to read result fields from.
string | $event | The event to set the template for. |
string | $template | Path to the template to read result fields from. |
bool | $overwriteExistingData | Option to overwrite existing data |
public setTemplates(array $templateMap, bool $overwriteExistingData = true):void
Set multiple templates to read result fields from.
array | $templateMap | |
bool | $overwriteExistingData |
public requireFields($event, $field = null):void
Add required fields to variation search requests.
Helper class to convert sorting configuration values into internal sorting paramters used by variation data interface.
Plenty\Modules\Webshop\ItemSearch\Helpers
public getSorting(string $sortingConfig = null, bool $isCategory = true):array
Get sorting values from plugin configuration
string | $sortingConfig | The configuration value from the plugin. Contains a sorting field and a sorting order joined by an '_', e.g. 'item.id_asc' Possible sorting fields:
|
bool | $isCategory | Get default sorting configuration for category or for search |
public getCategorySorting(string $sortingConfig = null):array
Get sorting values for categories from config
string | $sortingConfig | The configuration value |
public getSearchSorting(string $sortingConfig = null):array
Get sorting values for searches from config
string | $sortingConfig | The configuration value |
public getUsedItemName():string
Get the result field for the name to be displayed in the webshop.
public splitPathAndOrder(string $sorting):array
Explode configuration entries containing the field to sort by and the sorting order joined by an '_'.
string | $sorting | Sorting configuration value, e.g. text.name_asc |
public mapToInnerSorting(string $sorting):string
Map (outer) sorting from item list to (inner) sorting to be applied on grouped variations of one item.
string | $sorting | The sorting of the item list to get the inner sorting value for. |
public static isLanguageSupported(string $lang):bool
string | $lang |
public static isLanguageActivated(string $lang):bool
string | $lang |
public static getM10lByLanguage(string $lang, string $fallback = "en"):string
string | $lang | |
string | $fallback |
public static getLanguageByM10l(string $lang, string $fallback = "english"):string
string | $lang | |
string | $fallback |
Query basket items.
Plenty\Modules\Webshop\ItemSearch\SearchPresets
public static getSearchFactory(array $options):VariationSearchFactory
Get preset search factory.
array | $options | Available options:
|
Query items for a single category
Plenty\Modules\Webshop\ItemSearch\SearchPresets
public static getSearchFactory(array $options):VariationSearchFactory
Get preset search factory.
array | $options | Available options:
|
Query cross selling items related to single item.
Plenty\Modules\Webshop\ItemSearch\SearchPresets
public static getSearchFactory(array $options):VariationSearchFactory
Get preset search factory.
array | $options | Available options:
|
Query facets for the item search of the webstore.
Plenty\Modules\Webshop\ItemSearch\SearchPresets
public static getSearchFactory(array $options):FacetSearchFactory
Get preset search factory.
array | $options | Available options:
|
Query live shopping items.
Plenty\Modules\Webshop\ItemSearch\SearchPresets
public static getSearchFactory(array $options):VariationSearchFactory
Get preset search factory.
array | $options | Available options:
|
Query items by manufacturer.
Plenty\Modules\Webshop\ItemSearch\SearchPresets
public static getSearchFactory(array $options):VariationSearchFactory
Get preset search factory.
array | $options | Available options:
|
Query items from the item search of the webstore.
Plenty\Modules\Webshop\ItemSearch\SearchPresets
public static getSearchFactory(array $options):VariationSearchFactory
Get preset search factory.
array | $options | Available options:
|
Define a preset of search request parameters to be reused for common search requests. *
Plenty\Modules\Webshop\ItemSearch\SearchPresets
public static getSearchFactory(array $options):void
Get the search factory from the preset.
array | $options |
Query items to display search suggestions
Plenty\Modules\Webshop\ItemSearch\SearchPresets
public static getSearchFactory(array $options):VariationSearchFactory
Get preset search factory.
array | $options | Available options:
|
Get item to be displayed on single item pages
Plenty\Modules\Webshop\ItemSearch\SearchPresets
public static getSearchFactory(array $options):VariationSearchFactory
Get preset search factory.
array | $options | Available options:
|
Query items by tag id.
Plenty\Modules\Webshop\ItemSearch\SearchPresets
public static getSearchFactory(array $options):VariationSearchFactory
Get preset search factory.
array | $options | Available options:
|
Append list of all variations for attribute selection in item views
Plenty\Modules\Webshop\ItemSearch\SearchPresets
public static getSearchFactory(array $options):VariationSearchFactory
Get preset search factory.
array | $options | Available options
|
Search for variation lists
Plenty\Modules\Webshop\ItemSearch\SearchPresets
public static getSearchFactory(array $options):VariationSearchFactory
Get preset search factory.
array | $options | Available options:
|
Execute item searches using the variation data interface
Plenty\Modules\Webshop\ItemSearch\Services
public getResults($searches):array
Execute multiple item searches at once. Results will be mapped to the same keys as used in the given associative array of search factories.
$searches | Associative array of search factories to execute. Result of each search request will be mapped to the key defined in this array. |
public getResult($searchFactory):array
Get result of a single search request.
$searchFactory | The factory to get results for. |
Create orders from the webshop
Plenty\Modules\Webshop\Order\Contracts
public placeOrder():Order
Generate order data from current basket and place the order.
public createReturnOrder(array $returnOrderData, int $orderId = null):Order
Create a return order for some items of an existing order.
array | $returnOrderData | Data to create the return order with. |
int | $orderId | Id of the original order |
Repository to read or write content of the robots.txt
Plenty\Modules\Webshop\Seo\Contracts
public findByWebstoreId(int $webstoreId):Robots
Get the content of the robots.txt for a single webstore.
int | $webstoreId | Id of the webstore to get the robots.txt for. |
public updateByWebstoreId(int $webstoreId, string $data):Robots
Update the content of the robots.txt of a single webstore.
int | $webstoreId | Id of the webstore to update the robots.txt for. |
string | $data | Content of the robots.txt |
Repository for sitemap configuration
Plenty\Modules\Webshop\Seo\Contracts
public findByWebstoreId(int $webstoreId):SitemapConfiguration
Get the sitemap configuration of a single webstore.
int | $webstoreId | Id of the webstore to get sitemap configuration for. |
public updateByWebstoreId(int $webstoreId, array $data = []):SitemapConfiguration
Update the sitemap configuration of a single webstore.
int | $webstoreId | Id of the webstore to get sitemap configuration for. |
array | $data | Sitemap configuration data |
Model for the configured content of the robots.txt
Plenty\Modules\Webshop\Seo\Models
Type | Name | Description |
---|---|---|
string | value | Content of the robots.txt file |
public toArray()
Returns this model as an array.
The sitemap configuration model
Plenty\Modules\Webshop\Seo\Models
Type | Name | Description |
---|---|---|
int | contentCategory | |
int | itemCategory | |
int | item | |
int | blog |
public toArray()
Returns this model as an array.
Set configuration values from the plugin to be considered in internal functions.
Plenty\Modules\Webshop\Template\Contracts
public registerConfigValue(string $key, $value):TemplateConfigRepositoryContract
Register an internal configuration. Available configuration keys are: <ul> <li><b>currency.format</b> Format to display the currency in monetary values.</li> <li><b>sort.defaultSorting</b> Default item sorting criteria</li> <li><b>sort.defaultSortingSearch</b> Default sorting criteria when searching for items</li> <li><b>sorting.prioritySearch1</b> First sorting criteria when searching for items</li> <li><b>sorting.prioritySearch2</b> Second sorting criteria when searching for items</li> <li><b>sorting.prioritySearch3</b> Third sorting criteria when searching for items</li> <li><b>sorting.priorityCategory1</b> First sorting criteria when searching for items of a category</li> <li><b>sorting.priorityCategory2</b> Second sorting criteria when searching for items of a category</li> <li><b>sorting.priorityCategory3</b> Third sorting criteria when searching for items of a category</li> <li><b>sorting.dynamicInherit</b> Set to true to adopts sorting criteria from item search options to grouping of variations</li> <li><b>sorting.dynamicPrio1</b> First sorting criteria when grouping variations in item search results</li> <li><b>sorting.dynamicPrio2</b> Second sorting criteria when grouping variations in item search results</li> <li><b>item.name</b> Set which item name should be used in the webshop.</li> <li><b>item.displayName</b> Define if the item name, the variation name or both names should be displayed in the webshop.</li> <li><b>global.enableOldUrlPattern</b> Item urls will be served with prefix "a-{itemId}" when enabled</li> <li><b>language.activeLanguages</b> List of languages that are enabled for the webshop</li> </ul>
string | $key | Configuration key to set value for |
$value | Configuration value to set |
Service provider for template plugins
Plenty\Modules\Webshop\Template\Providers
public overrideTemplate(string $original, string $override):void
Override a twig template. The new template will be used when the overridden template is going to be rendered.
string | $original | |
string | $override |
public addTemplateAlias(string $original, string $alias):void
Add an alias for a template. Rendering the template will also check for overrides of the alias template.
string | $original | |
string | $alias |