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
see
Product::getCodes()
see
Product::getMainImages()
see
Product::getTotalStock()
see
Product::getShipping()
see
Product::getWeight()
see
Product::getMainCategory()
see
Product::getBrand()
see
Product::getSupplierId()
see
Product::getActivityLimits()
see
Product::getOptions()
see
Product::getDefinition()
see
Product::getCategories()
see
Product::getCategoryProperties()
see
Product::getCombinations()
see
Product::getLanguage()
see
Product::getReverseChargeVat()
see
Product::getTaxes()
see
Product::getPrices()
see
Product::getPricesWithTaxes()
see
Product::getDefaultOptionsPrices()
see
Product::getShippingTypeIds()
see
Product::getProductPrice()
see
Product::getOptionsPrice()
see
Product::getPrice()
see
Product::getAdditionalImages()
see
Product::getCombinationData()
see
Element
see
ElementTrait
see
IdentifiableElementTrait
see
IntegrableElementTrait
see
CatalogCustomTagValueTrait
see
EnumResolverTrait

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

$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

getBrand()

Returns the product brand object.

public getBrand() : Brand|null
Tags
see
Brand
Return values
Brand|null

getError()

Returns the current element error (if there is error).

public getError() : Error|null
Return values
Error|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
see
Media
Return values
Media|null

getOptions()

Returns the product options.

public getOptions() : array<string|int, Option>
Tags
see
Option
Return values
array<string|int, Option>

getOptionsPrice()

Returns the product options price.

public getOptionsPrice() : float
Return values
float

getPrice()

Returns the product total price.

public getPrice() : float
Return values
float

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
see
ItemPrices
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
see
Tax
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
Return values
void

Search results