Definition
in package
Uses
ElementTrait, IdentifiableElementTrait, EnumResolverTrait, DateAddedTrait
This is the product Definition class.
The definitions information of API products will be stored in that class and will remain immutable (only get methods are available)
Tags
Table of Contents
$id | Autonumeric element id. | : int |
---|---|---|
__construct() | Elements constructor. | : mixed |
__toString() | Uses "json_encode" function to return the JSON format of the element. | : string |
getActive() | Sets if the product is active or not. | : bool |
getAvailability() | Returns the product availability object. | : ProductAvailability|null |
getAvailabilityId() | Returns the internal identifier of the product assigned availability. | : int |
getAvailableDate() | Returns the date when the product was available for the first time. | : Date|null |
getBackorder() | Sets if the product allow the reservation and how (reservation type). | : string |
getDateAdded() | Returns the date when the element was added. | : Date|null |
getDefinitionId() | Returns the identifier of the product definition. | : int |
getEndFeaturedDate() | Returns the date when the featured will end. | : Date|null |
getEndOfferDate() | Returns the date when the offer will end. | : Date|null |
getExclusiveLinked() | Sets if it's a exclusive linked product. | : bool |
getFeatured() | Sets if the product has to be setted as a featured or not. | : bool |
getGiftCost() | Returns the product gift cost. | : float |
getGroupQuantityByOptions() | Sets if the product will group quantities by options or not. | : bool |
getId() | Returns the element id. | : int |
getMaxOrderQuantity() | Returns the maximum quantity available on basket of this product to purchase it. | : int |
getMinOrderQuantity() | Returns the minimum quantity needed on basket of this product to purchase it. | : int |
getMultipleActsOver() | Returns over which number the multiple will start acting. | : string |
getMultipleOrderQuantity() | Returns the product multiple order quantity. | : int |
getOffer() | Sets if the product has to be setted as a offer or not. | : bool |
getOnRequest() | Sets if it's a on request product. | : bool |
getOnRequestDays() | Returns the number of days a request takes to be fulfilled. | : int |
getPercentPrice() | Returns the product percent price. | : float |
getPercentPriceOverrideCustomPrices() | Sets if the product percent price has to override the custom prices or not. | : bool |
getPriority() | Returns the product definition priority. | : int |
getReturnable() | Sets if it's a returnable product. | : bool |
getShowBasePrice() | Sets if the product will show the base price or not. | : bool |
getShowDiscounts() | Sets if the product has to show the available discounts or not. | : bool |
getShowOrderBox() | Sets if the product order box has to be visible or not. | : bool |
getShowPrice() | Sets if the product price has to be displayed or not. | : bool |
getStartOfferDate() | Returns the date when the offer starts/was started. | : Date|null |
getStockManagement() | Sets if the product stock management is active or not. | : bool |
getUseRetailPrice() | Sets if the product will use the retail price or not. | : bool |
jsonSerialize() | Allow elements to be serialized. | : array<string|int, mixed> |
toArray() | Used to allow elements to be serialized. | : array<string|int, mixed> |
getFieldItem() | : object|null | |
getFormattedData() | : mixed | |
setArrayField() | Convert an API array of objects to a PHP array of objects. | : array<string|int, mixed> |
Properties
$id
Autonumeric element id.
protected
int
$id
= 0
All the given elements by the LogiCommerce API will send it.
Methods
__construct()
Elements constructor.
public
__construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
-
Array that contains all the values to the object to initialize
Return values
mixed —__toString()
Uses "json_encode" function to return the JSON format of the element.
public
__toString() : string
Auto-invoked using echo or concatenations.
Return values
string —getActive()
Sets if the product is active or not.
public
getActive() : bool
Return values
bool —getAvailability()
Returns the product availability object.
public
getAvailability() : ProductAvailability|null
Tags
Return values
ProductAvailability|null —getAvailabilityId()
Returns the internal identifier of the product assigned availability.
public
getAvailabilityId() : int
Return values
int —getAvailableDate()
Returns the date when the product was available for the first time.
public
getAvailableDate() : Date|null
Return values
Date|null —getBackorder()
Sets if the product allow the reservation and how (reservation type).
public
getBackorder() : string
Return values
string —getDateAdded()
Returns the date when the element was added.
public
getDateAdded() : Date|null
Return values
Date|null —getDefinitionId()
Returns the identifier of the product definition.
public
getDefinitionId() : int
Return values
int —getEndFeaturedDate()
Returns the date when the featured will end.
public
getEndFeaturedDate() : Date|null
Return values
Date|null —getEndOfferDate()
Returns the date when the offer will end.
public
getEndOfferDate() : Date|null
Return values
Date|null —getExclusiveLinked()
Sets if it's a exclusive linked product.
public
getExclusiveLinked() : bool
Return values
bool —getFeatured()
Sets if the product has to be setted as a featured or not.
public
getFeatured() : bool
Return values
bool —getGiftCost()
Returns the product gift cost.
public
getGiftCost() : float
Return values
float —getGroupQuantityByOptions()
Sets if the product will group quantities by options or not.
public
getGroupQuantityByOptions() : bool
Return values
bool —getId()
Returns the element id.
public
getId() : int
Return values
int —getMaxOrderQuantity()
Returns the maximum quantity available on basket of this product to purchase it.
public
getMaxOrderQuantity() : int
Return values
int —getMinOrderQuantity()
Returns the minimum quantity needed on basket of this product to purchase it.
public
getMinOrderQuantity() : int
Return values
int —getMultipleActsOver()
Returns over which number the multiple will start acting.
public
getMultipleActsOver() : string
Return values
string —getMultipleOrderQuantity()
Returns the product multiple order quantity.
public
getMultipleOrderQuantity() : int
Return values
int —getOffer()
Sets if the product has to be setted as a offer or not.
public
getOffer() : bool
Return values
bool —getOnRequest()
Sets if it's a on request product.
public
getOnRequest() : bool
Return values
bool —getOnRequestDays()
Returns the number of days a request takes to be fulfilled.
public
getOnRequestDays() : int
Return values
int —getPercentPrice()
Returns the product percent price.
public
getPercentPrice() : float
Return values
float —getPercentPriceOverrideCustomPrices()
Sets if the product percent price has to override the custom prices or not.
public
getPercentPriceOverrideCustomPrices() : bool
Return values
bool —getPriority()
Returns the product definition priority.
public
getPriority() : int
Return values
int —getReturnable()
Sets if it's a returnable product.
public
getReturnable() : bool
Return values
bool —getShowBasePrice()
Sets if the product will show the base price or not.
public
getShowBasePrice() : bool
Return values
bool —getShowDiscounts()
Sets if the product has to show the available discounts or not.
public
getShowDiscounts() : bool
Return values
bool —getShowOrderBox()
Sets if the product order box has to be visible or not.
public
getShowOrderBox() : bool
Return values
bool —getShowPrice()
Sets if the product price has to be displayed or not.
public
getShowPrice() : bool
Return values
bool —getStartOfferDate()
Returns the date when the offer starts/was started.
public
getStartOfferDate() : Date|null
Return values
Date|null —getStockManagement()
Sets if the product stock management is active or not.
public
getStockManagement() : bool
Return values
bool —getUseRetailPrice()
Sets if the product will use the retail price or not.
public
getUseRetailPrice() : bool
Return values
bool —jsonSerialize()
Allow elements to be serialized.
public
jsonSerialize() : array<string|int, mixed>
Auto-invoked using "json_encode" function.
Return values
array<string|int, mixed> —toArray()
Used to allow elements to be serialized.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —getFieldItem()
protected
getFieldItem(array<string|int, mixed> $item, string $class) : object|null
Parameters
- $item : array<string|int, mixed>
- $class : string
Return values
object|null —getFormattedData()
protected
getFormattedData(mixed $value) : mixed
Parameters
- $value : mixed
Return values
mixed —setArrayField()
Convert an API array of objects to a PHP array of objects.
protected
setArrayField(array<string|int, mixed> $data, string $class) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
-
Array that contains all the values to the objects to initialize
- $class : string
-
The PHP class we want the objects to be