Consent

Contracts

ConsentRepositoryContract

Repository to register consents and check for users response.

Namespace

Plenty\Modules\Webshop\Consent\Contracts

Methods

public registerConsentGroup(string $key, string $label, array $options = []):void

Register a new group of consents.

Parameters
string $key Unique identifier of the group
string $label Displayed label of the group
array $options Additional options of the group. Available options are:
  • necessary:boolean True if the group is necessary and could not be declined
  • description:string Description of the group.
  • position:number The position of the group
public registerConsent(string $key, string $label, array $options = []):void

Register a new consent.

Parameters
string $key Unique identifier of the consent.
string $label Displayed label of the consent.
array $options Additional options of the consent. Available options are:
  • necessary:boolean True of the consent is necessary and could not be declined
  • description:string Description of the consent
  • provider:string The provider of the cookie
  • lifespan:string Lifespan of the cookie
  • policyUrl:string URL to external privacy policy
  • group:string Identifier of an consent group
  • position:number The position of the consent in the group
  • isOptOut:boolean Select the consent by default. The user needs to decline the consent explicitly.
  • cookieNames:array Names of cookies which will be set. These cookies will not be blocked after the user confirmed the consent.
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.

Parameters
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.

Parameters
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.*"

Webshop

Contracts

CheckoutRepositoryContract

Repository to get and set checkout data

Namespace

Plenty\Modules\Webshop\Contracts

Methods

public getCurrency():string

Get the currently used currency.

public setCurrency(string $currency):void

Set the currency.

Parameters
string $currency
public getShippingCountryId():int

Get the id of the current shipping country. Default to the configured country id from the webstore configuration.

ContactRepositoryContract

Repository to get and set contact information for the webshop

Namespace

Plenty\Modules\Webshop\Contracts

Methods

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

Parameters
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

GiftCardRepositoryContract

Repository to get information about gift cards and corresponding order items

Namespace

Plenty\Modules\Webshop\Contracts

Methods

public hasGiftCardPdf(int $orderId, int $orderItemId, int $campaignCodeOrderId):bool

Checks if a gift card document has already been created for this order item

Parameters
int $orderId
int $orderItemId
int $campaignCodeOrderId
public getGiftCardInformation(int $orderItemId):array

Get Information about the gift card

Parameters
int $orderItemId
public isReturnable(int $orderItemId):bool

Return true if its not a gift card or the codes are not redeemed

Parameters
int $orderItemId
public getReturnQuantity(int $orderItemId):int

Returnable quantity for giftCard

Parameters
int $orderItemId

LocalizationRepositoryContract

Repository for webshop localization information

Namespace

Plenty\Modules\Webshop\Contracts

Methods

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.

Parameters
string $countryCode

SessionStorageRepositoryContract

Repository for webshop session information

Namespace

Plenty\Modules\Webshop\Contracts

Methods

public setSessionValue(string $key, $value):void

Set a value to a given key in the session

Parameters
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

Parameters
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

UrlBuilderRepositoryContract

Generate url for items, variations and categories considering all affecting configurations.

Namespace

Plenty\Modules\Webshop\Contracts

Methods

public buildItemUrl(int $itemId, string $lang = null):UrlQuery

Build item url. Generate and write url to item data if not defined yet.

Parameters
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.

Parameters
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.

Parameters
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.

Parameters
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.

Parameters
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.

WebstoreConfigurationRepositoryContract

Repository for webstore information

Namespace

Plenty\Modules\Webshop\Contracts

Methods

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

Events

AfterBasketItemToOrderItem

Event for receiving or manupulating the order item

Namespace

Plenty\Modules\Webshop\Events

Methods

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.

ValidateVatNumber

Event to trigger validation of a vat number while creating new addresses. Failed validation will throw an exception.

Namespace

Plenty\Modules\Webshop\Events

Methods

public getVatNumber():string

Get the vat number to validate.

Helpers

NumberFormatter

Helper class for number formatting

Namespace

Plenty\Modules\Webshop\Helpers

Methods

public formatDecimal(float $value, int $decimal_places = -1):string

Format the given value to decimal

Parameters
float $value
int $decimal_places
public formatMonetary($value, $currencyISO):string

Format the given value to currency

Parameters
$value
$currencyISO

PluginConfig

Helper to get plugin configuration values. Provides several methods to read configuration values and cast them into required type.

Namespace

Plenty\Modules\Webshop\Helpers

Methods

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.

Parameters
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.

Parameters
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.

Parameters
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.

Parameters
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.

Parameters
string $key The key of the configuration to read.
$default A default value to return if the configuration is not set yet.

UnitUtils

Convert plentymarkets unit keys into common unit codes.

Namespace

Plenty\Modules\Webshop\Helpers

Methods

public static getHTML4Unit(string $unit = "SMM"):string

Return common code for a unit ('m','cm' 'mm').

Parameters
string $unit The internal unit key.

UrlQuery

Helper to generate and manipulate urls to be used in the webshop.

Namespace

Plenty\Modules\Webshop\Helpers

Methods

public static create(string $path = null, string $lang = null):UrlQuery

Create a new instance.

Parameters
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.

Parameters
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.

Parameters
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.

Parameters
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.

Parameters
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.

Parameters
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.

Parameters
string $path String to compare the current path to.

Hooks

CheckVatNumber

Hook to execute validation of vat numbers. Can be triggered by emitting ValidateVatNumber while creating new addresses.

Namespace

Plenty\Modules\Webshop\Hooks

Methods

public handle(ValidateVatNumber
 $vatNumberEvent):void

Validate the given vat number

Parameters
ValidateVatNumber $vatNumberEvent Event emitted while creating new addresses.

ItemSearch

Contracts

FacetExtension

Interface to add custom facets.

Namespace

Plenty\Modules\Webshop\ItemSearch\Contracts

Methods

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.

Parameters
$result Facet data
public extractFilterParams($filtersList):void

Extract search filters from filter paramters to be applied to the search request.

Parameters
$filtersList List of value ids for this facet. Possible values can be set by mergeIntoFacetsList()

Extensions

ItemSearchExtension

Extend the search result by additional data or mutate raw data in search results.

Namespace

Plenty\Modules\Webshop\ItemSearch\Extensions

Factories

BaseSearchFactory

Base factory to prepare and build search requests on variation data interface

Namespace

Plenty\Modules\Webshop\ItemSearch\Factories

Methods

public inherit(array $inheritedProperties = []):BaseSearchFactory

Create a new factory instance based on properties of an existing factory.

Parameters
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.

Parameters
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.

Parameters
string $filterClass
array $params
public withFilter(TypeInterface
 $filter):Factories

Add a filter. Will override existing filter instances.

Parameters
TypeInterface $filter
public withResultFields($fields):Factories

Set fields to be contained in search result.

Parameters
$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.

Parameters
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.

Parameters
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

Parameters
AggregationInterface $aggregation
public withSuggestion(SuggestionInterface
 $suggestion):Factories

Add a suggestion

Parameters
SuggestionInterface $suggestion
public setPage(int $page, int $itemsPerPage):Factories

Set pagination parameters.

Parameters
int $page
int $itemsPerPage
public sortBy(string $field, string $order = \Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory::SORTING_ORDER_DESC):Factories

Add sorting parameters

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

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.

Parameters
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

Parameters
string $field The field to group properties by.
array $sortings List of sort criteria. Might contain string

FacetSearchFactory

Prepare and build search requests to query facets

Namespace

Plenty\Modules\Webshop\ItemSearch\Factories

Methods

public static create($facets):Factories

Create a factory instance depending on a given set of facet values.

Parameters
$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.

Parameters
array $options Available options
  • quantities Quantities of the variations in the basket. This will be considered while calculating graduated prices
  • setPriceOnly Set to true to only consider prices for item sets
public setAdminPreview(bool $isAdminPreview):Factories

Set preview mode for the search request.

Parameters
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

Parameters
int $itemId Item id to filter by.
public hasItemIds(array $itemIds):Factories

Filter variations by multiple item ids

Parameters
array $itemIds List of item ids to filter by.
public hasVariationId(int $variationId):Factories

Filter variation by a single variation id.

Parameters
int $variationId The variation id to filter by.
public hasVariationIds(array $variationIds):Factories

Filter variations by multiple variation ids.

Parameters
array $variationIds List of variation ids to filter by.
public hasAtLeastOneAvailability(array $availabilityIds):Factories

Filter variations by multiple availability ids.

Parameters
array $availabilityIds List of availability ids to filter by.
public hasSupplier(int $supplierId):Factories

Filter variations by multiple availability ids.

Parameters
int $supplierId The supplier id to filter by.
public hasManufacturer(int $manufacturerId):Factories

Filter manufacturers by id.

Parameters
int $manufacturerId To filter by manufacturer
public hasEachProperty(array $propertyIds):Factories

Filter variations by multiple property ids.

Parameters
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.

Parameters
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

Parameters
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.

Parameters
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.

Parameters
int $categoryId A category id to filter variations by.
public hasAtLeastOnePrice(array $priceIds):Factories

Filter variations having at least on price.

Parameters
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
Parameters
float $priceMin
float $priceMax
public hasTag(int $tagId):Factories
Parameters
int $tagId
public hasAnyTag(array $tagIds):Factories
Parameters
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.

Parameters
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.

Parameters
$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.

Parameters
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
string $b
public hasNameString(string $query, string $lang = null):Factories

Filter variations by searching names

Parameters
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.

Parameters
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

Parameters
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

Parameters
int $itemId
int $initialVariationId
array $afterKey
public withPropertyGroups(array $displaySettings = []):Factories
Parameters
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.

Parameters
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
Parameters
string $query
string $lang
public withDidYouMeanSuggestions(string $query):Factories
Parameters
string $query
public withSalableVariationCount():VariationSearchFactory
public inherit(array $inheritedProperties = []):BaseSearchFactory

Create a new factory instance based on properties of an existing factory.

Parameters
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.

Parameters
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.

Parameters
string $filterClass
array $params
public withFilter(TypeInterface
 $filter):Factories

Add a filter. Will override existing filter instances.

Parameters
TypeInterface $filter
public withResultFields($fields):Factories

Set fields to be contained in search result.

Parameters
$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.

Parameters
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.

Parameters
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

Parameters
AggregationInterface $aggregation
public withSuggestion(SuggestionInterface
 $suggestion):Factories

Add a suggestion

Parameters
SuggestionInterface $suggestion
public setPage(int $page, int $itemsPerPage):Factories

Set pagination parameters.

Parameters
int $page
int $itemsPerPage
public sortBy(string $field, string $order = \Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory::SORTING_ORDER_DESC):Factories

Add sorting parameters

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

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.

Parameters
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

Parameters
string $field The field to group properties by.
array $sortings List of sort criteria. Might contain string

VariationSearchFactory

Prepare and build search requests to query variations

Namespace

Plenty\Modules\Webshop\ItemSearch\Factories

Methods

public static default(array $options = []):Factories

Get the default configuration of a search factory.

Parameters
array $options Available options
  • quantities Quantities of the variations in the basket. This will be considered while calculating graduated prices
  • setPriceOnly Set to true to only consider prices for item sets
public setAdminPreview(bool $isAdminPreview):Factories

Set preview mode for the search request.

Parameters
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

Parameters
int $itemId Item id to filter by.
public hasItemIds(array $itemIds):Factories

Filter variations by multiple item ids

Parameters
array $itemIds List of item ids to filter by.
public hasVariationId(int $variationId):Factories

Filter variation by a single variation id.

Parameters
int $variationId The variation id to filter by.
public hasVariationIds(array $variationIds):Factories

Filter variations by multiple variation ids.

Parameters
array $variationIds List of variation ids to filter by.
public hasAtLeastOneAvailability(array $availabilityIds):Factories

Filter variations by multiple availability ids.

Parameters
array $availabilityIds List of availability ids to filter by.
public hasSupplier(int $supplierId):Factories

Filter variations by multiple availability ids.

Parameters
int $supplierId The supplier id to filter by.
public hasManufacturer(int $manufacturerId):Factories

Filter manufacturers by id.

Parameters
int $manufacturerId To filter by manufacturer
public hasEachProperty(array $propertyIds):Factories

Filter variations by multiple property ids.

Parameters
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.

Parameters
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

Parameters
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.

Parameters
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.

Parameters
int $categoryId A category id to filter variations by.
public hasAtLeastOnePrice(array $priceIds):Factories

Filter variations having at least on price.

Parameters
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
Parameters
float $priceMin
float $priceMax
public hasTag(int $tagId):Factories
Parameters
int $tagId
public hasAnyTag(array $tagIds):Factories
Parameters
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.

Parameters
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.

Parameters
$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.

Parameters
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
string $b
public hasNameString(string $query, string $lang = null):Factories

Filter variations by searching names

Parameters
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.

Parameters
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

Parameters
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

Parameters
int $itemId
int $initialVariationId
array $afterKey
public withPropertyGroups(array $displaySettings = []):Factories
Parameters
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.

Parameters
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
Parameters
string $query
string $lang
public withDidYouMeanSuggestions(string $query):Factories
Parameters
string $query
public withSalableVariationCount():VariationSearchFactory
public inherit(array $inheritedProperties = []):BaseSearchFactory

Create a new factory instance based on properties of an existing factory.

Parameters
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.

Parameters
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.

Parameters
string $filterClass
array $params
public withFilter(TypeInterface
 $filter):Factories

Add a filter. Will override existing filter instances.

Parameters
TypeInterface $filter
public withResultFields($fields):Factories

Set fields to be contained in search result.

Parameters
$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.

Parameters
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.

Parameters
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

Parameters
AggregationInterface $aggregation
public withSuggestion(SuggestionInterface
 $suggestion):Factories

Add a suggestion

Parameters
SuggestionInterface $suggestion
public setPage(int $page, int $itemsPerPage):Factories

Set pagination parameters.

Parameters
int $page
int $itemsPerPage
public sortBy(string $field, string $order = \Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory::SORTING_ORDER_DESC):Factories

Add sorting parameters

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

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.

Parameters
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

Parameters
string $field The field to group properties by.
array $sortings List of sort criteria. Might contain string

Helpers

FacetExtensionContainer

Container to collect facet extensions

Namespace

Plenty\Modules\Webshop\ItemSearch\Helpers

Methods

public getFacetExtensions():array

Get all registered facet extensions.

public addFacetExtension(FacetExtension
 $facetExtension):void

Add an extension to provide a custom facet.

Parameters
FacetExtension $facetExtension The extension describing the facet behavior

ResultFieldTemplate

Collect templates to read required result fields for several views from.

Namespace

Plenty\Modules\Webshop\ItemSearch\Helpers

Methods

public static get(string $template):string

Get the path to result fields file from a plugin

Parameters
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.

Parameters
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.

Parameters
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.

Parameters
array $templateMap
bool $overwriteExistingData
public requireFields($event, $field = null):void

Add required fields to variation search requests.

Parameters
$event A single template event to set required fields for or a map between template events and list of required fields
$field If first parameter describes a single template event this parameter may contain a single result field or a list of field to require.

SortingHelper

Helper class to convert sorting configuration values into internal sorting paramters used by variation data interface.

Namespace

Plenty\Modules\Webshop\ItemSearch\Helpers

Methods

public getSorting(string $sortingConfig = null, bool $isCategory = true):array

Get sorting values from plugin configuration

Parameters
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:
  • item.id
  • texts.name1
  • texts.name2
  • texts.name3
  • variation.createdAt
  • variation.updatedAt
  • variation.id
  • variation.number
  • variation.availability.averageDays
  • variation.position
  • item.manufacturer.externalName
  • >
  • item.manufacturer.position
  • >
  • stock.net
  • sorting.price.avg
  • item.random
  • item.feedbackDecimal
bool $isCategory Get default sorting configuration for category or for search
public getCategorySorting(string $sortingConfig = null):array

Get sorting values for categories from config

Parameters
string $sortingConfig The configuration value
public getSearchSorting(string $sortingConfig = null):array

Get sorting values for searches from config

Parameters
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 '_'.

Parameters
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.

Parameters
string $sorting The sorting of the item list to get the inner sorting value for.
public static isLanguageSupported(string $lang):bool
Parameters
string $lang
public static isLanguageActivated(string $lang):bool
Parameters
string $lang
public static getM10lByLanguage(string $lang, string $fallback = "en"):string
Parameters
string $lang
string $fallback
public static getLanguageByM10l(string $lang, string $fallback = "english"):string
Parameters
string $lang
string $fallback

SearchPresets

BasketItems

Query basket items.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods

public static getSearchFactory(array $options):VariationSearchFactory

Get preset search factory.

Parameters
array $options Available options:
  • variationIds Ids of basket items to get data for
  • quantities Quantity of each item to be considered when searching prices
  • language Required items to have a name configured in this language

CategoryItems

Query items for a single category

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods

public static getSearchFactory(array $options):VariationSearchFactory

Get preset search factory.

Parameters
array $options Available options:
  • categoryId Category id to get variations for
  • facets Active facets to filter variations by
  • sorting Configuration value from plugin config
  • page Current page
  • itemsPerPage Number of items per page
  • priceMin Minimum price of the variations
  • priceMax Maximum price of the variations

CrossSellingItems

Query cross selling items related to single item.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods

public static getSearchFactory(array $options):VariationSearchFactory

Get preset search factory.

Parameters
array $options Available options:
  • itemId Id of the item to get cross selling items for
  • relation The relation to consider when getting cross selling items. Default: 'Similar'
  • sorting Sorting of the returned items

Facets

Query facets for the item search of the webstore.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods

public static getSearchFactory(array $options):FacetSearchFactory

Get preset search factory.

Parameters
array $options Available options:
  • facets Values of active facets.
  • categoryId Category Id to filter variations by.
  • query Search string to get variations by.
  • autocomplete Flag indicating if autocomplete search should be used (boolean). Will only be used if 'query' is defined.

LiveShoppingItems

Query live shopping items.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods

public static getSearchFactory(array $options):VariationSearchFactory

Get preset search factory.

Parameters
array $options Available options:
  • itemId Id of an item to be queried
  • itemIds List of item ids to be queried
  • sorting Sorting of returned item
  • resultFields List of result fields to be used when querying items. Will use ResultField template for list items if not defined.

ManufacturerItems

Query items by manufacturer.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods

public static getSearchFactory(array $options):VariationSearchFactory

Get preset search factory.

Parameters
array $options Available options:
  • manufacturerId Id of the manufacturer to query items for.
  • sorting Sorting of items
  • itemsPerPage Number of items per page
  • page Current page of results

SearchItems

Query items from the item search of the webstore.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods

public static getSearchFactory(array $options):VariationSearchFactory

Get preset search factory.

Parameters
array $options Available options:
  • query The search string
  • facets Facet values of active facets
  • sorting Configuration value from plugin config
  • page The current page
  • itemsPerPage Number of items per page
  • priceMin Minimum price of the variations
  • priceMax Maximum price of the variations
  • autocomplete Flag indicating if autocompletion should be used

SearchPreset

Define a preset of search request parameters to be reused for common search requests. *

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods

public static getSearchFactory(array $options):void

Get the search factory from the preset.

Parameters
array $options

SearchSuggestions

Query items to display search suggestions

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods

public static getSearchFactory(array $options):VariationSearchFactory

Get preset search factory.

Parameters
array $options Available options:
  • sorting Sorting of items
  • query Search query to get suggestions for

SingleItem

Get item to be displayed on single item pages

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods

public static getSearchFactory(array $options):VariationSearchFactory

Get preset search factory.

Parameters
array $options Available options:
  • itemId Item id to get
  • variationId Variation id to get. If not defined, plugin configuration will be considered if main or child variation should be displayed.
  • setCategory Flag indicating if item should be set as current item to be displayed in breadcrumbs

TagItems

Query items by tag id.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods

public static getSearchFactory(array $options):VariationSearchFactory

Get preset search factory.

Parameters
array $options Available options:
  • tagIds List of tag ids to query items by
  • priceMin Minimum price to filter items by
  • priceMax Maximum price to filter items by

VariationAttributeMap

Append list of all variations for attribute selection in item views

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods

public static getSearchFactory(array $options):VariationSearchFactory

Get preset search factory.

Parameters
array $options Available options
  • itemId Id of the to get variations and attributes for
  • variationId Id of a variation that is selected by default. Attribute values for this variation will be included on first page surely.
  • afterKey This might be provided from previous search requests to enable pagination of variation entries

VariationList

Search for variation lists

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods

public static getSearchFactory(array $options):VariationSearchFactory

Get preset search factory.

Parameters
array $options Available options:
  • variationIds List of variations to receive
  • sorting Configuration value to get sorting for
  • sortingField Field to sort items by. Will be appended to sorting list if sorting configuration is defined.
  • sortingOrder Order to sort items with ('asc', 'desc')
  • page The current page
  • itemsPerPage Number of items per page
  • excludeFromCache Set to true if results should not be linked to response

Services

ItemSearchService

Execute item searches using the variation data interface

Namespace

Plenty\Modules\Webshop\ItemSearch\Services

Methods

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.

Parameters
$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.

Parameters
$searchFactory The factory to get results for.

Order

Contracts

OrderRepositoryContract

Create orders from the webshop

Namespace

Plenty\Modules\Webshop\Order\Contracts

Methods

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.

Parameters
array $returnOrderData Data to create the return order with.
int $orderId Id of the original order

Seo

Contracts

RobotsRepositoryContract

Repository to read or write content of the robots.txt

Namespace

Plenty\Modules\Webshop\Seo\Contracts

Methods

public findByWebstoreId(int $webstoreId):Robots

Get the content of the robots.txt for a single webstore.

Parameters
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.

Parameters
int $webstoreId Id of the webstore to update the robots.txt for.
string $data Content of the robots.txt

SitemapConfigurationRepositoryContract

Repository for sitemap configuration

Namespace

Plenty\Modules\Webshop\Seo\Contracts

Methods

public findByWebstoreId(int $webstoreId):SitemapConfiguration

Get the sitemap configuration of a single webstore.

Parameters
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.

Parameters
int $webstoreId Id of the webstore to get sitemap configuration for.
array $data Sitemap configuration data

Models

Robots

Model for the configured content of the robots.txt

Namespace

Plenty\Modules\Webshop\Seo\Models

Properties

Type Name Description
string value Content of the robots.txt file

Methods

public toArray()

Returns this model as an array.

SitemapConfiguration

The sitemap configuration model

Namespace

Plenty\Modules\Webshop\Seo\Models

Properties

Type Name Description
int contentCategory
int itemCategory
int item
int blog

Methods

public toArray()

Returns this model as an array.

Template

Contracts

TemplateConfigRepositoryContract

Set configuration values from the plugin to be considered in internal functions.

Namespace

Plenty\Modules\Webshop\Template\Contracts

Methods

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>

Parameters
string $key Configuration key to set value for
$value Configuration value to set

Providers

TemplateServiceProvider

Service provider for template plugins

Namespace

Plenty\Modules\Webshop\Template\Providers

Methods

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.

Parameters
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.

Parameters
string $original
string $alias