dolibarr
x.y.z
|
Class ProductCombination Used to represent a product combination. More...
Public Member Functions | |
__construct (DoliDB $db) | |
Constructor. More... | |
fetch ($rowid) | |
Retrieves a combination by its rowid. More... | |
fetchCombinationPriceLevels ($fk_price_level=0, $useCache=true) | |
Retrieves combination price levels. More... | |
saveCombinationPriceLevels ($clean=1) | |
Retrieves combination price levels. More... | |
fetchByFkProductChild ($productid, $donotloadpricelevel=0) | |
Retrieves information of a variant product and ID of its parent product. More... | |
fetchAllByFkProductParent ($fk_product_parent) | |
Retrieves all product combinations by the product parent row id. More... | |
countNbOfCombinationForFkProductParent ($fk_product_parent) | |
Retrieves all product combinations by the product parent row id. More... | |
create ($user) | |
Creates a product attribute combination. More... | |
update (User $user) | |
Updates a product combination. More... | |
delete (User $user) | |
Deletes a product combination. More... | |
deleteByFkProductParent ($user, $fk_product_parent) | |
Deletes all product combinations of a parent product. More... | |
updateProperties (Product $parent, User $user) | |
Updates the weight of the child product. More... | |
fetchByProductCombination2ValuePairs ($prodid, array $features) | |
Retrieves the combination that matches the given features. More... | |
getUniqueAttributesAndValuesByFkProductParent ($productid) | |
Retrieves all unique attributes for a parent product. More... | |
createProductCombination (User $user, Product $product, array $combinations, array $variations, $price_var_percent=false, $forced_pricevar=false, $forced_weightvar=false, $forced_refvar=false, $ref_ext='') | |
Creates a product combination. More... | |
copyAll (User $user, $origProductId, Product $destProduct) | |
Copies all product combinations from the origin product to the destination product. More... | |
getCombinationLabel ($prod_child) | |
Return label for combinations. More... | |
Class ProductCombination Used to represent a product combination.
Definition at line 24 of file ProductCombination.class.php.
ProductCombination::__construct | ( | DoliDB | $db | ) |
Constructor.
Definition at line 91 of file ProductCombination.class.php.
Copies all product combinations from the origin product to the destination product.
User | $user | Object user |
int | $origProductId | Origin product id |
Product | $destProduct | Destination product |
Definition at line 927 of file ProductCombination.class.php.
ProductCombination::countNbOfCombinationForFkProductParent | ( | $fk_product_parent | ) |
Retrieves all product combinations by the product parent row id.
int | $fk_product_parent | Id of parent product |
Definition at line 321 of file ProductCombination.class.php.
ProductCombination::create | ( | $user | ) |
Creates a product attribute combination.
User | $user | Object user |
Definition at line 343 of file ProductCombination.class.php.
ProductCombination::createProductCombination | ( | User | $user, |
Product | $product, | ||
array | $combinations, | ||
array | $variations, | ||
$price_var_percent = false , |
|||
$forced_pricevar = false , |
|||
$forced_weightvar = false , |
|||
$forced_refvar = false , |
|||
$ref_ext = '' |
|||
) |
Creates a product combination.
Check usages to find more about its use Format of $combinations array: array( 0 => array( attr => value, attr2 => value [...] ), [...] )
User | $user | Object user |
Product | $product | Parent product |
array | $combinations | Attribute and value combinations. |
array | $variations | Price and weight variations |
bool | array | $price_var_percent | Is the price variation a relative variation? |
bool | float | $forced_pricevar | If the price variation is forced |
bool | float | $forced_weightvar | If the weight variation is forced |
bool | string | $forced_refvar | If the reference is forced |
string | $ref_ext | External reference |
If there is an existing combination, then we update the prices and weight Otherwise, we try adding a random number to the ref
Definition at line 706 of file ProductCombination.class.php.
ProductCombination::delete | ( | User | $user | ) |
Deletes a product combination.
User | $user | Object user |
Definition at line 415 of file ProductCombination.class.php.
ProductCombination::deleteByFkProductParent | ( | $user, | |
$fk_product_parent | |||
) |
Deletes all product combinations of a parent product.
User | $user | Object user |
int | $fk_product_parent | Rowid of parent product |
Definition at line 446 of file ProductCombination.class.php.
ProductCombination::fetch | ( | $rowid | ) |
Retrieves a combination by its rowid.
int | $rowid | Row id |
Definition at line 105 of file ProductCombination.class.php.
ProductCombination::fetchAllByFkProductParent | ( | $fk_product_parent | ) |
Retrieves all product combinations by the product parent row id.
int | $fk_product_parent | Rowid of parent product |
Definition at line 279 of file ProductCombination.class.php.
ProductCombination::fetchByFkProductChild | ( | $productid, | |
$donotloadpricelevel = 0 |
|||
) |
Retrieves information of a variant product and ID of its parent product.
int | $productid | Product ID of variant |
int | $donotloadpricelevel | Avoid loading price impact for each level. If PRODUIT_MULTIPRICES is not set, this has no effect. |
Definition at line 240 of file ProductCombination.class.php.
ProductCombination::fetchByProductCombination2ValuePairs | ( | $prodid, | |
array | $features | ||
) |
Retrieves the combination that matches the given features.
int | $prodid | Id of parent product |
array | $features | Format: [$attr] => $attr_val |
Definition at line 603 of file ProductCombination.class.php.
ProductCombination::fetchCombinationPriceLevels | ( | $fk_price_level = 0 , |
|
$useCache = true |
|||
) |
Retrieves combination price levels.
int | $fk_price_level | The price level to fetch, use 0 for all |
bool | $useCache | To use cache or not |
for auto retrocompatibility with last behavior
Definition at line 146 of file ProductCombination.class.php.
ProductCombination::getCombinationLabel | ( | $prod_child | ) |
Return label for combinations.
int | $prod_child | id of child |
Definition at line 969 of file ProductCombination.class.php.
ProductCombination::getUniqueAttributesAndValuesByFkProductParent | ( | $productid | ) |
Retrieves all unique attributes for a parent product.
int | $productid | Product rowid |
Definition at line 644 of file ProductCombination.class.php.
ProductCombination::saveCombinationPriceLevels | ( | $clean = 1 | ) |
Retrieves combination price levels.
int | $clean | Levels of PRODUIT_MULTIPRICES_LIMIT |
Definition at line 194 of file ProductCombination.class.php.
ProductCombination::update | ( | User | $user | ) |
Updates a product combination.
User | $user | Object user |
Definition at line 379 of file ProductCombination.class.php.
Updates the weight of the child product.
The price must be updated using Product::updatePrices. This method is called by the update() of a product.
Definition at line 481 of file ProductCombination.class.php.