Plentymarkets interface documentation

ConsentRepositoryContract

Repository to register consents and check for users response.

Namespace

Plenty\Modules\Webshop\Consent\Contracts

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

Register a new group of consents.

Parameters

Name

Type

Description

$key

string

Unique identifier of the group

$label

string

Displayed label of the group

$options

Additional options of the group. Available options are: <ul> <li><b>necessary:boolean</b> True if the group is necessary and could not be declined</li> <li><b>description:string</b> Description of the group.</li> <li><b>position:number</b> The position of the group</li> </ul> Alternatively provide a function which returns all options. This will be resolved if registered consent groups are requested.

public registerConsent($key, $label, $options = []):void

Register a new consent.

Parameters

Name

Type

Description

$key

string

Unique identifier of the consent.

$label

string

Displayed label of the consent.

$options

Additional options of the consent. Available options are: <ul> <li><b>necessary:boolean</b> True of the consent is necessary and could not be declined</li> <li><b>description:string</b> Description of the consent</li> <li><b>provider:string</b> The provider of the cookie</li> <li><b>lifespan:string</b> Lifespan of the cookie</li> <li><b>policyUrl:string</b> URL to external privacy policy</li> <li><b>group:string</b> Identifier of an consent group</li> <li><b>position:number</b> The position of the consent in the group</li> <li><b>isOptOut:boolean</b> Select the consent by default. The user needs to decline the consent explicitly.</li> <li><b>cookieNames:array</b> Names of cookies which will be set. These cookies will not be blocked after the user confirmed the consent.</li> </ul> Alternatively provide a function which returns all options. This will be resolved if registered consents are requested.

public getConsentGroups():Illuminate\Support\Collection
Return type: Collection

Get all consent groups including all consents.

public hasResponse():bool

Check if the user has already responded the consents.

public setResponse($key, $isConsented = false):void

Set the response for a consent or a group of consents.

Parameters

Name

Type

Description

$key

string

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

$isConsented

bool

True if the user has accepted the consent or the group of consents

public isConsented($key):bool

Check if the user has consented.

Parameters

Name

Type

Description

$key

string

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

ContactForm

Contracts

ContactFormFileRepositoryContract

Repository to upload files from the online store contact form and retrieve them

Namespace

Plenty\Modules\Webshop\ContactForm\Contracts

Methods
public uploadFiles($fileData):array
Parameters

Name

Type

Description

$fileData

array

public getFile($fileName):Plenty\Modules\Cloud\Storage\Models\StorageObject
Return type: StorageObject
Parameters

Name

Type

Description

$fileName

string

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($currency):void

Set the currency.

Parameters

Name

Type

Description

$currency

string

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():Plenty\Modules\Account\Contact\Models\Contact
Return type: Contact

Get the logged in contact

public getContactClassId():int

Get the contact class ID of the logged in contact

public getContactClassData($contactClassId):array

Get the contact class data for the provided contact class ID

Parameters

Name

Type

Description

$contactClassId

int

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($orderId, $orderItemId, $campaignCodeOrderId):bool

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

Parameters

Name

Type

Description

$orderId

int

$orderItemId

int

$campaignCodeOrderId

int

public getGiftCardInformation($orderItemId):array

Get Information about the gift card

Parameters

Name

Type

Description

$orderItemId

int

public isReturnable($orderItemId):bool

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

Parameters

Name

Type

Description

$orderItemId

int

public getReturnQuantity($orderItemId):int

Returnable quantity for giftCard

Parameters

Name

Type

Description

$orderItemId

int

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($countryCode = null):string

Get a ISO language code by given country code.

Parameters

Name

Type

Description

$countryCode

string

SessionStorageRepositoryContract

Repository for webshop session information

Namespace

Plenty\Modules\Webshop\Contracts

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

Set a value to a given key in the session

Parameters

Name

Type

Description

$key

string

The key from session

$value

The value will set to given key

public getSessionValue($key):void

Get a value from the session by a given key

Parameters

Name

Type

Description

$key

string

The key to read from the session

public getCustomer():Plenty\Modules\Frontend\Session\Storage\Models\Customer
Return type: Customer

Get the customer session model

public getOrder():Plenty\Modules\Frontend\Session\Storage\Models\Order
Return type: 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($itemId, $lang = null):Plenty\Modules\Webshop\Helpers\UrlQuery
Return type: UrlQuery

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

Parameters

Name

Type

Description

$itemId

int

Id of the item to generate url for.

$lang

string

Language to generate the url in. Defaults to current language from session.

public buildCategoryUrl($categoryId, $lang = null, $webstoreId = null):Plenty\Modules\Webshop\Helpers\UrlQuery
Return type: UrlQuery

Build category url by recursively prepending url names of parent categories.

Parameters

Name

Type

Description

$categoryId

int

Id of the category to get url for.

$lang

string

Language to generate the url in. Defaults to current language from session.

$webstoreId

int

Webstore to get url names for. Defaults to current webstore id.

public fillItemUrl($itemData):void

Store item data of loaded items to be reused when generating item or variation urls.

Parameters

Name

Type

Description

$itemData

array

Item data object returned from search request.

public buildVariationUrl($itemId, $variationId, $lang = null):Plenty\Modules\Webshop\Helpers\UrlQuery
Return type: UrlQuery

Build variation url. Variation urls equal to item urls with the variation id appended.

Parameters

Name

Type

Description

$itemId

int

Id of the item to generate url for.

$variationId

int

Id of the variation to generate url for.

$lang

string

Language to generate the url in. Defaults to current language from session.

public getSuffix($itemId, $variationId, $withVariationId = true):string

Get the suffix to be appended to item or variation urls.

Parameters

Name

Type

Description

$itemId

int

item id to be used in the suffix.

$variationId

int

variation id to be used in the suffix. Will be ignored when using Callisto urls.

$withVariationId

bool

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():Plenty\Modules\System\Models\WebstoreConfiguration
Return type: 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

public setFaviconFromWebspace($plentyId, $faviconUrl):string

Copy a favicon from the frontend webspace to the internal storage to be available at the frontend domain.

Parameters

Name

Type

Description

$plentyId

int

plentyId of the client to upload the favicon for.

$faviconUrl

string

Url of the favicon file in the frontend webspace

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

BasePrice

Helper class for base price information.

Namespace

Plenty\Modules\Webshop\Helpers

Methods
public getFormattedBasePrice($variationId, $price, $currency, $language = null):string

Return a formatted string with base price information.

Parameters

Name

Type

Description

$variationId

int

$price

float

$currency

string

$language

string

NumberFormatter

Helper class for number formatting

Namespace

Plenty\Modules\Webshop\Helpers

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

Format the given value to decimal

Parameters

Name

Type

Description

$value

float

$decimal_places

int

public formatMonetary($value, $currencyISO):string

Format the given value to currency

Parameters

Name

Type

Description

$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($key, $possibleValues = [], $default = []):array

Get values of a multiselect configuration.

Parameters

Name

Type

Description

$key

string

The key of the configuration to read.

$possibleValues

array

List of possible configuration values. Will be returned if the configuration value is "all"

$default

array

A default value to return if the configuration is not set yet.

public getTextValue($key, $default = &quot;&quot;, $transformDefault = &quot;&quot;):string

Get the value of a text configuration.

Parameters

Name

Type

Description

$key

string

The key of the configuration to read.

$default

string

A default value to return if the configuration is not set yet.

$transformDefault

string

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($key, $default):int

Get the value of an integer configuration.

Parameters

Name

Type

Description

$key

string

The key of the configuration to read.

$default

int

A default value to return if the configuration is not set yet.

public getBooleanValue($key, $default = false):bool

Get the value of a boolean configuration.

Parameters

Name

Type

Description

$key

string

The key of the configuration to read.

$default

bool

A default value to return if the configuration is not set yet.

public getConfigValue($key, $default = null):void

Get a configuration value without any cast.

Parameters

Name

Type

Description

$key

string

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($unit = &quot;SMM&quot;):string

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

Parameters

Name

Type

Description

$unit

string

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($path = null, $lang = null):Plenty\Modules\Webshop\Helpers\UrlQuery
Return type: UrlQuery

Create a new instance.

Parameters

Name

Type

Description

$path

string

The path of the url.

$lang

string

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($suffix):Plenty\Modules\Webshop\Helpers
Return type: Helpers

Append a string to the path the url without checking for slashes.

Parameters

Name

Type

Description

$suffix

string

String to append to the path.

public join($path):Plenty\Modules\Webshop\Helpers
Return type: Helpers

Append a new path to the existing one. Ensure having a slash as glue between existing path and the new segment.

Parameters

Name

Type

Description

$path

string

The new path to append.

public toAbsoluteUrl($includeLanguage = false):string

Return the absolute url by prepending the HTTPS domain of the current client.

Parameters

Name

Type

Description

$includeLanguage

bool

If true it will include the language at the beginning of the path.

public toRelativeUrl($includeLanguage = false):string

Return the path as a relative url.

Parameters

Name

Type

Description

$includeLanguage

bool

If true it will include the language at the beginning of the path.

public getPath($includeLanguage = false):string

Return the path. This equals the relative url without a leading slash.

Parameters

Name

Type

Description

$includeLanguage

bool

If true it will include the language at the beginning of the path.

public equals($path):bool

Compare current path to a string independent of a trailing slash.

Parameters

Name

Type

Description

$path

string

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($vatNumberEvent):void

Validate the given vat number

Parameters

Name

Type

Description

$vatNumberEvent

ValidateVatNumber

Event emitted while creating new addresses.

ItemSearch

Contracts

FacetExtension

Interface to add custom facets.

Namespace

Plenty\Modules\Webshop\ItemSearch\Contracts

Methods
public getAggregation():Plenty\Modules\Cloud\ElasticSearch\Lib\Search\Aggregation\AggregationInterface
Return type: AggregationInterface

Get the aggregation to apply the facet to the search results.

public mergeIntoFacetsList($result):array

Merge facet data into list of facets.

Parameters

Name

Type

Description

$result

Facet data

public extractFilterParams($filtersList):void

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

Parameters

Name

Type

Description

$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($inheritedProperties = []):Plenty\Modules\Webshop\ItemSearch\Factories\BaseSearchFactory
Return type: BaseSearchFactory

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

Parameters

Name

Type

Description

$inheritedProperties

array

List of properties to inherit or null to inherit all properties.

public withMutator($mutator, $excludeDependencies = false, $position = 1000):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add a mutator to transform search results.

Parameters

Name

Type

Description

$mutator

MutatorInterface

The mutator itself

$excludeDependencies

bool

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.

$position

int

Position of the mutator. Mutators are executed in the order of their positions.

public createFilter($filterClass, $params = []):void

Add a filter. Will create a new instance of the filter class if not already created.

Parameters

Name

Type

Description

$filterClass

string

$params

array

public withFilter($filter):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add a filter. Will override existing filter instances.

Parameters

Name

Type

Description

$filter

TypeInterface

public withResultFields($fields):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Set fields to be contained in search result.

Parameters

Name

Type

Description

$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($field):bool

Check if result field is already included in the source of the search.

Parameters

Name

Type

Description

$field

string

The field to search for in result fields

public getAdditionalResultFields():array

Get additional result fields required by webshop mutators.

public withExtension($extensionClass, $extensionParams = []):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add an extension.

Parameters

Name

Type

Description

$extensionClass

string

Extension class to add.

$extensionParams

array

Additional parameters to pass to extensions constructor

public getExtensions():array

Get all registered extensions

public getMutators():array

Get all registered mutators

public withAggregation($aggregation):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add an aggregation

Parameters

Name

Type

Description

$aggregation

AggregationInterface

public withSuggestion($suggestion):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add a suggestion

Parameters

Name

Type

Description

$suggestion

SuggestionInterface

public setPage($page, $itemsPerPage):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Set pagination parameters.

Parameters

Name

Type

Description

$page

int

$itemsPerPage

int

public sortBy($field, $order = \Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory::SORTING_ORDER_DESC):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add sorting parameters

Parameters

Name

Type

Description

$field

string

The field to order by

$order

string

Direction to order results. Possible values: 'asc' or 'desc'

public sortByMultiple($sortingList):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add multiple sorting parameters

Parameters

Name

Type

Description

$sortingList

array

List of sorting parameters. Each entry should have a 'field' and an 'order' property.

public setOrder($idList):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Set the order of the search results by ids.

Parameters

Name

Type

Description

$idList

array

List of variation ids. Search results will be sorted in the same order.

public groupBy($field, $sortings = []):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Group results by field

Parameters

Name

Type

Description

$field

string

The field to group properties by.

$sortings

array

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):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

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

Parameters

Name

Type

Description

$facets

List of active facet values. If string is given, it will be exploded by ',' to a list of values.

public withMinimumCount():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Register extension to filter facets by minimum hit count.

public static default($options = []):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Get the default configuration of a search factory.

Parameters

Name

Type

Description

$options

array

Available options <ul> <li><b>quantities</b> Quantities of the variations in the basket. This will be considered while calculating graduated prices</li> <li><b>setPriceOnly</b> Set to true to only consider prices for item sets</li> </ul>

public setAdminPreview($isAdminPreview):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Set preview mode for the search request.

Parameters

Name

Type

Description

$isAdminPreview

bool

Set to true to enable preview.

public isActive():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter active variations

public isInactive():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter inactive variations

public hasItemId($itemId):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variation by a single item id

Parameters

Name

Type

Description

$itemId

int

Item id to filter by.

public hasItemIds($itemIds):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by multiple item ids

Parameters

Name

Type

Description

$itemIds

array

List of item ids to filter by.

public hasVariationId($variationId):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variation by a single variation id.

Parameters

Name

Type

Description

$variationId

int

The variation id to filter by.

public hasVariationIds($variationIds):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by multiple variation ids.

Parameters

Name

Type

Description

$variationIds

array

List of variation ids to filter by.

public hasAtLeastOneAvailability($availabilityIds):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by multiple availability ids.

Parameters

Name

Type

Description

$availabilityIds

array

List of availability ids to filter by.

public hasSupplier($supplierId):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by multiple availability ids.

Parameters

Name

Type

Description

$supplierId

int

The supplier id to filter by.

public hasManufacturer($manufacturerId):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter manufacturers by id.

Parameters

Name

Type

Description

$manufacturerId

int

To filter by manufacturer

public hasEachProperty($propertyIds):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by multiple property ids.

Parameters

Name

Type

Description

$propertyIds

array

The property ids to filter by.

public isMain():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter only main variations

public isChild():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter only child variations

public isHiddenInCategoryList($isHidden = true):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter by visibility in category list.

Parameters

Name

Type

Description

$isHidden

bool

Visibility in category list to filter by.

public isSalable():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by isSalable flag

public isVisibleForClient($clientId = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by visibility for client

Parameters

Name

Type

Description

$clientId

int

The client id to filter by. If null, default client id from config will be used.

public hasNameInLanguage($type = &quot;hasAnyNameInLanguage&quot;, $lang = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations having texts in a given language.

Parameters

Name

Type

Description

$type

string

The text field to filter by ('hasAny', 'hasName1', 'hasName2', 'hasName3')

$lang

string

The language to filter by. If null, language defined in session will be used.

public isInCategory($categoryId):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations contained in a category.

Parameters

Name

Type

Description

$categoryId

int

A category id to filter variations by.

public hasAtLeastOnePrice($priceIds):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations having at least on price.

Parameters

Name

Type

Description

$priceIds

array

List of price ids to filter variations by

public hasPriceForCustomer():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations having at least one price accessible by current customer.

public hasPriceInRange($priceMin, $priceMax):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
Parameters

Name

Type

Description

$priceMin

float

$priceMax

float

public hasTag($tagId):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
Parameters

Name

Type

Description

$tagId

int

public hasAnyTag($tagIds):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
Parameters

Name

Type

Description

$tagIds

array

public groupByTemplateConfig():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Group results depending on a config value.

public isCrossSellingItem($itemId, $relation):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations having a cross selling relation to a given item.

Parameters

Name

Type

Description

$itemId

int

Item id to filter cross selling items for

$relation

string

The relation of cross selling items.

public hasFacets($facetValues, $clientId = null, $lang = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by facets.

Parameters

Name

Type

Description

$facetValues

List of facet values. If string is given, it will be exploded by ';'

$clientId

int

Client id to filter facets by. If null, default client id from config will be used.

$lang

string

Language to filter facets by. If null, active language from session will be used.

public hasSearchString($query, $lang = null, $a = &quot;&quot;, $b = &quot;&quot;):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by given search string.

Parameters

Name

Type

Description

$query

string

The search string to filter variations by

$lang

string

The language to apply search on. If null, default language from session will be used

$a

string

The item search operator should be "or" or "and"

$b

string

public hasNameString($query, $lang = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by searching names

Parameters

Name

Type

Description

$query

string

The search string

$lang

string

Language to apply search on. If null, default language from session will be used.

public withLanguage($lang = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Only request given language.

Parameters

Name

Type

Description

$lang

string

Language to get texts for. If null, default language from session will be used.

public withImages($clientId = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Include images in result

Parameters

Name

Type

Description

$clientId

int

The client id to get images for. If null, default client id from config will be used.

public withVariationAttributeMap($itemId, $initialVariationId, $afterKey = []):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Includes VariationAttributeMap for variation select

Parameters

Name

Type

Description

$itemId

int

$initialVariationId

int

$afterKey

array

public withPropertyGroups($displaySettings = []):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
Parameters

Name

Type

Description

$displaySettings

array

public withOrderPropertySelectionValues():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withVariationProperties():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withUrls():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Append URLs to result.

public withPrices($quantities = [], $setPriceOnly = false):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Append prices to result.

Parameters

Name

Type

Description

$quantities

array

$setPriceOnly

bool

public withCurrentCategory():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Set result as current category

public withDefaultImage():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Append default item image if images are requested by result fields and item does not have any image

public withBundleComponents():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add bundle component variations.

public withSetComponents():void

Add set component variations to item set entries.

public withLinkToContent():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withGroupedAttributeValues():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withReducedResults():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withAvailability():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withTags():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withCategories():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withSuggestions($query = &quot;&quot;, $lang = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
Parameters

Name

Type

Description

$query

string

$lang

string

public withDidYouMeanSuggestions($query):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
Parameters

Name

Type

Description

$query

string

public withSalableVariationCount():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public inherit($inheritedProperties = []):Plenty\Modules\Webshop\ItemSearch\Factories\BaseSearchFactory
Return type: BaseSearchFactory

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

Parameters

Name

Type

Description

$inheritedProperties

array

List of properties to inherit or null to inherit all properties.

public withMutator($mutator, $excludeDependencies = false, $position = 1000):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add a mutator to transform search results.

Parameters

Name

Type

Description

$mutator

MutatorInterface

The mutator itself

$excludeDependencies

bool

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.

$position

int

Position of the mutator. Mutators are executed in the order of their positions.

public createFilter($filterClass, $params = []):void

Add a filter. Will create a new instance of the filter class if not already created.

Parameters

Name

Type

Description

$filterClass

string

$params

array

public withFilter($filter):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add a filter. Will override existing filter instances.

Parameters

Name

Type

Description

$filter

TypeInterface

public withResultFields($fields):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Set fields to be contained in search result.

Parameters

Name

Type

Description

$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($field):bool

Check if result field is already included in the source of the search.

Parameters

Name

Type

Description

$field

string

The field to search for in result fields

public getAdditionalResultFields():array

Get additional result fields required by webshop mutators.

public withExtension($extensionClass, $extensionParams = []):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add an extension.

Parameters

Name

Type

Description

$extensionClass

string

Extension class to add.

$extensionParams

array

Additional parameters to pass to extensions constructor

public getExtensions():array

Get all registered extensions

public getMutators():array

Get all registered mutators

public withAggregation($aggregation):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add an aggregation

Parameters

Name

Type

Description

$aggregation

AggregationInterface

public withSuggestion($suggestion):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add a suggestion

Parameters

Name

Type

Description

$suggestion

SuggestionInterface

public setPage($page, $itemsPerPage):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Set pagination parameters.

Parameters

Name

Type

Description

$page

int

$itemsPerPage

int

public sortBy($field, $order = \Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory::SORTING_ORDER_DESC):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add sorting parameters

Parameters

Name

Type

Description

$field

string

The field to order by

$order

string

Direction to order results. Possible values: 'asc' or 'desc'

public sortByMultiple($sortingList):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add multiple sorting parameters

Parameters

Name

Type

Description

$sortingList

array

List of sorting parameters. Each entry should have a 'field' and an 'order' property.

public setOrder($idList):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Set the order of the search results by ids.

Parameters

Name

Type

Description

$idList

array

List of variation ids. Search results will be sorted in the same order.

public groupBy($field, $sortings = []):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Group results by field

Parameters

Name

Type

Description

$field

string

The field to group properties by.

$sortings

array

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($options = []):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Get the default configuration of a search factory.

Parameters

Name

Type

Description

$options

array

Available options <ul> <li><b>quantities</b> Quantities of the variations in the basket. This will be considered while calculating graduated prices</li> <li><b>setPriceOnly</b> Set to true to only consider prices for item sets</li> </ul>

public setAdminPreview($isAdminPreview):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Set preview mode for the search request.

Parameters

Name

Type

Description

$isAdminPreview

bool

Set to true to enable preview.

public isActive():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter active variations

public isInactive():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter inactive variations

public hasItemId($itemId):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variation by a single item id

Parameters

Name

Type

Description

$itemId

int

Item id to filter by.

public hasItemIds($itemIds):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by multiple item ids

Parameters

Name

Type

Description

$itemIds

array

List of item ids to filter by.

public hasVariationId($variationId):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variation by a single variation id.

Parameters

Name

Type

Description

$variationId

int

The variation id to filter by.

public hasVariationIds($variationIds):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by multiple variation ids.

Parameters

Name

Type

Description

$variationIds

array

List of variation ids to filter by.

public hasAtLeastOneAvailability($availabilityIds):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by multiple availability ids.

Parameters

Name

Type

Description

$availabilityIds

array

List of availability ids to filter by.

public hasSupplier($supplierId):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by multiple availability ids.

Parameters

Name

Type

Description

$supplierId

int

The supplier id to filter by.

public hasManufacturer($manufacturerId):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter manufacturers by id.

Parameters

Name

Type

Description

$manufacturerId

int

To filter by manufacturer

public hasEachProperty($propertyIds):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by multiple property ids.

Parameters

Name

Type

Description

$propertyIds

array

The property ids to filter by.

public isMain():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter only main variations

public isChild():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter only child variations

public isHiddenInCategoryList($isHidden = true):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter by visibility in category list.

Parameters

Name

Type

Description

$isHidden

bool

Visibility in category list to filter by.

public isSalable():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by isSalable flag

public isVisibleForClient($clientId = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by visibility for client

Parameters

Name

Type

Description

$clientId

int

The client id to filter by. If null, default client id from config will be used.

public hasNameInLanguage($type = &quot;hasAnyNameInLanguage&quot;, $lang = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations having texts in a given language.

Parameters

Name

Type

Description

$type

string

The text field to filter by ('hasAny', 'hasName1', 'hasName2', 'hasName3')

$lang

string

The language to filter by. If null, language defined in session will be used.

public isInCategory($categoryId):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations contained in a category.

Parameters

Name

Type

Description

$categoryId

int

A category id to filter variations by.

public hasAtLeastOnePrice($priceIds):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations having at least on price.

Parameters

Name

Type

Description

$priceIds

array

List of price ids to filter variations by

public hasPriceForCustomer():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations having at least one price accessible by current customer.

public hasPriceInRange($priceMin, $priceMax):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
Parameters

Name

Type

Description

$priceMin

float

$priceMax

float

public hasTag($tagId):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
Parameters

Name

Type

Description

$tagId

int

public hasAnyTag($tagIds):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
Parameters

Name

Type

Description

$tagIds

array

public groupByTemplateConfig():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Group results depending on a config value.

public isCrossSellingItem($itemId, $relation):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations having a cross selling relation to a given item.

Parameters

Name

Type

Description

$itemId

int

Item id to filter cross selling items for

$relation

string

The relation of cross selling items.

public hasFacets($facetValues, $clientId = null, $lang = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by facets.

Parameters

Name

Type

Description

$facetValues

List of facet values. If string is given, it will be exploded by ';'

$clientId

int

Client id to filter facets by. If null, default client id from config will be used.

$lang

string

Language to filter facets by. If null, active language from session will be used.

public hasSearchString($query, $lang = null, $a = &quot;&quot;, $b = &quot;&quot;):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by given search string.

Parameters

Name

Type

Description

$query

string

The search string to filter variations by

$lang

string

The language to apply search on. If null, default language from session will be used

$a

string

The item search operator should be "or" or "and"

$b

string

public hasNameString($query, $lang = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Filter variations by searching names

Parameters

Name

Type

Description

$query

string

The search string

$lang

string

Language to apply search on. If null, default language from session will be used.

public withLanguage($lang = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Only request given language.

Parameters

Name

Type

Description

$lang

string

Language to get texts for. If null, default language from session will be used.

public withImages($clientId = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Include images in result

Parameters

Name

Type

Description

$clientId

int

The client id to get images for. If null, default client id from config will be used.

public withVariationAttributeMap($itemId, $initialVariationId, $afterKey = []):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Includes VariationAttributeMap for variation select

Parameters

Name

Type

Description

$itemId

int

$initialVariationId

int

$afterKey

array

public withPropertyGroups($displaySettings = []):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
Parameters

Name

Type

Description

$displaySettings

array

public withOrderPropertySelectionValues():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withVariationProperties():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withUrls():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Append URLs to result.

public withPrices($quantities = [], $setPriceOnly = false):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Append prices to result.

Parameters

Name

Type

Description

$quantities

array

$setPriceOnly

bool

public withCurrentCategory():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Set result as current category

public withDefaultImage():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Append default item image if images are requested by result fields and item does not have any image

public withBundleComponents():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add bundle component variations.

public withSetComponents():void

Add set component variations to item set entries.

public withLinkToContent():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withGroupedAttributeValues():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withReducedResults():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withAvailability():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withTags():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withCategories():Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
public withSuggestions($query = &quot;&quot;, $lang = null):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
Parameters

Name

Type

Description

$query

string

$lang

string

public withDidYouMeanSuggestions($query):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories
Parameters

Name

Type

Description

$query

string

public withSalableVariationCount():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public inherit($inheritedProperties = []):Plenty\Modules\Webshop\ItemSearch\Factories\BaseSearchFactory
Return type: BaseSearchFactory

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

Parameters

Name

Type

Description

$inheritedProperties

array

List of properties to inherit or null to inherit all properties.

public withMutator($mutator, $excludeDependencies = false, $position = 1000):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add a mutator to transform search results.

Parameters

Name

Type

Description

$mutator

MutatorInterface

The mutator itself

$excludeDependencies

bool

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.

$position

int

Position of the mutator. Mutators are executed in the order of their positions.

public createFilter($filterClass, $params = []):void

Add a filter. Will create a new instance of the filter class if not already created.

Parameters

Name

Type

Description

$filterClass

string

$params

array

public withFilter($filter):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add a filter. Will override existing filter instances.

Parameters

Name

Type

Description

$filter

TypeInterface

public withResultFields($fields):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Set fields to be contained in search result.

Parameters

Name

Type

Description

$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($field):bool

Check if result field is already included in the source of the search.

Parameters

Name

Type

Description

$field

string

The field to search for in result fields

public getAdditionalResultFields():array

Get additional result fields required by webshop mutators.

public withExtension($extensionClass, $extensionParams = []):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add an extension.

Parameters

Name

Type

Description

$extensionClass

string

Extension class to add.

$extensionParams

array

Additional parameters to pass to extensions constructor

public getExtensions():array

Get all registered extensions

public getMutators():array

Get all registered mutators

public withAggregation($aggregation):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add an aggregation

Parameters

Name

Type

Description

$aggregation

AggregationInterface

public withSuggestion($suggestion):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add a suggestion

Parameters

Name

Type

Description

$suggestion

SuggestionInterface

public setPage($page, $itemsPerPage):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Set pagination parameters.

Parameters

Name

Type

Description

$page

int

$itemsPerPage

int

public sortBy($field, $order = \Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory::SORTING_ORDER_DESC):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add sorting parameters

Parameters

Name

Type

Description

$field

string

The field to order by

$order

string

Direction to order results. Possible values: 'asc' or 'desc'

public sortByMultiple($sortingList):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Add multiple sorting parameters

Parameters

Name

Type

Description

$sortingList

array

List of sorting parameters. Each entry should have a 'field' and an 'order' property.

public setOrder($idList):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Set the order of the search results by ids.

Parameters

Name

Type

Description

$idList

array

List of variation ids. Search results will be sorted in the same order.

public groupBy($field, $sortings = []):Plenty\Modules\Webshop\ItemSearch\Factories
Return type: Factories

Group results by field

Parameters

Name

Type

Description

$field

string

The field to group properties by.

$sortings

array

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):void

Add an extension to provide a custom facet.

Parameters

Name

Type

Description

$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($template):string

Get the path to result fields file from a plugin

Parameters

Name

Type

Description

$template

string

The key of the template to get the path for.

public static load($template):array

Load result fields from a template file. Result field templates can be registered from a plugin.

Parameters

Name

Type

Description

$template

string

The key of the template to load file contents for.

public setTemplate($event, $template, $overwriteExistingData = true):void

Set the path of a template to read result fields from.

Parameters

Name

Type

Description

$event

string

The event to set the template for.

$template

string

Path to the template to read result fields from.

$overwriteExistingData

bool

Option to overwrite existing data

public setTemplates($templateMap, $overwriteExistingData = true):void

Set multiple templates to read result fields from.

Parameters

Name

Type

Description

$templateMap

array

$overwriteExistingData

bool

public requireFields($event, $field = null):void

Add required fields to variation search requests.

Parameters

Name

Type

Description

$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($sortingConfig = null, $isCategory = true):array

Get sorting values from plugin configuration

Parameters

Name

Type

Description

$sortingConfig

string

The configuration value from the plugin. Contains a sorting field and a sorting order joined by an '_', e.g. 'item.id_asc'<br> Possible sorting fields: <ul> <li>item.id</li> <li>texts.name1</li> <li>texts.name2</li> <li>texts.name3</li> <li>variation.createdAt</li> <li>variation.updatedAt</li> <li>variation.id</li> <li>variation.number</li> <li>variation.availability.averageDays</li> <li>variation.position</li> <li>item.manufacturer.externalName</li>> <li>item.manufacturer.position</li>> <li>stock.net</li> <li>sorting.price.avg</li> <li>item.random</li> <li>item.feedbackDecimal</li> </ul>

$isCategory

bool

Get default sorting configuration for category or for search

public getCategorySorting($sortingConfig = null):array

Get sorting values for categories from config

Parameters

Name

Type

Description

$sortingConfig

string

The configuration value

public getSearchSorting($sortingConfig = null):array

Get sorting values for searches from config

Parameters

Name

Type

Description

$sortingConfig

string

The configuration value

public getUsedItemName():string

Get the result field for the name to be displayed in the webshop.

public splitPathAndOrder($sorting):array

Explode configuration entries containing the field to sort by and the sorting order joined by an '_'.

Parameters

Name

Type

Description

$sorting

string

Sorting configuration value, e.g. text.name_asc

public mapToInnerSorting($sorting):string

Map (outer) sorting from item list to (inner) sorting to be applied on grouped variations of one item.

Parameters

Name

Type

Description

$sorting

string

The sorting of the item list to get the inner sorting value for.

public static isLanguageSupported($lang):bool
Parameters

Name

Type

Description

$lang

string

public static isLanguageActivated($lang):bool
Parameters

Name

Type

Description

$lang

string

public static getM10lByLanguage($lang, $fallback = &quot;en&quot;):string
Parameters

Name

Type

Description

$lang

string

$fallback

string

public static getLanguageByM10l($lang, $fallback = &quot;english&quot;):string
Parameters

Name

Type

Description

$lang

string

$fallback

string

VariationPropertyConverter

Service for mapping between variation order properties and old properties

Namespace

Plenty\Modules\Webshop\ItemSearch\Helpers

Methods
public convertOrderProperties($document):array
Parameters

Name

Type

Description

$document

array

public convertVariationPropertyOrderItems($orderItems):void
Parameters

Name

Type

Description

$orderItems

SearchPresets

BasketItems

Query basket items.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods
public static getSearchFactory($options):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

Get preset search factory.

Parameters

Name

Type

Description

$options

array

Available options: <ul> <li><b>variationIds</b> Ids of basket items to get data for</li> <li><b>quantities</b> Quantity of each item to be considered when searching prices</li> <li><b>language</b> Required items to have a name configured in this language</li> </ul>

CategoryItems

Query items for a single category

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods
public static getSearchFactory($options):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

Get preset search factory.

Parameters

Name

Type

Description

$options

array

Available options: <ul> <li><b>categoryId</b> Category id to get variations for</li> <li><b>facets</b> Active facets to filter variations by</li> <li><b>sorting</b> Configuration value from plugin config</li> <li><b>page</b> Current page</li> <li><b>itemsPerPage</b> Number of items per page</li> <li><b>priceMin</b> Minimum price of the variations</li> <li><b>priceMax</b> Maximum price of the variations</li> </ul>

CrossSellingItems

Query cross selling items related to single item.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods
public static getSearchFactory($options):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

Get preset search factory.

Parameters

Name

Type

Description

$options

array

Available options: <ul> <li><b>itemId</b> Id of the item to get cross selling items for</li> <li><b>relation</b> The relation to consider when getting cross selling items. Default: 'Similar'</li> <li><b>sorting</b> Sorting of the returned items</li> </ul>

Facets

Query facets for the item search of the webstore.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods
public static getSearchFactory($options):Plenty\Modules\Webshop\ItemSearch\Factories\FacetSearchFactory
Return type: FacetSearchFactory

Get preset search factory.

Parameters

Name

Type

Description

$options

array

Available options: <ul> <li><b>facets</b> Values of active facets.</li> <li><b>categoryId</b> Category Id to filter variations by.</li> <li><b>query</b> Search string to get variations by.</li> <li><b>autocomplete</b> Flag indicating if autocomplete search should be used (boolean). Will only be used if 'query' is defined.</li> </ul>

LiveShoppingItems

Query live shopping items.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods
public static getSearchFactory($options):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

Get preset search factory.

Parameters

Name

Type

Description

$options

array

Available options: <ul> <li><b>itemId</b> Id of an item to be queried</li> <li><b>itemIds</b> List of item ids to be queried</li> <li><b>sorting</b> Sorting of returned item</li> <li><b>resultFields</b> List of result fields to be used when querying items. Will use ResultField template for list items if not defined.</li> </ul>

ManufacturerItems

Query items by manufacturer.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods
public static getSearchFactory($options):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

Get preset search factory.

Parameters

Name

Type

Description

$options

array

Available options: <ul> <li><b>manufacturerId</b> Id of the manufacturer to query items for.</li> <li><b>sorting</b> Sorting of items</li> <li><b>itemsPerPage</b> Number of items per page</li> <li><b>page</b> Current page of results</li> </ul>

SearchItems

Query items from the item search of the webstore.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods
public static getSearchFactory($options):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

Get preset search factory.

Parameters

Name

Type

Description

$options

array

Available options: <ul> <li><b>query</b> The search string</li> <li><b>facets</b> Facet values of active facets</li> <li><b>sorting</b> Configuration value from plugin config</li> <li><b>page</b> The current page</li> <li><b>itemsPerPage</b> Number of items per page</li> <li><b>priceMin</b> Minimum price of the variations</li> <li><b>priceMax</b> Maximum price of the variations</li> <li><b>autocomplete</b> Flag indicating if autocompletion should be used</li> </ul>

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($options):void

Get the search factory from the preset.

Parameters

Name

Type

Description

$options

array

SearchSuggestions

Query items to display search suggestions

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods
public static getSearchFactory($options):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

Get preset search factory.

Parameters

Name

Type

Description

$options

array

Available options: <ul> <li><b>sorting</b> Sorting of items</li> <li><b>query</b> Search query to get suggestions for</li> </ul>

SingleItem

Get item to be displayed on single item pages

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods
public static getSearchFactory($options):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

Get preset search factory.

Parameters

Name

Type

Description

$options

array

Available options: <ul> <li><b>itemId</b> Item id to get</li> <li><b>variationId</b> Variation id to get. If not defined, plugin configuration will be considered if main or child variation should be displayed.</li> <li><b>setCategory</b> Flag indicating if item should be set as current item to be displayed in breadcrumbs</li> </ul>

TagItems

Query items by tag id.

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods
public static getSearchFactory($options):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

Get preset search factory.

Parameters

Name

Type

Description

$options

array

Available options: <ul> <li><b>tagIds</b> List of tag ids to query items by</li> <li><b>priceMin</b> Minimum price to filter items by</li> <li><b>priceMax</b> Maximum price to filter items by</li> </ul>

VariationAttributeMap

Append list of all variations for attribute selection in item views

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods
public static getSearchFactory($options):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

Get preset search factory.

Parameters

Name

Type

Description

$options

array

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

VariationList

Search for variation lists

Namespace

Plenty\Modules\Webshop\ItemSearch\SearchPresets

Methods
public static getSearchFactory($options):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

Get preset search factory.

Parameters

Name

Type

Description

$options

array

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

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

Name

Type

Description

$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

Name

Type

Description

$searchFactory

The factory to get results for.

Order

Contracts

OrderRepositoryContract

Create orders from the webshop

Namespace

Plenty\Modules\Webshop\Order\Contracts

Methods
public placeOrder():Plenty\Modules\Order\Models\Order
Return type: Order

Generate order data from current basket and place the order.

public createReturnOrder($returnOrderData, $orderId = null):Plenty\Modules\Order\Models\Order
Return type: Order

Create a return order for some items of an existing order.

Parameters

Name

Type

Description

$returnOrderData

array

Data to create the return order with.

$orderId

int

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($webstoreId):Plenty\Modules\Webshop\Seo\Models\Robots
Return type: Robots

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

Parameters

Name

Type

Description

$webstoreId

int

Id of the webstore to get the robots.txt for.

public updateByWebstoreId($webstoreId, $data):Plenty\Modules\Webshop\Seo\Models\Robots
Return type: Robots

Update the content of the robots.txt of a single webstore.

Parameters

Name

Type

Description

$webstoreId

int

Id of the webstore to update the robots.txt for.

$data

string

Content of the robots.txt

SitemapConfigurationRepositoryContract

Repository for sitemap configuration

Namespace

Plenty\Modules\Webshop\Seo\Contracts

Methods
public findByWebstoreId($webstoreId):Plenty\Modules\Webshop\Seo\Models\SitemapConfiguration
Return type: SitemapConfiguration

Get the sitemap configuration of a single webstore.

Parameters

Name

Type

Description

$webstoreId

int

Id of the webstore to get sitemap configuration for.

public updateByWebstoreId($webstoreId, $data = []):Plenty\Modules\Webshop\Seo\Models\SitemapConfiguration
Return type: SitemapConfiguration

Update the sitemap configuration of a single webstore.

Parameters

Name

Type

Description

$webstoreId

int

Id of the webstore to get sitemap configuration for.

$data

array

Sitemap configuration data

Models

Robots

Model for the configured content of the robots.txt

Namespace

Plenty\Modules\Webshop\Seo\Models

Properties
Name Type Description

value

string

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
Name Type Description

contentCategory

int

itemCategory

int

item

int

blog

int

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($key, $value):Plenty\Modules\Webshop\Template\Contracts\TemplateConfigRepositoryContract
Return type: 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

Name

Type

Description

$key

string

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($original, $override):void

Override a twig template. The new template will be used when the overridden template is going to be rendered.

Parameters

Name

Type

Description

$original

string

$override

string

public addTemplateAlias($original, $alias):void

Add an alias for a template. Rendering the template will also check for overrides of the alias template.

Parameters

Name

Type

Description

$original

string

$alias

string