CoolCMS API

SetAvailability
in package

FinalYes

Availability of a product set, aggregated via {@see \App\UI\Api\Eshop\Models\Services\SetCompositionService} (decomposition into stock items) and the Store facade {@see \App\UI\Api\Store\Models\Managers\StockItemManager::getAvailabilityBatch()} (physical quantities). Returned by {@see \App\UI\Api\Eshop\Models\Managers\ProductSetManager::getAvailabilities()}.

availableSets is null, not 0, when the set cannot be evaluated reliably (unmappedVariantIds or unresolvedSetIds not empty: a variant without a stock item or a set that cannot be decomposed), so the admin can tell "zero availability" from "not mapped yet".

inactiveSetIds (a subset of unresolvedSetIds) says the cause is a deleted or deactivated composition component, so the admin can show the concrete reason in the Stock tab.

Table of Contents

Properties

$attributeClass  : string|null
$availableSets  : int|null
$deliveryDays  : int|null
$inactiveSetIds  : array<string|int, mixed>
$infoText  : string|null
$inStock  : bool
$labelWarehouseId  : int|null
$setId  : int
$unmappedVariantIds  : array<string|int, mixed>
$unresolvedSetIds  : array<string|int, mixed>

Methods

__construct()  : mixed
isFullyStocked()  : bool
The set is fully mapped to stock (availability is a reliable number, not an estimate or unknown).

Properties

$inactiveSetIds read-only

public array<string|int, mixed> $inactiveSetIds = []

$unmappedVariantIds read-only

public array<string|int, mixed> $unmappedVariantIds = []

$unresolvedSetIds read-only

public array<string|int, mixed> $unresolvedSetIds = []

Methods

__construct()

public __construct(int $setId, int|null $availableSets, bool $inStock, int|null $deliveryDays, int|null $labelWarehouseId, string|null $infoText, string|null $attributeClass[, array<int, int> $unmappedVariantIds = [] ][, array<int, int> $unresolvedSetIds = [] ][, array<int, int> $inactiveSetIds = [] ]) : mixed
Parameters
$setId : int
$availableSets : int|null
$inStock : bool
$deliveryDays : int|null
$labelWarehouseId : int|null
$infoText : string|null
$attributeClass : string|null
$unmappedVariantIds : array<int, int> = []

variants without a stock item

$unresolvedSetIds : array<int, int> = []

sets that could not be decomposed

$inactiveSetIds : array<int, int> = []

of those, components excluded because deleted or deactivated

isFullyStocked()

The set is fully mapped to stock (availability is a reliable number, not an estimate or unknown).

public isFullyStocked() : bool
Return values
bool
On this page

Search results