Plentymarkets interface documentation

Category

Contracts

CategoryRepositoryContract

Get category data for plentyShop.

Namespace

Plenty\Modules\Webshop\Category\Contracts

Methods
public get($categoryId, $language = null, $webstoreId = null, $additionalFilter = [], $toObject = true):void

Return one category by id.

Parameters

Name

Type

Description

$categoryId

int

The id of the category.

$language

string

Optional language of category details, fallback is session language.

$webstoreId

int

Optional webstore id of category details, fallback is current webstore id.

$additionalFilter

array

Optional Whether or not to only include categories with given filters, allowed values ['onlySitemaps' ⇒ bool]

$toObject

bool

public getByCategoryUrl($categoryUrl, $language = null, $webstoreId = null):Plenty\Modules\Category\Models\Category
Return type: Category

Return one category by category url.

Parameters

Name

Type

Description

$categoryUrl

string

The url of the category.

$language

string

Optional language of category details, fallback is session language.

$webstoreId

int

Optional webstore id of category details, fallback is current webstore id.

public getUrl($categoryId, $language = null, $webstoreId = null, $additionalFilter = []):string

Retrieve the url for a category by id.

Parameters

Name

Type

Description

$categoryId

int

The id of the category.

$language

string

Optional language of category details, fallback is session language.

$webstoreId

int

Optional webstore id of category details, fallback is current webstore id.

$additionalFilter

array

Optional Whether or not to only include categories with given filters, allowed values ['onlySitemaps' ⇒ bool]

public getNavigationTree($type = "all", $language = "de", $clientId = null, $maxLevel = 6, $customerClassId, $resultFieldsTemplate = \Plenty\Modules\Webshop\ItemSearch\Helpers\ResultFieldTemplate::TEMPLATE_CATEGORY_TREE):array

Return navigation tree for plentyShop LTS only.

Parameters

Name

Type

Description

$type

$language

string

$clientId

int

$maxLevel

int

$customerClassId

int

$resultFieldsTemplate

string

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: * necessary:boolean True if the group is necessary and could not be declined * description:string Description of the group * position:number Position of the group 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: - 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. 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.

ConfirmationRepositoryContract

Repository to validate a order confirmation

Namespace

Plenty\Modules\Webshop\Contracts

Methods
public checkValidity($order):bool

Check validity for a given order

Parameters

Name

Type

Description

$order

Order

Order data to check validity

public checkOrderAccessStatus($order):string

Check the access status for a given order

Parameters

Name

Type

Description

$order

Order

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

CountryRepositoryContract

Repository to get and set country information for the webshop

Namespace

Plenty\Modules\Webshop\Contracts

Methods
public getEUCountriesList($lang):array
Parameters

Name

Type

Description

$lang

string

public getActiveCountriesList($lang):array
Parameters

Name

Type

Description

$lang

string

public getCombinedList($language):array
Parameters

Name

Type

Description

$language

string

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

public getHttpReferrerUri():string

Get the url of the document call while running a rest call without query params.

ShippingRepositoryContract

Get information about shipping and parcel presets.

Namespace

Plenty\Modules\Webshop\Contracts

Methods
public hasAnyPostOfficePreset():bool

Check if there is any parcel service preset that allows sending to post offices.

public hasAnyParcelBoxPreset():bool

Check if there is any parcel service preset that allows sending to parcel boxes.

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.

WebspaceRepositoryContract

Get specific data from webspace objects.

Namespace

Plenty\Modules\Webshop\Contracts

Methods
public getCdnMetadata($url, $key = null, $default = null):void

Get the metadata for a file stored on plentymarkets cdn.

Parameters

Name

Type

Description

$url

string

Resource URL to get metadata for.

$key

string

Metadata key to get value for (optional).

$default

Default value to return if no value is stored in metadata (optional).

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

Get the webstore configuration by webstore id

Parameters

Name

Type

Description

$webstoreId

int

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.

public getIncompleteStatus():bool

Get preview status for current event.

BeforeBasketItemToOrderItem

Event for receiving the basket item before transformed to an order item.

Namespace

Plenty\Modules\Webshop\Events

Methods
public getIncompleteStatus():bool

Get preview status for current event.

public addAdditionalVariationProperties($variationProperties = []):void
Parameters

Name

Type

Description

$variationProperties

public getAdditionalVariationProperties():void
public getBasketItem():Plenty\Modules\Basket\Models\BasketItem
Return type: BasketItem

The shopping cart item that has changed.

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.

public getCountryId():int

Get the country id to validate.

public static getFallbackStatusServiceUnavailable():float

Return fallback status for unavailable service.

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 = "", $transformDefault = ""):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.

PropertyFileService

Helper class for variation properties of type file.

Namespace

Plenty\Modules\Webshop\Helpers

Methods
public getPropertyFileUrl():string

Get the URL where file properties are stored

PropertyHelper

A helper class that lazyloads a property by the given property id.

Namespace

Plenty\Modules\Webshop\Helpers

Methods
public static getPropertyById($propertyId):void
Parameters

Name

Type

Description

$propertyId

int

UnitUtils

Convert plentymarkets unit keys into common unit codes.

Namespace

Plenty\Modules\Webshop\Helpers

Methods
public static getHTML4Unit($unit = "SMM"):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\UrlQuery
Return type: UrlQuery

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\UrlQuery
Return type: UrlQuery

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\BaseSearchFactory
Return type: BaseSearchFactory

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\BaseSearchFactory
Return type: BaseSearchFactory

Add a filter. Will override existing filter instances.

Parameters

Name

Type

Description

$filter

TypeInterface

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

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\BaseSearchFactory
Return type: BaseSearchFactory

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 getAdditionalFilterParams():void
public withAggregation($aggregation):Plenty\Modules\Webshop\ItemSearch\Factories\BaseSearchFactory
Return type: BaseSearchFactory

Add an aggregation

Parameters

Name

Type

Description

$aggregation

AggregationInterface

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

Add a suggestion

Parameters

Name

Type

Description

$suggestion

SuggestionInterface

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

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\BaseSearchFactory
Return type: BaseSearchFactory

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\BaseSearchFactory
Return type: BaseSearchFactory

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\BaseSearchFactory
Return type: BaseSearchFactory

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\BaseSearchFactory
Return type: BaseSearchFactory

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\FacetSearchFactory
Return type: FacetSearchFactory

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\FacetSearchFactory
Return type: FacetSearchFactory

Register extension to filter facets by minimum hit count.

public getFacetValues():array

Return selected facet values as array

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

Get the default configuration of a search factory. This applies the following filters

Parameters

Name

Type

Description

$options

array

Available options - quantities Quantities of the variations in the basket. This will be considered while calculating prices - setPriceOnly Set to true to only consider prices for item sets

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

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\VariationSearchFactory
Return type: VariationSearchFactory

Filter active variations

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

Filter inactive variations

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

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

Filter manufacturers by id.

Parameters

Name

Type

Description

$manufacturerId

int

To filter by manufacturer

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

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\VariationSearchFactory
Return type: VariationSearchFactory

Filter only main variations

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

Filter only child variations

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

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\VariationSearchFactory
Return type: VariationSearchFactory

Filter variations by isSalable flag

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

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 = "hasAnyNameInLanguage", $lang = null):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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

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

Name

Type

Description

$priceMin

float

$priceMax

float

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

Name

Type

Description

$tagId

int

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

Name

Type

Description

$tagIds

array

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

Group results depending on a config value.

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

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\VariationSearchFactory
Return type: VariationSearchFactory

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 = "", $b = ""):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

Includes VariationAttributeMap for variation select

Parameters

Name

Type

Description

$itemId

int

$initialVariationId

int

$afterKey

array

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

Name

Type

Description

$displaySettings

array

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

Append URLs to result.

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

Append prices to result.

Parameters

Name

Type

Description

$quantities

array

$setPriceOnly

bool

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

Set result as current category

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

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\VariationSearchFactory
Return type: VariationSearchFactory

Add bundle component variations.

public withSetComponents():void

Add set component variations to item set entries.

public withLinkToContent():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withGroupedAttributeValues():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withReducedResults():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withReducedManufacturerData($manufacturerFields):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
Parameters

Name

Type

Description

$manufacturerFields

string

public withAvailability():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withTags():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withCategories():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withSuggestions($query = "", $lang = null):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
Parameters

Name

Type

Description

$query

string

$lang

string

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

Name

Type

Description

$query

string

public withSalableVariationCount():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withVariationPropertySelectionValuesMutator():void
public getMinPrice():float

Return given min price

public getMaxPrice():float

Return given max price

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\BaseSearchFactory
Return type: BaseSearchFactory

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\BaseSearchFactory
Return type: BaseSearchFactory

Add a filter. Will override existing filter instances.

Parameters

Name

Type

Description

$filter

TypeInterface

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

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\BaseSearchFactory
Return type: BaseSearchFactory

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 getAdditionalFilterParams():void
public withAggregation($aggregation):Plenty\Modules\Webshop\ItemSearch\Factories\BaseSearchFactory
Return type: BaseSearchFactory

Add an aggregation

Parameters

Name

Type

Description

$aggregation

AggregationInterface

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

Add a suggestion

Parameters

Name

Type

Description

$suggestion

SuggestionInterface

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

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\BaseSearchFactory
Return type: BaseSearchFactory

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\BaseSearchFactory
Return type: BaseSearchFactory

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\BaseSearchFactory
Return type: BaseSearchFactory

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\BaseSearchFactory
Return type: BaseSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

Get the default configuration of a search factory. This applies the following filters

Parameters

Name

Type

Description

$options

array

Available options - quantities Quantities of the variations in the basket. This will be considered while calculating prices - setPriceOnly Set to true to only consider prices for item sets

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

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\VariationSearchFactory
Return type: VariationSearchFactory

Filter active variations

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

Filter inactive variations

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

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

Filter manufacturers by id.

Parameters

Name

Type

Description

$manufacturerId

int

To filter by manufacturer

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

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\VariationSearchFactory
Return type: VariationSearchFactory

Filter only main variations

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

Filter only child variations

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

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\VariationSearchFactory
Return type: VariationSearchFactory

Filter variations by isSalable flag

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

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 = "hasAnyNameInLanguage", $lang = null):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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

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

Name

Type

Description

$priceMin

float

$priceMax

float

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

Name

Type

Description

$tagId

int

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

Name

Type

Description

$tagIds

array

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

Group results depending on a config value.

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

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\VariationSearchFactory
Return type: VariationSearchFactory

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 = "", $b = ""):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

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\VariationSearchFactory
Return type: VariationSearchFactory

Includes VariationAttributeMap for variation select

Parameters

Name

Type

Description

$itemId

int

$initialVariationId

int

$afterKey

array

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

Name

Type

Description

$displaySettings

array

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

Append URLs to result.

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

Append prices to result.

Parameters

Name

Type

Description

$quantities

array

$setPriceOnly

bool

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

Set result as current category

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

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\VariationSearchFactory
Return type: VariationSearchFactory

Add bundle component variations.

public withSetComponents():void

Add set component variations to item set entries.

public withLinkToContent():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withGroupedAttributeValues():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withReducedResults():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withReducedManufacturerData($manufacturerFields):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
Parameters

Name

Type

Description

$manufacturerFields

string

public withAvailability():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withTags():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withCategories():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withSuggestions($query = "", $lang = null):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
Parameters

Name

Type

Description

$query

string

$lang

string

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

Name

Type

Description

$query

string

public withSalableVariationCount():Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory
public withVariationPropertySelectionValuesMutator():void
public getMinPrice():float

Return given min price

public getMaxPrice():float

Return given max price

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\BaseSearchFactory
Return type: BaseSearchFactory

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\BaseSearchFactory
Return type: BaseSearchFactory

Add a filter. Will override existing filter instances.

Parameters

Name

Type

Description

$filter

TypeInterface

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

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\BaseSearchFactory
Return type: BaseSearchFactory

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 getAdditionalFilterParams():void
public withAggregation($aggregation):Plenty\Modules\Webshop\ItemSearch\Factories\BaseSearchFactory
Return type: BaseSearchFactory

Add an aggregation

Parameters

Name

Type

Description

$aggregation

AggregationInterface

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

Add a suggestion

Parameters

Name

Type

Description

$suggestion

SuggestionInterface

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

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\BaseSearchFactory
Return type: BaseSearchFactory

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\BaseSearchFactory
Return type: BaseSearchFactory

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\BaseSearchFactory
Return type: BaseSearchFactory

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\BaseSearchFactory
Return type: BaseSearchFactory

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

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

Name

Type

Description

$order

Order

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

Get preset search factory.

Parameters

Name

Type

Description

$options

array

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

Get preset search factory.

Parameters

Name

Type

Description

$options

array

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

Get preset search factory.

Parameters

Name

Type

Description

$options

array

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

Get preset search factory.

Parameters

Name

Type

Description

$options

array

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

Get preset search factory.

Parameters

Name

Type

Description

$options

array

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

Get preset search factory.

Parameters

Name

Type

Description

$options

array

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

Get preset search factory.

Parameters

Name

Type

Description

$options

array

Available options: - itemId Item id to get - variationId Variation id to get. If not defined, plugin configuration will be considered - 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($options):Plenty\Modules\Webshop\ItemSearch\Factories\VariationSearchFactory
Return type: VariationSearchFactory

Get preset search factory.

Parameters

Name

Type

Description

$options

array

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

Get preset search factory.

Parameters

Name

Type

Description

$options

array

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

Get preset search factory.

Parameters

Name

Type

Description

$options

array

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.

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.

public getResultsWithDownloadLinkForProperties($results):void

Generates an image url for every existent variation property which is passed within $results param.

Parameters

Name

Type

Description

$results

array

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

public switchPaymentMethodForOrder($orderId, $paymentMethodId, $accessKey = &quot;&quot;):Plenty\Modules\Order\Models\Order
Return type: Order

Switch the payment method of an existing order.

Parameters

Name

Type

Description

$orderId

int

The id of the order.

$paymentMethodId

int

The id of the payment method which should be switched to.

$accessKey

string

The access key must be compatible with order id.

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

itemImage

int

item

int

blog

int

Methods
public toArray()

Returns this model as an array.

Stock

Contracts

StockReservationRepositoryContract

Repository to get and set contact information for the webshop

Namespace

Plenty\Modules\Webshop\Stock\Contracts

Methods
public reserveBasket():void

Reserves stock for all items in the cart.

public unreserveBasket():void

Unreserve all stock reservations for the basket of the current customer session.

Storefront

Models

ItemWishlist

The item wishlist model.

Namespace

Plenty\Modules\Webshop\Storefront\Models

Properties
Name Type Description

id

int

The ID of the wishlist

variationId

int

The ID of the variation

contactId

int

The ID of the contact

plentyId

int

The actual PlentyID

createdAt

The date when the item wishlist was created

updatedAt

The date when the item wishlist was updated

Methods
public toArray()

Returns this model as an array.

Template

Contracts

AssetRepositoryContract

Register required assets for the frontend.

Namespace

Plenty\Modules\Webshop\Template\Contracts

Methods
public addAsset($path, $as = &quot;&quot;, $rel = &quot;preload&quot;, $additionalParams = []):void

Add a path to an asset that should be pushed to the client using HTTP2 server push

Parameters

Name

Type

Description

$path

string

The path to the asset to be pushed.

$as

string

The type to be used for the "as"-attribute. If not set, is is determined based on the file extension.

$rel

string

The rel attribute to be used.

$additionalParams

array

array for additional information ['type', 'crossorigin ⇒ true', 'position'] default position is 1000.

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.

Parameters

Name

Type

Description

$key

string

Configuration key to set value for. Available configuration keys are:

  • confirmation.verifyOrderTemplate Set a path to a template to be used for verifying the postcode of an order when displaying the order confirmation page.

  • currency.format Format to display the currency in monetary values.

  • sort.defaultSorting Default item sorting criteria

  • sort.defaultSortingSearch Default sorting criteria when searching for items

  • sorting.prioritySearch1 First sorting criteria when searching for items

  • sorting.prioritySearch2 Second sorting criteria when searching for items

  • sorting.prioritySearch3 Third sorting criteria when searching for items

  • sorting.priorityCategory1 First sorting criteria when searching for items of a category

  • sorting.priorityCategory2 Second sorting criteria when searching for items of a category

  • sorting.priorityCategory3 Third sorting criteria when searching for items of a category

  • sorting.dynamicInherit Set to true to adopts sorting criteria from item search options to grouping of variations

  • sorting.dynamicPrio1 First sorting criteria when grouping variations in item search results

  • sorting.dynamicPrio2 Second sorting criteria when grouping variations in item search results

  • item.name Set which item name should be used in the webshop.

  • item.displayName Define if the item name, the variation name or both names should be displayed in the webshop.

  • global.enableOldUrlPattern Item urls will be served with prefix "a-{itemId}" when enabled

  • language.activeLanguages List of languages that are enabled for the webshop

  • log.performance.ssr Set to true to enable Vue.js server side rendering of frontend templates

$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