ExternalProduct
in package
Table of Contents
Properties
- $assets : array<string|int, mixed>
- $attributes : array<string|int, mixed>
- $externalId : string
- $id : string
- $searchId : string
Methods
- __construct() : mixed
- getAssets() : array<string|int, mixed>|null
- Retrieves a specific assets by it name.
- getAttributeValue() : string|null
- Get the value of a product attribute by name.
- getDownloads() : array<string|int, mixed>
- Retrieves an array of downloadable assets related to the product.
- getId() : mixed
- getSearchCardData() : mixed
- getSearchIndexData() : mixed
Properties
$assets
private
array<string|int, mixed>
$assets
Tags
$attributes
private
array<string|int, mixed>
$attributes
$externalId
private
string
$externalId
$id
private
string
$id
$searchId
private
string
$searchId
Methods
__construct()
public
__construct(array<string|int, mixed> $productData) : mixed
Parameters
- $productData : array<string|int, mixed>
getAssets()
Retrieves a specific assets by it name.
public
getAssets(string $name[, bool $asArrays = true ]) : array<string|int, mixed>|null
This method searches for an asset in the $this->assets array by the provided asset name.
If an asset with the given name exists, it returns the asset's details; otherwise, it returns null.
Parameters
- $name : string
-
The name of the asset to retrieve.
- $asArrays : bool = true
Return values
array<string|int, mixed>|null —The details of the asset if found; otherwise, null.
getAttributeValue()
Get the value of a product attribute by name.
public
getAttributeValue(string $name) : string|null
Parameters
- $name : string
-
The name of the attribute.
Return values
string|null —The value of the attribute if found, or null if not found or empty.
getDownloads()
Retrieves an array of downloadable assets related to the product.
public
getDownloads([bool $assetsAsArray = false ]) : array<string|int, mixed>
This function gathers various types of downloadable product-related assets such as product fiches, warranty cards, datasheets, manuals, and quick start guides. It also includes additional reference data, like the 'Datasheets django ref'.
The function uses getAssets() to fetch the relevant assets by type
and getAttributeValue() to retrieve specific attribute values, ensuring
that missing data is replaced with empty arrays.
If the $assetsAsArray parameter is set to true, the assets will be returned
as arrays; otherwise, they will follow the default return structure.
Parameters
- $assetsAsArray : bool = false
-
Determines if the assets should be returned as arrays.
Return values
array<string|int, mixed> —An array of asset information, each with a 'name' and 'value' pair.
getId()
public
getId() : mixed
getSearchCardData()
public
getSearchCardData() : mixed
getSearchIndexData()
public
getSearchIndexData() : mixed