Fixing style errors.
This commit is contained in:
parent
03e9e17be4
commit
af91013506
@ -233,72 +233,72 @@ class ProductCombination
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the product id of the parent product of a variant product (Get fk_product_parent by fk_product_child)
|
* Return the product id of the parent product of a variant product (Get fk_product_parent by fk_product_child)
|
||||||
*
|
*
|
||||||
* @param int $fk_child Product row id
|
* @param int $fk_child Product row id
|
||||||
* @return int >0 if OK, 0 if product is not a variant, <0 if KO
|
* @return int >0 if OK, 0 if product is not a variant, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function getFkProductParentByFkProductChild($fk_child)
|
public function getFkProductParentByFkProductChild($fk_child)
|
||||||
{
|
{
|
||||||
$sql = "SELECT fk_product_parent FROM ".MAIN_DB_PREFIX."product_attribute_combination";
|
$sql = "SELECT fk_product_parent FROM ".MAIN_DB_PREFIX."product_attribute_combination";
|
||||||
$sql .= " WHERE fk_product_child = ".(int) $fk_child." AND entity IN (".getEntity('product').") LIMIT 1";
|
$sql .= " WHERE fk_product_child = ".(int) $fk_child." AND entity IN (".getEntity('product').") LIMIT 1";
|
||||||
|
|
||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
if (!$query) {
|
if (!$query) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->db->num_rows($query)) {
|
if (!$this->db->num_rows($query)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = $this->db->fetch_object($query);
|
$row = $this->db->fetch_object($query);
|
||||||
|
|
||||||
return (int) $row->fk_product_parent;
|
return (int) $row->fk_product_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all product combinations by the child product row id
|
* Retrieves all product combinations by the child product row id
|
||||||
*
|
*
|
||||||
* @param int $fk_child Product row id
|
* @param int $fk_child Product row id
|
||||||
* @param int $donotloadpricelevel Avoid loading price impact for each level. If PRODUIT_MULTIPRICES is not set, this has no effect.
|
* @param int $donotloadpricelevel Avoid loading price impact for each level. If PRODUIT_MULTIPRICES is not set, this has no effect.
|
||||||
* @return int|ProductCombination[] <0 KO
|
* @return int|ProductCombination[] <0 KO
|
||||||
*/
|
*/
|
||||||
public function fetchAllByFkProductChild($fk_child, $donotloadpricelevel = 0)
|
public function fetchAllByFkProductChild($fk_child, $donotloadpricelevel = 0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT rowid, fk_product_parent, fk_product_child, variation_price, variation_price_percentage, variation_weight, variation_ref_ext FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_child = ".(int) $fk_child." AND entity IN (".getEntity('product').")";
|
$sql = "SELECT rowid, fk_product_parent, fk_product_child, variation_price, variation_price_percentage, variation_weight, variation_ref_ext FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_child = ".(int) $fk_child." AND entity IN (".getEntity('product').")";
|
||||||
|
|
||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
if (!$query) {
|
if (!$query) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
|
|
||||||
while ($result = $this->db->fetch_object($query)) {
|
while ($result = $this->db->fetch_object($query)) {
|
||||||
$tmp = new ProductCombination($this->db);
|
$tmp = new ProductCombination($this->db);
|
||||||
$tmp->id = $result->rowid;
|
$tmp->id = $result->rowid;
|
||||||
$tmp->fk_product_parent = $result->fk_product_parent;
|
$tmp->fk_product_parent = $result->fk_product_parent;
|
||||||
$tmp->fk_product_child = $result->fk_product_child;
|
$tmp->fk_product_child = $result->fk_product_child;
|
||||||
$tmp->variation_price = $result->variation_price;
|
$tmp->variation_price = $result->variation_price;
|
||||||
$tmp->variation_price_percentage = $result->variation_price_percentage;
|
$tmp->variation_price_percentage = $result->variation_price_percentage;
|
||||||
$tmp->variation_weight = $result->variation_weight;
|
$tmp->variation_weight = $result->variation_weight;
|
||||||
$tmp->variation_ref_ext = $result->variation_ref_ext;
|
$tmp->variation_ref_ext = $result->variation_ref_ext;
|
||||||
|
|
||||||
if (empty($donotloadpricelevel) && !empty($conf->global->PRODUIT_MULTIPRICES)) {
|
if (empty($donotloadpricelevel) && !empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||||
$tmp->fetchCombinationPriceLevels();
|
$tmp->fetchCombinationPriceLevels();
|
||||||
}
|
}
|
||||||
|
|
||||||
$return[] = $tmp;
|
$return[] = $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all product combinations by the product parent row id
|
* Retrieves all product combinations by the product parent row id
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user