phpDocumentor

ProductPriceReader
in package
implements ProductPriceReaderInterface

Class ProductPriceReader

Interfaces, Classes and Traits

ProductPriceReaderInterface
Interface ProductPriceReaderInterface

Table of Contents

$db  : CI_DB_query_builder
__construct()  : mixed
ProductPriceReader constructor.
fetchById()  : array<string|int, mixed>|null
Fetches product price data by the given id.
fetchByQuantity()  : array<string|int, mixed>|null
Fetches product price data by the given conditions.
_findNearestLower()  : float|null
Finds the nearest number.

Properties

Methods

__construct()

ProductPriceReader constructor.

public __construct(CI_DB_query_builder $db) : mixed
Parameters
$db : CI_DB_query_builder
Return values
mixed

fetchById()

Fetches product price data by the given id.

public fetchById(IdType $productId) : array<string|int, mixed>|null
Parameters
$productId : IdType

product id.

Return values
array<string|int, mixed>|null

Raw data of product prices.

fetchByQuantity()

Fetches product price data by the given conditions.

public fetchByQuantity(IdType $productId, IdType $customerGroupId, DecimalType $quantity) : array<string|int, mixed>|null
Parameters
$productId : IdType

Product id.

$customerGroupId : IdType

Customer group id.

$quantity : DecimalType

Quantity.

Return values
array<string|int, mixed>|null

Raw data of product prices.

_findNearestLower()

Finds the nearest number.

private _findNearestLower(array<string|int, mixed> $numbers, float $search) : float|null

If the searched number is between two others, the lower value is returned.

Parameters
$numbers : array<string|int, mixed>

Numbers to be searched

$search : float

Number to be searched.

Return values
float|null

Nearest (or lower nearest) number.

Search results