Plentymarkets interface documentation

Basket

Contracts

BasketItemRepositoryContract

The BasketItemRepositoryContract is the interface for the basket item repository. This interface allows to list, add, update and delete items from the shopping cart of the current customer session.

Namespace

Plenty\Modules\Basket\Contracts

Methods
public findOneById($basketRowId):Plenty\Modules\Basket\Models\BasketItem
Return type: BasketItem

Gets an existing item by ID in the shopping cart of the current customer session.

Parameters

Name

Type

Description

$basketRowId

int

The ID of the basket row

public findExistingOneByData($data):Plenty\Modules\Basket\Models\BasketItem
Return type: BasketItem

Gets an existing item by item data in the shopping cart of the current customer session.

Parameters

Name

Type

Description

$data

array

The item’s data

public findAllExistingOneByData($data):array

Gets all existing item by item data in the shopping cart of the current customer session.

Parameters

Name

Type

Description

$data

array

The item’s data

public all():array

Lists all items in the shopping cart of the current customer session.

public getBasketItemQuantity():float

Returns a sum of quantities for all basket items of the current customer session.

public addBasketItem($data, $fireEvents = true):Plenty\Modules\Basket\Models\BasketItem
Return type: BasketItem

Creates an item with the specified item data in the shopping cart.

Parameters

Name

Type

Description

$data

array

The item’s data

$fireEvents

bool

Set to false to skip change events and calculation of basket totals.

public updateBasketItem($basketItemId, $data, $fireEvents = true):void

Updates an existing item in the shopping cart. The ID of the item and the data to be updated must be specified.

Parameters

Name

Type

Description

$basketItemId

int

The ID of the item in the shopping cart

$data

array

The item’s data

$fireEvents

bool

Set to false to skip change events and calculation of basket totals.

public removeBasketItem($basketItemId, $dispatchAfterBasketChangedEvent = true):void

Deletes an item from the shopping cart. The ID of the item must be specified.

Parameters

Name

Type

Description

$basketItemId

int

The ID of the item in the shopping cart

$dispatchAfterBasketChangedEvent

bool

The information if the AfterBasketChanged event should be dispatched

BasketRepositoryContract

The BasketRepositoryContract is the interface for the basket repository. This interface allows to get the shopping cart of the current customer session.

Namespace

Plenty\Modules\Basket\Contracts

Methods
public load($forceCreate = false):Plenty\Modules\Basket\Models\Basket
Return type: Basket

Gets the shopping cart from current customer session.

Parameters

Name

Type

Description

$forceCreate

bool

Flag to create a basket in database if not exist.

public save($data):void

Save the current shopping cart data.

Parameters

Name

Type

Description

$data

array

public setCouponCode($couponCode):Plenty\Modules\Basket\Models\Basket
Return type: Basket

Add a coupon code to the shopping cart.

Parameters

Name

Type

Description

$couponCode

string

public removeCouponCode():Plenty\Modules\Basket\Models\Basket
Return type: Basket

Remove a coupon code from the shopping cart.

public deleteBasket():Plenty\Modules\Basket\Models\Basket
Return type: Basket

Delete the basket for current session

public getTaxFreeAmount($basketItems = []):float

Load amount from tax-free items

Parameters

Name

Type

Description

$basketItems

array

Basket items, needed for old item characteristics (deprecated soon, use new properties)

Exceptions

BasketCheckException

Class BasketCheckException

Namespace

Plenty\Modules\Basket\Exceptions

Methods
public __construct($code, $message = "", $previous = null):void

BasketCheckException constructor.

Parameters

Name

Type

Description

$code

string

$message

string

$previous

BasketItemCheckException

Created by ptopczewski, 12.05.16 09:03 Class BasketItemCheckException

Namespace

Plenty\Modules\Basket\Exceptions

Methods
public __construct($code = 404, $message = "", $previous = null, $itemId, $variationId, $stockNet = 0.0, $additionalData = []):void

BasketItemCheckException constructor.

Parameters

Name

Type

Description

$code

int

$message

string

$previous

$itemId

int

$variationId

int

$stockNet

float

$additionalData

array

public getItemId():int
public getVariationId():int
public getStockNet():float
public getAdditionalData():array

BasketItemQuantityCheckException

Created by ptopczewski, 17.05.16 09:37 Class BasketItemQuantityCheckException

Namespace

Plenty\Modules\Basket\Exceptions

Methods
public __construct($code, $message = "", $previous = null, $itemId, $variationId, $requestedQuantity = 0.0, $specifiedQuantity = 0.0):void

BasketItemQuantityCheckException constructor.

Parameters

Name

Type

Description

$code

int

$message

string

$previous

$itemId

int

$variationId

int

$requestedQuantity

float

$specifiedQuantity

float

public getRequestedQuantity():float
public getSpecifiedQuantity():float

Models

Basket

The shopping cart model

Namespace

Plenty\Modules\Basket\Models

Properties
Name Type Description

id

int

The ID of the shopping cart. The ID increases by 1 when a new customer enters the online store and adds an item to the shopping cart.

sessionId

string

The ID of the current customer session

orderId

int

The ID of the order

customerId

int

The ID of the customer

customerInvoiceAddressId

int

The ID of the customer’s invoice address

customerShippingAddressId

int

The ID of the customer’s shipping address

currency

string

The currency

referrerId

float

The ID of the order referrer

shippingCountryId

int

The ID of the shipping country

methodOfPaymentId

int

The ID of the payment method

shippingProviderId

int

The ID of the shipping provider

shippingProfileId

int

The ID of the shipping profile

itemSum

float

The gross value of items in the shopping cart

itemSumNet

float

The net value of items in the shopping cart

basketAmount

float

The total gross value of the shopping cart

basketAmountNet

float

The total net value of the shopping cart

shippingAmount

float

The gross shipping costs

shippingAmountNet

float

The net shipping costs

paymentAmount

float

The amount of the payment

couponCode

string

The entered coupon code

couponDiscount

float

The received discount due to the coupon code

shippingDeleteByCoupon

bool

Shows whether the shipping costs are subtracted due to a coupon code. Shopping carts that are free of shipping costs have the value true.

basketRebate

float

The discount to the shopping cart value. The discount can either be set as a discount scale for items, as a customer class discount or as a discount based on the payment method.

basketRebateType

int

The discount type. The following types are available: <ul> <li>Discount scale based on net value of items = 4</li> <li> Discount based on method of payment = 5</li> </ul>

maxFsk

int

The age rating

orderTimestamp

int

The timestamp of the order

createdAt

string

The date that the shopping cart was created.

updatedAt

string

The date that the shopping cart was updated last.

basketItems

Methods
public toArray()

Returns this model as an array.

BasketItem

The shopping cart item model

Namespace

Plenty\Modules\Basket\Models

Properties
Name Type Description

id

int

The ID of the item in the shopping cart

basketId

int

The ID of the shopping cart. The ID increases by 1 when a new customer enters the online store and adds an item to the shopping cart.

sessionId

string

The ID of the current customer session

orderRowId

int

quantity

float

The current quantity of the item

quantityOriginally

float

The initial quantity of the item

itemId

int

The ID of the item

priceId

int

The ID of the item price

attributeValueSetId

int

The ID of the attribute value set

rebate

int

The discount on the item

vat

float

The VAT

price

float

The item price

givenPrice

float

The given item price

givenVatId

int

The given vat id.

useGivenPrice

bool

The flag to use the given values

inputWidth

int

The width of the item

inputLength

int

The length of the item

inputHeight

int

The height of the item

itemType

int

The item type

externalItemId

string

The external variation ID

noEditByCustomer

bool

Shows whether the item was edited by the customer

costCenterId

int

giftPackageForRowId

int

position

int

The item position

size

string

The item size

shippingProfileId

int

The ID of the shipping profile

referrerId

float

The ID of the order referrer

deliveryDate

string

The delivery date

categoryId

int

The ID of the item category

reservationDatetime

int

variationId

int

The ID of the item variation

bundleVariationId

int

The ID of the item bundle type

createdAt

string

The date that the shopping cart was created

updatedAt

string

The date that the shopping cart was updated last

attributeTotalMarkup

float

attribute total markup

basketItemOrderParams

array

Array of BasketItemParams

basketItemVariationProperties

array

Array of BasketItemVariationProperties

Methods
public toArray()

Returns this model as an array.

BasketItemParams

The basket item params model

Namespace

Plenty\Modules\Basket\Models

Properties
Name Type Description

type

string

name

string

value

string

basketItemId

int

propertyId

int

Methods
public toArray()

Returns this model as an array.

Events

Basket

AfterBasketChanged

The event is triggered after the shopping cart is changed.

Namespace

Plenty\Modules\Basket\Events\Basket

Methods
public hasValidCoupon():bool

Get information if the current shopping cart has a valid coupon.

public getCouponValidationError():Plenty\Exceptions\ValidationException
Return type: ValidationException

Get the validation errors from a failed attempt to add a coupon to the shopping cart.

public setHasValidCoupon($hasValidCoupon, $couponValidationError = null):void

Set if the shopping cart has a valid coupon.

Parameters

Name

Type

Description

$hasValidCoupon

bool

Flag that indicates if a valid coupon has been used.

$couponValidationError

ValidationException

Validation errors indicating the reasons for an invalid coupon.

public getBasket():Plenty\Modules\Basket\Models\Basket
Return type: Basket

Get the current shopping cart.

public getLocationId():int

Get the location ID from the current shopping cart.

public setLocationId($locationId):Plenty\Modules\Basket\Events\Basket\AfterBasketChanged
Return type: AfterBasketChanged

Set the location of the current shopping cart.

Parameters

Name

Type

Description

$locationId

int

The ID of the location

public getInvoiceAddress():Plenty\Modules\Account\Address\Models\Address
Return type: Address

Get the invoice address of the current shopping cart.

public setInvoiceAddress($invoiceAddress):Plenty\Modules\Basket\Events\Basket\AfterBasketChanged
Return type: AfterBasketChanged

Set the invoice address to the currrent shopping cart.

Parameters

Name

Type

Description

$invoiceAddress

Address

The invoice address

public getMaxFsk():int

Get the highest value for age restriction of all items in the shopping cart.

public setMaxFsk($maxFsk):Plenty\Modules\Basket\Events\Basket\AfterBasketChanged
Return type: AfterBasketChanged

Set the highest value for age restriction of all items in the shopping cart.

Parameters

Name

Type

Description

$maxFsk

int

The highest value for age restriction of an item in the shopping cart.

public getShippingCosts():float

Get the shipping costs of the shopping cart.

public setShippingCosts($shippingCosts):Plenty\Modules\Basket\Events\Basket\AfterBasketChanged
Return type: AfterBasketChanged

Set the shipping costs of the shopping cart.

Parameters

Name

Type

Description

$shippingCosts

float

The shipping costs of the shopping cart

AfterBasketCreate

The event is triggered after the shopping cart is created.

Namespace

Plenty\Modules\Basket\Events\Basket

Methods
public getBasket():Plenty\Modules\Basket\Models\Basket
Return type: Basket

Get the current shopping cart.

BasketItem

AfterBasketItemAdd

The event is triggered after an item is added to the shopping cart.

Namespace

Plenty\Modules\Basket\Events\BasketItem

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

The shopping cart item that has changed.

AfterBasketItemRemove

The event is triggered after an item is deleted from the shopping cart.

Namespace

Plenty\Modules\Basket\Events\BasketItem

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

The shopping cart item that has changed.

AfterBasketItemUpdate

The event is triggered after an item in the shopping cart is updated.

Namespace

Plenty\Modules\Basket\Events\BasketItem

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

The shopping cart item that has changed.

BasketItemEvent

An event fired if something changes concerning the shoppping cart items

Namespace

Plenty\Modules\Basket\Events\BasketItem

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

The shopping cart item that has changed.

BeforeBasketItemAdd

The event is triggered before an item is created in the shopping cart.

Namespace

Plenty\Modules\Basket\Events\BasketItem

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

The shopping cart item that has changed.

BeforeBasketItemRemove

The event is triggered before an item is deleted from the shopping cart.

Namespace

Plenty\Modules\Basket\Events\BasketItem

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

The shopping cart item that has changed.

BeforeBasketItemUpdate

The event is triggered before an item in the shopping cart is updated.

Namespace

Plenty\Modules\Basket\Events\BasketItem

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

The shopping cart item that has changed.