BasketService
extends Service
in package
Uses
ServiceTrait
This is the basket service class.
This class will retrieve the baskets from LogiCommerce API and transform them to objects. All the needed baskets operations previous to Framework must be done here.
Tags
Table of Contents
DELETE | = \SDK\Core\Enums\MethodType::DELETE | |
---|---|---|
GET | = \SDK\Core\Enums\MethodType::GET | |
ITEMS | = 'items' | |
POST | = \SDK\Core\Enums\MethodType::POST | |
PUT | = \SDK\Core\Enums\MethodType::PUT | |
addBundle() | Add bundle to basket | : Basket|null |
addGetBasket() | Add the request to get the user basket | : void |
addGetCustomTags() | Add the request to get the basket available custom tags and their values | : void |
addGetDeliveries() | Add the request to get the basket available deliveries | : void |
addGetLinkedProducts() | Add the request to get products linked to the cart | : ElementCollection|null |
addGetPaymentSystems() | Add the request to get the basket available payment systems | : void |
addGetPickingDeliveries() | Add the request to get the basket available physical locations | : void |
addGetRelatedItems() | Add the request to get the basket related items | : void |
addGetShippingDeliveries() | Add the request to get the basket available shippings | : void |
addLinked() | Add linked product to the cart. | : Basket|null |
addProduct() | Add product to basket | : Basket|null |
addProducts() | Add products to basket | : ResponseAddFillProductCollection|null |
addVoucherCode() | Add voucher code to basket | : Basket|null |
clear() | Clear basket | : Basket|null |
comment() | Put a comment on the current user's basket | : Basket|null |
deleteRow() | Delete basket row | : Basket|null |
deleteRows() | Delete basket rows | : Basket|null |
deleteVoucherCode() | Delete voucher code from basket | : Basket|null |
editBundle() | Edit basket bundle | : Basket|null |
editLinked() | Edit linked product to the cart. | : Basket|null |
editProduct() | Edit basket product | : Basket|null |
getBasket() | Returns the user basket | : Basket|null |
getCustomTags() | Returns the custom tags filtered with the given parameters for the current basket | : ElementCollection|null |
getDeliveries() | Returns the basket available deliveries | : ElementCollection|null |
getInstance() | Returns the requested model instance. | : Service |
getLinkedProducts() | Returns the product linked to the cart | : ElementCollection|null |
getPaymentSystems() | Returns the basket available payment systems | : ElementCollection|null |
getPickingDeliveries() | Returns the basket available physical locations | : ElementCollection|null |
getRelatedItems() | Returns the basket related items | : ElementCollection|null |
getShippingDeliveries() | Returns the basket available shippings | : ElementCollection|null |
recalculate() | Recalculate and returns the user basket | : Basket|null |
redeemRewardPoints() | redeem reward points to basket | : Basket|null |
setAddressesBook() | Sets the basket addresses | : Basket|null |
setCustomTags() | Sets the basket custom tags | : Basket|null |
setPaymentSystem() | Sets the basket payment system | : Basket|null |
setShippings() | Sets the basket shipping methods | : Basket|null |
__construct() | : mixed | |
call() | : array<string|int, mixed> | |
extractParameters() | : array<string|int, mixed> | |
getCollection() | : mixed | |
getConnection() | : Connection | |
getElement() | : Element|null | |
getElements() | : ElementCollection|null | |
getResourceElement() | : Element|null | |
getResponse() | : ElementCollection|null | |
prepareElement() | : Element|null | |
prepareElements() | : array<string|int, mixed> | |
replaceWildcards() | : string |
Constants
DELETE
protected
mixed
DELETE
= \SDK\Core\Enums\MethodType::DELETE
GET
protected
mixed
GET
= \SDK\Core\Enums\MethodType::GET
ITEMS
protected
mixed
ITEMS
= 'items'
POST
protected
mixed
POST
= \SDK\Core\Enums\MethodType::POST
PUT
protected
mixed
PUT
= \SDK\Core\Enums\MethodType::PUT
Methods
addBundle()
Add bundle to basket
public
addBundle([AddBundleParametersGroup $params = null ]) : Basket|null
Parameters
- $params : AddBundleParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
Basket|null —addGetBasket()
Add the request to get the user basket
public
addGetBasket(BatchRequests $batchRequests, string $batchName) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
Return values
void —addGetCustomTags()
Add the request to get the basket available custom tags and their values
public
addGetCustomTags(BatchRequests $batchRequests, string $batchName[, BasketCustomTagsParametersGroup $params = null ]) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $params : BasketCustomTagsParametersGroup = null
-
object with the needed filters to send to the API basket resource
Return values
void —addGetDeliveries()
Add the request to get the basket available deliveries
public
addGetDeliveries(BatchRequests $batchRequests, string $batchName[, DeliveriesParametersGroup $params = null ]) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $params : DeliveriesParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
void —addGetLinkedProducts()
Add the request to get products linked to the cart
public
addGetLinkedProducts(BatchRequests $batchRequests, string $batchName[, LinkedParametersGroup $params = null ]) : ElementCollection|null
Parameters
- $batchRequests : BatchRequests
- $batchName : string
- $params : LinkedParametersGroup = null
-
object with the needed filters to send to the API /products/{id}/linked resource
Return values
ElementCollection|null —addGetPaymentSystems()
Add the request to get the basket available payment systems
public
addGetPaymentSystems(BatchRequests $batchRequests, string $batchName) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
Return values
void —addGetPickingDeliveries()
Add the request to get the basket available physical locations
public
addGetPickingDeliveries(BatchRequests $batchRequests, string $batchName[, DeliveriesParametersGroup $params = null ]) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $params : DeliveriesParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
void —addGetRelatedItems()
Add the request to get the basket related items
public
addGetRelatedItems(BatchRequests $batchRequests, string $batchName[, string $type = '' ][, RelatedItemsParametersGroup $params = null ]) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $type : string = ''
-
Optional. This param will set the kind of related we want to retrieve. Valid values are inside RelatedItemsType class. If not given all the related items will be returned inside the RelatedItems object.
- $params : RelatedItemsParametersGroup = null
Return values
void —addGetShippingDeliveries()
Add the request to get the basket available shippings
public
addGetShippingDeliveries(BatchRequests $batchRequests, string $batchName) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
Return values
void —addLinked()
Add linked product to the cart.
public
addLinked([AddLinkedParametersGroup $params = null ]) : Basket|null
Parameters
- $params : AddLinkedParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
Basket|null —addProduct()
Add product to basket
public
addProduct([AddProductParametersGroup $params = null ]) : Basket|null
Parameters
- $params : AddProductParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
Basket|null —addProducts()
Add products to basket
public
addProducts([AddProductsParametersGroup $params = null ]) : ResponseAddFillProductCollection|null
Parameters
- $params : AddProductsParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
ResponseAddFillProductCollection|null —addVoucherCode()
Add voucher code to basket
public
addVoucherCode(string $code) : Basket|null
Parameters
- $code : string
Return values
Basket|null —clear()
Clear basket
public
clear() : Basket|null
Return values
Basket|null —comment()
Put a comment on the current user's basket
public
comment(string $comment) : Basket|null
Parameters
- $comment : string
Return values
Basket|null —deleteRow()
Delete basket row
public
deleteRow(string $hash) : Basket|null
Parameters
- $hash : string
Return values
Basket|null —deleteRows()
Delete basket rows
public
deleteRows([DeleteRowsParametersGroup $params = null ]) : Basket|null
Parameters
- $params : DeleteRowsParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
Basket|null —deleteVoucherCode()
Delete voucher code from basket
public
deleteVoucherCode(string $code) : Basket|null
Parameters
- $code : string
Return values
Basket|null —editBundle()
Edit basket bundle
public
editBundle(string $hash[, EditBundleParametersGroup $params = null ]) : Basket|null
Parameters
- $hash : string
- $params : EditBundleParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
Basket|null —editLinked()
Edit linked product to the cart.
public
editLinked(string $hash[, EditLinkedParametersGroup $params = null ]) : Basket|null
Parameters
- $hash : string
- $params : EditLinkedParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
Basket|null —editProduct()
Edit basket product
public
editProduct(string $hash[, EditProductParametersGroup $params = null ]) : Basket|null
Parameters
- $hash : string
- $params : EditProductParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
Basket|null —getBasket()
Returns the user basket
public
getBasket() : Basket|null
Return values
Basket|null —getCustomTags()
Returns the custom tags filtered with the given parameters for the current basket
public
getCustomTags([BasketCustomTagsParametersGroup $params = null ]) : ElementCollection|null
Parameters
- $params : BasketCustomTagsParametersGroup = null
-
object with the needed filters to send to the API basket resource
Return values
ElementCollection|null —getDeliveries()
Returns the basket available deliveries
public
getDeliveries([DeliveriesParametersGroup $params = null ]) : ElementCollection|null
Parameters
- $params : DeliveriesParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
ElementCollection|null —getInstance()
Returns the requested model instance.
public
static getInstance() : Service
If is not setted, this method will set it.
Return values
Service —getLinkedProducts()
Returns the product linked to the cart
public
getLinkedProducts([LinkedParametersGroup $params = null ]) : ElementCollection|null
Parameters
- $params : LinkedParametersGroup = null
-
object with the needed filters to send to the API /products/{id}/linked resource
Return values
ElementCollection|null —getPaymentSystems()
Returns the basket available payment systems
public
getPaymentSystems() : ElementCollection|null
Return values
ElementCollection|null —getPickingDeliveries()
Returns the basket available physical locations
public
getPickingDeliveries([DeliveriesParametersGroup $params = null ]) : ElementCollection|null
Parameters
- $params : DeliveriesParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
ElementCollection|null —getRelatedItems()
Returns the basket related items
public
getRelatedItems([string $type = '' ][, RelatedItemsParametersGroup $params = null ]) : ElementCollection|null
Parameters
- $type : string = ''
-
Optional. This param will set the kind of related we want to retrieve. Valid values are inside RelatedItemsType class. If not given all the related items will be returned inside the RelatedItems object.
- $params : RelatedItemsParametersGroup = null
Return values
ElementCollection|null —getShippingDeliveries()
Returns the basket available shippings
public
getShippingDeliveries() : ElementCollection|null
Return values
ElementCollection|null —recalculate()
Recalculate and returns the user basket
public
recalculate() : Basket|null
Return values
Basket|null —redeemRewardPoints()
redeem reward points to basket
public
redeemRewardPoints([RewardPointsRedeemParametersGroup $params = null ]) : Basket|null
Parameters
- $params : RewardPointsRedeemParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
Basket|null —setAddressesBook()
Sets the basket addresses
public
setAddressesBook([SetBasketAddressesBookParametersGroup $params = null ]) : Basket|null
Parameters
- $params : SetBasketAddressesBookParametersGroup = null
Return values
Basket|null —setCustomTags()
Sets the basket custom tags
public
setCustomTags([EditBasketCustomTagsParametersGroup $params = null ]) : Basket|null
Parameters
- $params : EditBasketCustomTagsParametersGroup = null
Return values
Basket|null —setPaymentSystem()
Sets the basket payment system
public
setPaymentSystem([EditPaymentSystemParametersGroup $params = null ]) : Basket|null
Parameters
- $params : EditPaymentSystemParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
Basket|null —setShippings()
Sets the basket shipping methods
public
setShippings([EditShipmentsParametersGroup $params = null ]) : Basket|null
Parameters
- $params : EditShipmentsParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
Basket|null —__construct()
protected
__construct() : mixed
Return values
mixed —call()
protected
call(Request $request[, string $apiUrl = null ]) : array<string|int, mixed>
Parameters
- $request : Request
- $apiUrl : string = null
Return values
array<string|int, mixed> —extractParameters()
protected
extractParameters([ParametersGroup|null $parametersGroup = null ]) : array<string|int, mixed>
Parameters
- $parametersGroup : ParametersGroup|null = null
Return values
array<string|int, mixed> —getCollection()
protected
getCollection(array<string|int, mixed> $data, string $class) : mixed
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
mixed —getConnection()
protected
getConnection() : Connection
Return values
Connection —getElement()
protected
getElement(string $class, string $resource[, int $id = null ][, mixed $params = null ]) : Element|null
Parameters
- $class : string
- $resource : string
- $id : int = null
- $params : mixed = null
Return values
Element|null —getElements()
protected
getElements(string $class, string $resource[, ParametersGroup $parameters = null ]) : ElementCollection|null
Parameters
- $class : string
- $resource : string
- $parameters : ParametersGroup = null
Return values
ElementCollection|null —getResourceElement()
protected
getResourceElement(string $class, string $resource[, mixed $params = [] ]) : Element|null
Parameters
- $class : string
- $resource : string
- $params : mixed = []
Return values
Element|null —getResponse()
protected
getResponse(array<string|int, mixed> $data, string $class) : ElementCollection|null
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
ElementCollection|null —prepareElement()
protected
prepareElement(array<string|int, mixed> $data, string $class) : Element|null
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
Element|null —prepareElements()
protected
prepareElements(array<string|int, mixed> $data, string $class) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
array<string|int, mixed> —replaceWildcards()
protected
replaceWildcards(string $resource, array<string|int, mixed> $wildcards) : string
Parameters
- $resource : string
- $wildcards : array<string|int, mixed>