class ProductCombinationLevel (View source)

Class ProductCombinationLevel Used to represent a product combination Level

Properties

DoliDB $db

Database handler

string $table_element
int $id

Rowid of combination

int $fk_product_attribute_combination

Rowid of parent product combination

int $fk_price_level

Combination price level

float $variation_price

Price variation

bool $variation_price_percentage

Is the price variation a relative variation?

string $error
string[] $errors

Methods

__construct(DoliDB $db)

Constructor

int
fetch(int $rowid)

Retrieves a combination level by its rowid

mixed
fetchAll(int $fk_product_attribute_combination, int $fk_price_level = 0)

Retrieves combination price levels

int
fetchFormObj(object $obj)

Assign vars form an stdclass like sql obj

int
save()

Save a price impact of a product combination for a price level

int
delete()

delete

int
deleteAllForCombination(int $fk_product_attribute_combination)

delete all for a combination

int
clean(int $fk_product_attribute_combination)

Clean not needed price levels for a combination

createFromParent(DoliDB $db, ProductCombination $productCombination, int $fkPriceLevel)

Create new Product Combination Price level from Parent

Details

__construct(DoliDB $db)

Constructor

Parameters

DoliDB $db

Database handler

int fetch(int $rowid)

Retrieves a combination level by its rowid

Parameters

int $rowid

Row id

Return Value

int

Return integer <0 KO, >0 OK

mixed fetchAll(int $fk_product_attribute_combination, int $fk_price_level = 0)

Retrieves combination price levels

Parameters

int $fk_product_attribute_combination

Id of product combination

int $fk_price_level

The price level to fetch, use 0 for all

Return Value

mixed

self[] | -1 on KO

int fetchFormObj(object $obj)

Assign vars form an stdclass like sql obj

Parameters

object $obj

Object resultset

Return Value

int

Return integer <0 KO, >0 OK

int save()

Save a price impact of a product combination for a price level

Return Value

int

Return integer <0 KO, >0 OK

int delete()

delete

Return Value

int

Return integer <0 KO, >0 OK

int deleteAllForCombination(int $fk_product_attribute_combination)

delete all for a combination

Parameters

int $fk_product_attribute_combination

Id of combination

Return Value

int

Return integer <0 KO, >0 OK

int clean(int $fk_product_attribute_combination)

Clean not needed price levels for a combination

Parameters

int $fk_product_attribute_combination

Id of combination

Return Value

int

Return integer <0 KO, >0 OK

static ProductCombinationLevel createFromParent(DoliDB $db, ProductCombination $productCombination, int $fkPriceLevel)

Create new Product Combination Price level from Parent

Parameters

DoliDB $db

Database handler

ProductCombination $productCombination

Product combination

int $fkPriceLevel

Price level

Return Value

ProductCombinationLevel