Oihana PHP System

SetProductProviderInfoTrait

Trait to manage product provider information for an entity.

This trait provides methods to safely set properties on a ProductProviderInfo object. It ensures that the productInfo object is initialized before setting any values.

Tags
author

Marc Alcaraz (eKameleon)

since
1.3.0

Table of Contents

Properties

$productInfo  : null|ProductProviderInfo

Methods

setProductProviderInfoProperties()  : bool
Set one of the predefined product provider properties.
setProductProviderInfoProperty()  : bool
Internal method to set a single property on the `ProductProviderInfo` object.

Properties

Methods

setProductProviderInfoProperties()

Set one of the predefined product provider properties.

public setProductProviderInfoProperties(string $property, mixed $value) : bool

This method maps certain standardized property names (from Prop) to the internal productInfo object.

Supported properties include:

  • BUYING_PRICE
  • BUYING_PRICE_MARGIN
  • BUYING_PRICE_REFERENCE_QUANTITY
  • BUYING_PRICE_REFERENCE_QUANTITY_UNIT_CODE
  • HAS_QUANTITY_DISCOUNT
  • NEXT_BUYING_PRICE
  • NEXT_BUYING_PRICE_DATE
  • PRIMARY
Parameters
$property : string

The property name to set.

$value : mixed

The value to assign.

Return values
bool

True if the property was handled, false otherwise.

setProductProviderInfoProperty()

Internal method to set a single property on the `ProductProviderInfo` object.

protected setProductProviderInfoProperty(string $name, mixed $value) : bool

If the productInfo property is not yet initialized, it will be created automatically. If the value is null, the property will be cleared.

Parameters
$name : string

The property name to set on ProductProviderInfo.

$value : mixed

The value to assign to the property.

Return values
bool

True if the property was successfully set or cleared, false otherwise.

On this page

Search results