Product
extends Element
in package
Uses
ElementTrait, IdentifiableElementTrait, IntegrableElementTrait, CatalogCustomTagValueTrait, EnumResolverTrait
This is the Product class.
The information of API products will be stored in that class and will remain immutable (only get methods are available)
Tags
Table of Contents
$error | : Error|null | |
---|---|---|
$id | Autonumeric element id. | : int |
$pId | Public and readable element id. | : string |
__construct() | Elements constructor. | : mixed |
__toString() | Uses "json_encode" function to return the JSON format of the element. | : string |
getAdditionalImages() | Returns the product additional images | : array<string|int, AdditionalImage> |
getBrand() | Returns the product brand object. | : Brand|null |
getCategories() | Returns the product categories. | : array<string|int, ProductCategory> |
getCategoryProperties() | Returns the product main category properties. | : CategoryProperties|null |
getCodes() | Returns the product codes object. | : ProductCodes|null |
getCombinationData() | Returns the product current data object. | : ProductCombinationData|null |
getCombinations() | Returns the product combinations. | : array<string|int, Combination> |
getCommentsAggregate() | Returns the product comments aggregate object. | : ProductCommentsAggregate|null |
getCustomTagValue() | Returns the element custom tag filtered by the given id. | : CatalogCustomTagValue|null |
getCustomTagValues() | Returns the element custom tags. | : array<string|int, CatalogCustomTagValue> |
getDefaultOptionsPrices() | Returns the product default option prices | : DefaultOptionPrices|null |
getDefinition() | Returns the product definition. | : Definition|null |
getError() | Returns the current element error (if there is error). | : Error|null |
getId() | Returns the element id. | : int |
getLanguage() | Returns the product language object. | : ProductLanguage|null |
getMainCategory() | Returns the category id where this product belongs. | : int |
getMainImages() | Returns the product media object. | : Media|null |
getOptions() | Returns the product options. | : array<string|int, Option> |
getOptionsPrice() | Returns the product options price. | : float |
getPId() | Returns the element public id (pId). | : string |
getPrice() | Returns the product total price. | : float |
getPrices() | Returns the product prices. | : ItemPrices|null |
getPricesWithTaxes() | Returns the product prices (taxes included). | : ItemPrices|null |
getProductPrice() | Returns the product price. | : float |
getReverseChargeVat() | Sets if the product applies the reverse charge vat or not. | : bool |
getShipping() | Sets if the product has to be counted calculating shippings or not. | : bool |
getShowPrices() | Returns the product prices in function of the given setting. | : array<string|int, ItemPrices> |
getSupplierId() | Returns the identifier of the product supplier. | : int |
getTaxes() | Returns the product taxes. | : array<string|int, Tax> |
getTotalStock() | Returns the product total stock. | : int |
getWeight() | Returns the product total weight. | : float |
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> |
setError() | : void |
Properties
$error
protected
Error|null
$error
= null
$id
Autonumeric element id.
protected
int
$id
= 0
All the given elements by the LogiCommerce API will send it.
$pId
Public and readable element id.
protected
string
$pId
= ''
Setted by the user on LogiCommerce. All the integrable elements by the LogiCommerce API will send it. Useful for integrations and other 3rd party softwares that need to connect to LogiCommerce software.
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 —getAdditionalImages()
Returns the product additional images
public
getAdditionalImages() : array<string|int, AdditionalImage>
Tags
Return values
array<string|int, AdditionalImage> —getBrand()
Returns the product brand object.
public
getBrand() : Brand|null
Tags
Return values
Brand|null —getCategories()
Returns the product categories.
public
getCategories() : array<string|int, ProductCategory>
Tags
Return values
array<string|int, ProductCategory> —getCategoryProperties()
Returns the product main category properties.
public
getCategoryProperties() : CategoryProperties|null
Tags
Return values
CategoryProperties|null —getCodes()
Returns the product codes object.
public
getCodes() : ProductCodes|null
Tags
Return values
ProductCodes|null —getCombinationData()
Returns the product current data object.
public
getCombinationData() : ProductCombinationData|null
Tags
Return values
ProductCombinationData|null —getCombinations()
Returns the product combinations.
public
getCombinations() : array<string|int, Combination>
Tags
Return values
array<string|int, Combination> —getCommentsAggregate()
Returns the product comments aggregate object.
public
getCommentsAggregate() : ProductCommentsAggregate|null
Tags
Return values
ProductCommentsAggregate|null —getCustomTagValue()
Returns the element custom tag filtered by the given id.
public
getCustomTagValue(string $customTagPId) : CatalogCustomTagValue|null
Parameters
- $customTagPId : string
-
Public identifier of the custom tag you want to get.
Tags
Return values
CatalogCustomTagValue|null —getCustomTagValues()
Returns the element custom tags.
public
getCustomTagValues() : array<string|int, CatalogCustomTagValue>
Tags
Return values
array<string|int, CatalogCustomTagValue> —getDefaultOptionsPrices()
Returns the product default option prices
public
getDefaultOptionsPrices() : DefaultOptionPrices|null
Tags
Return values
DefaultOptionPrices|null —getDefinition()
Returns the product definition.
public
getDefinition() : Definition|null
Tags
Return values
Definition|null —getError()
Returns the current element error (if there is error).
public
getError() : Error|null
Return values
Error|null —getId()
Returns the element id.
public
getId() : int
Return values
int —getLanguage()
Returns the product language object.
public
getLanguage() : ProductLanguage|null
Tags
Return values
ProductLanguage|null —getMainCategory()
Returns the category id where this product belongs.
public
getMainCategory() : int
Return values
int —getMainImages()
Returns the product media object.
public
getMainImages() : Media|null
Tags
Return values
Media|null —getOptions()
Returns the product options.
public
getOptions() : array<string|int, Option>
Tags
Return values
array<string|int, Option> —getOptionsPrice()
Returns the product options price.
public
getOptionsPrice() : float
Return values
float —getPId()
Returns the element public id (pId).
public
getPId() : string
Return values
string —getPrice()
Returns the product total price.
public
getPrice() : float
Return values
float —getPrices()
Returns the product prices.
public
getPrices() : ItemPrices|null
Tags
Return values
ItemPrices|null —getPricesWithTaxes()
Returns the product prices (taxes included).
public
getPricesWithTaxes() : ItemPrices|null
Tags
Return values
ItemPrices|null —getProductPrice()
Returns the product price.
public
getProductPrice() : float
Return values
float —getReverseChargeVat()
Sets if the product applies the reverse charge vat or not.
public
getReverseChargeVat() : bool
Return values
bool —getShipping()
Sets if the product has to be counted calculating shippings or not.
public
getShipping() : bool
Return values
bool —getShowPrices()
Returns the product prices in function of the given setting.
public
getShowPrices(bool $showTaxincluded) : array<string|int, ItemPrices>
Parameters
- $showTaxincluded : bool
Tags
Return values
array<string|int, ItemPrices> —getSupplierId()
Returns the identifier of the product supplier.
public
getSupplierId() : int
Return values
int —getTaxes()
Returns the product taxes.
public
getTaxes() : array<string|int, Tax>
Tags
Return values
array<string|int, Tax> —getTotalStock()
Returns the product total stock.
public
getTotalStock() : int
Return values
int —getWeight()
Returns the product total weight.
public
getWeight() : float
Return values
float —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
Return values
array<string|int, mixed> —setError()
protected
setError(mixed $error) : void
Parameters
- $error : mixed