Fix travis
This commit is contained in:
parent
f6c444c235
commit
9712e3d28f
@ -1038,9 +1038,9 @@ class ProductCombinationLevel
|
|||||||
/**
|
/**
|
||||||
* Retrieves combination price levels
|
* Retrieves combination price levels
|
||||||
*
|
*
|
||||||
* @param int $fk_product_attribute_combination
|
* @param int $fk_product_attribute_combination Id of product combination
|
||||||
* @param int $fk_price_level the price level to fetch, use 0 for all
|
* @param int $fk_price_level The price level to fetch, use 0 for all
|
||||||
* @return self[] | -1 on KO
|
* @return mixed self[] | -1 on KO
|
||||||
*/
|
*/
|
||||||
public function fetchAll($fk_product_attribute_combination, $fk_price_level = 0)
|
public function fetchAll($fk_product_attribute_combination, $fk_price_level = 0)
|
||||||
{
|
{
|
||||||
@ -1111,10 +1111,10 @@ class ProductCombinationLevel
|
|||||||
|
|
||||||
// check if level exist in DB before add
|
// check if level exist in DB before add
|
||||||
if (empty($this->id)){
|
if (empty($this->id)){
|
||||||
$sql = "SELECT rowid id"
|
$sql = "SELECT rowid id";
|
||||||
." FROM ".MAIN_DB_PREFIX . $this->table_element
|
$sql .= " FROM ".MAIN_DB_PREFIX . $this->table_element;
|
||||||
." WHERE fk_product_attribute_combination = ".(int) $this->fk_product_attribute_combination
|
$sql .= " WHERE fk_product_attribute_combination = ".(int) $this->fk_product_attribute_combination;
|
||||||
.' AND fk_price_level = '.intval($this->fk_price_level);
|
$sql .= ' AND fk_price_level = '.intval($this->fk_price_level);
|
||||||
|
|
||||||
$existObj = $this->db->getRow($sql);
|
$existObj = $this->db->getRow($sql);
|
||||||
if ($existObj){
|
if ($existObj){
|
||||||
@ -1124,10 +1124,9 @@ class ProductCombinationLevel
|
|||||||
|
|
||||||
// Update
|
// Update
|
||||||
if (!empty($this->id)) {
|
if (!empty($this->id)) {
|
||||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET '
|
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element;
|
||||||
. ' variation_price = '.doubleval($this->variation_price)
|
$sql .= ' SET variation_price = '.doubleval($this->variation_price).' , variation_price_percentage = '.intval($this->variation_price_percentage);
|
||||||
. ' , variation_price_percentage = '.intval($this->variation_price_percentage)
|
$sql .= ' WHERE rowid = '.intval($this->id);
|
||||||
. ' WHERE rowid = '.intval($this->id);
|
|
||||||
|
|
||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
if ($res>0){
|
if ($res>0){
|
||||||
@ -1141,14 +1140,14 @@ class ProductCombinationLevel
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// ADD
|
// ADD
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " ("
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " (;
|
||||||
. " fk_product_attribute_combination, fk_price_level, variation_price, variation_price_percentage"
|
$sql .= " fk_product_attribute_combination, fk_price_level, variation_price, variation_price_percentage";
|
||||||
. " ) VALUES ( "
|
$sql .= " ) VALUES (";
|
||||||
. intval($this->fk_product_attribute_combination)
|
$sql .= intval($this->fk_product_attribute_combination);
|
||||||
. ' , '.intval($this->fk_price_level)
|
$sql .= " , ".intval($this->fk_price_level);
|
||||||
. ' , '.doubleval($this->variation_price)
|
$sql .= " , ".doubleval($this->variation_price);
|
||||||
. ' , '.intval($this->variation_price_percentage)
|
$sql .= " , ".intval($this->variation_price_percentage);
|
||||||
. " )";
|
$sql .= ")";
|
||||||
|
|
||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
if ($res){
|
if ($res){
|
||||||
@ -1172,8 +1171,8 @@ class ProductCombinationLevel
|
|||||||
*/
|
*/
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
$res = $this->db->query("DELETE FROM ".MAIN_DB_PREFIX.$this->table_element
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element." WHERE rowid = ".(int) $this->id;
|
||||||
." WHERE rowid = ".(int) $this->id);
|
$res = $this->db->query($sql);
|
||||||
|
|
||||||
return $res ? 1 : -1;
|
return $res ? 1 : -1;
|
||||||
}
|
}
|
||||||
@ -1187,8 +1186,8 @@ class ProductCombinationLevel
|
|||||||
*/
|
*/
|
||||||
public function deleteAllForCombination($fk_product_attribute_combination)
|
public function deleteAllForCombination($fk_product_attribute_combination)
|
||||||
{
|
{
|
||||||
$res = $this->db->query("DELETE FROM ".MAIN_DB_PREFIX.$this->table_element
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element." WHERE fk_product_attribute_combination = ".(int) $fk_product_attribute_combination;
|
||||||
." WHERE fk_product_attribute_combination = ".(int) $fk_product_attribute_combination);
|
$res = $this->db->query($sql);
|
||||||
|
|
||||||
return $res ? 1 : -1;
|
return $res ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user