CoolCMS API

PriceHistoryTrait

Shared core of the append-only price series of a set.

Used by the "Price list" tab (PriceSnapshotTrait) and by the inline price in the Variants tab of the product pivot form (ProductFormTrait).

IMPORTANT: both paths must write to the series the same way (same resolution of the currently valid price), otherwise they corrupt each other's history.

Writing goes only through the Api bridge (savePriceSnapshot, full-replace updateColumn, see App\UI\Api\Eshop\Models\Managers\ProductSetManager); this trait only reads existing rows. publishedTime is an ORM string Y-m-d H:i:s, so lexicographic comparison is chronological.

Table of Contents

Methods

currentProductSetPriceFor()  : ProductSetPrice|null
Returns the currently valid price for the key (`publishedTime <= $now`, latest) from the existing rows.
decimal()  : string
Formats a money value as a `decimal(15,4)` string (columns `price`/`original_price`).

Methods

currentProductSetPriceFor()

Returns the currently valid price for the key (`publishedTime <= $now`, latest) from the existing rows.

private currentProductSetPriceFor(ProductSet $set, int $fromAmount, int $userGroupId, int $currencyId, string $now) : ProductSetPrice|null
Parameters
$set : ProductSet
$fromAmount : int
$userGroupId : int
$currencyId : int
$now : string
Return values
ProductSetPrice|null

decimal()

Formats a money value as a `decimal(15,4)` string (columns `price`/`original_price`).

private decimal(mixed $value) : string
Parameters
$value : mixed
Return values
string
On this page

Search results