41 public $fk_prod_combination;
53 public $fk_prod_attr_val;
72 require_once DOL_DOCUMENT_ROOT .
'/variants/class/ProductAttributeValue.class.php';
73 require_once DOL_DOCUMENT_ROOT .
'/variants/class/ProductAttribute.class.php';
78 $prodattr->fetch($this->fk_prod_attr);
79 $prodattrval->fetch($this->fk_prod_attr_val);
81 return $prodattr->label .
': ' . $prodattrval->value;
92 $sql =
"INSERT INTO " . MAIN_DB_PREFIX .
"product_attribute_combination2val
93 (fk_prod_combination, fk_prod_attr, fk_prod_attr_val)
94 VALUES(" . (int) $this->fk_prod_combination .
", " . (
int) $this->fk_prod_attr .
", " . (int) $this->fk_prod_attr_val .
")";
96 $query = $this->
db->query($sql);
99 $this->
id = $this->
db->last_insert_id(MAIN_DB_PREFIX .
'product_attribute_combination2val');
117 c2v.fk_prod_attr_val,
119 c2v.fk_prod_combination
120 FROM " . MAIN_DB_PREFIX .
"product_attribute c LEFT JOIN " . MAIN_DB_PREFIX .
"product_attribute_combination2val c2v ON c.rowid = c2v.fk_prod_attr
121 WHERE c2v.fk_prod_combination = " . (int) $fk_combination;
123 $sql .= $this->
db->order(
'c.position',
'asc');
125 $query = $this->
db->query($sql);
133 while ($obj = $this->
db->fetch_object($query)) {
135 $tmp->fk_prod_attr_val = $obj->fk_prod_attr_val;
136 $tmp->fk_prod_attr = $obj->fk_prod_attr;
137 $tmp->fk_prod_combination = $obj->fk_prod_combination;
138 $tmp->id = $obj->rowid;
154 $sql =
"DELETE FROM " . MAIN_DB_PREFIX .
"product_attribute_combination2val WHERE fk_prod_combination = " . (int) $fk_combination;
156 if ($this->
db->query($sql)) {
Class to manage Dolibarr database access.
Class ProductAttribute Used to represent a product attribute.
Class ProductAttributeValue Used to represent a product attribute value.
Class ProductCombination2ValuePair Used to represent the relation between a product combination,...
deleteByFkCombination($fk_combination)
Deletes a product combination 2 value pair.
fetchByFkCombination($fk_combination)
Retrieves a product combination 2 value pair from its rowid.
__construct(DoliDB $db)
Constructor.
create($user)
Creates a product combination 2 value pair.
__toString()
Translates this class to a human-readable string.
$conf db
API class for accounts.