// Remove bad _SQL_USE_SLAVE_ uses + normalize Db->executeS(), Db->execute() and Db->numRows() names
This commit is contained in:
@@ -1277,7 +1277,7 @@ class AdminControllerCore extends Controller
|
||||
ORDER BY '.(($orderBy == $this->identifier) ? 'a.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).
|
||||
($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').'
|
||||
LIMIT '.(int)$start.','.(int)$limit;
|
||||
$this->_list = Db::getInstance()->ExecuteS($sql);
|
||||
$this->_list = Db::getInstance()->executeS($sql);
|
||||
$this->_listTotal = Db::getInstance()->getValue('SELECT FOUND_ROWS() AS `'._DB_PREFIX_.$this->table.'`');
|
||||
}
|
||||
|
||||
@@ -1481,9 +1481,9 @@ class AdminControllerCore extends Controller
|
||||
$assos[] = array('id_object' => (int)$id_asso_object, 'id_'.$type => (int)$res[2]);
|
||||
}
|
||||
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.$this->table.'_'.$type.($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.$this->table.'_'.$type.($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
|
||||
foreach ($assos as $asso)
|
||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.$this->table.'_'.$type.' (`'.pSQL($this->identifier).'`, id_'.$type.')
|
||||
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.$this->table.'_'.$type.' (`'.pSQL($this->identifier).'`, id_'.$type.')
|
||||
VALUES('.(int)$asso['id_object'].', '.(int)$asso['id_'.$type].')');
|
||||
}
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ abstract class AdminTabCore
|
||||
$required_fields[(int)$row['id_required_field']] = $row['field_name'];
|
||||
|
||||
|
||||
$table_fields = Db::getInstance()->ExecuteS('SHOW COLUMNS FROM '.pSQL(_DB_PREFIX_.$this->table));
|
||||
$table_fields = Db::getInstance()->executeS('SHOW COLUMNS FROM '.pSQL(_DB_PREFIX_.$this->table));
|
||||
$irow = 0;
|
||||
foreach ($table_fields as $field)
|
||||
{
|
||||
@@ -900,9 +900,9 @@ abstract class AdminTabCore
|
||||
|
||||
$assos = self::getAssoShop($this->table, $id_object);
|
||||
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.$this->table.'_'.$assos[1].($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.$this->table.'_'.$assos[1].($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
|
||||
foreach ($assos[0] as $asso)
|
||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.$this->table.'_'.$assos[1].' (`'.pSQL($this->identifier).'`, id_'.$assos[1].')
|
||||
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.$this->table.'_'.$assos[1].' (`'.pSQL($this->identifier).'`, id_'.$assos[1].')
|
||||
VALUES('.(int)$asso['id_object'].', '.(int)$asso['id_'.$assos[1]].')');
|
||||
}
|
||||
|
||||
@@ -1352,7 +1352,7 @@ abstract class AdminTabCore
|
||||
ORDER BY '.(($orderBy == $this->identifier) ? 'a.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).
|
||||
($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').'
|
||||
LIMIT '.(int)$start.','.(int)$limit;
|
||||
$this->_list = Db::getInstance()->ExecuteS($sql);
|
||||
$this->_list = Db::getInstance()->executeS($sql);
|
||||
$this->_listTotal = Db::getInstance()->getValue('SELECT FOUND_ROWS() AS `'._DB_PREFIX_.$this->table.'`');
|
||||
|
||||
}
|
||||
@@ -2341,7 +2341,7 @@ abstract class AdminTabCore
|
||||
$assos = array();
|
||||
$sql = 'SELECT id_'.$type.', `'.pSQL($this->identifier).'`
|
||||
FROM `'._DB_PREFIX_.pSQL($this->table).'_'.$type.'`';
|
||||
foreach (Db::getInstance()->ExecuteS($sql) as $row)
|
||||
foreach (Db::getInstance()->executeS($sql) as $row)
|
||||
$assos[$row['id_'.$type]][] = $row[$this->identifier];
|
||||
|
||||
$html = <<<EOF
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ class AliasCore extends ObjectModel
|
||||
if (!self::isFeatureActive())
|
||||
return '';
|
||||
|
||||
$aliases = Db::getInstance()->ExecuteS('
|
||||
$aliases = Db::getInstance()->executeS('
|
||||
SELECT a.alias
|
||||
FROM `'._DB_PREFIX_.'alias` a
|
||||
WHERE `search` = \''.pSQL($this->search).'\'');
|
||||
|
||||
@@ -65,7 +65,7 @@ class AttachmentCore extends ObjectModel
|
||||
public function delete()
|
||||
{
|
||||
@unlink(_PS_DOWNLOAD_DIR_.$this->file);
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'product_attachment WHERE id_attachment = '.(int)($this->id));
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'product_attachment WHERE id_attachment = '.(int)($this->id));
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class AttachmentCore extends ObjectModel
|
||||
|
||||
public static function getAttachments($id_lang, $id_product, $include = true)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM '._DB_PREFIX_.'attachment a
|
||||
LEFT JOIN '._DB_PREFIX_.'attachment_lang al ON (a.id_attachment = al.id_attachment AND al.id_lang = '.(int)($id_lang).')
|
||||
@@ -91,14 +91,14 @@ class AttachmentCore extends ObjectModel
|
||||
|
||||
public static function attachToProduct($id_product, $array)
|
||||
{
|
||||
$result1 = Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'product_attachment WHERE id_product = '.(int)($id_product));
|
||||
$result1 = Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'product_attachment WHERE id_product = '.(int)($id_product));
|
||||
if (is_array($array))
|
||||
{
|
||||
$ids = array();
|
||||
foreach ($array as $id_attachment)
|
||||
$ids[] = '('.(int)($id_product).','.(int)($id_attachment).')';
|
||||
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product SET cache_has_attachments = '.(count($ids) ? '1' : '0').' WHERE id_product = '.(int)($id_product).' LIMIT 1');
|
||||
return ($result1 && Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'product_attachment (id_product, id_attachment) VALUES '.implode(',',$ids)));
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET cache_has_attachments = '.(count($ids) ? '1' : '0').' WHERE id_product = '.(int)($id_product).' LIMIT 1');
|
||||
return ($result1 && Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'product_attachment (id_product, id_attachment) VALUES '.implode(',',$ids)));
|
||||
}
|
||||
return $result1;
|
||||
}
|
||||
|
||||
+10
-10
@@ -84,16 +84,16 @@ class AttributeCore extends ObjectModel
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (($result = Db::getInstance()->ExecuteS('SELECT `id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute_combination` WHERE `'.$this->identifier.'` = '.(int)$this->id)) === false)
|
||||
if (($result = Db::getInstance()->executeS('SELECT `id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute_combination` WHERE `'.$this->identifier.'` = '.(int)$this->id)) === false)
|
||||
return false;
|
||||
$combinationIds = array();
|
||||
if (Db::getInstance()->numRows())
|
||||
{
|
||||
foreach ($result AS $row)
|
||||
$combinationIds[] = (int)$row['id_product_attribute'];
|
||||
if (Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_attribute_combination` WHERE `'.$this->identifier.'` = '.(int)$this->id) === false)
|
||||
if (Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_attribute_combination` WHERE `'.$this->identifier.'` = '.(int)$this->id) === false)
|
||||
return false;
|
||||
if (Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product_attribute` IN ('.implode(', ', $combinationIds).')') === false)
|
||||
if (Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product_attribute` IN ('.implode(', ', $combinationIds).')') === false)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ class AttributeCore extends ObjectModel
|
||||
{
|
||||
if (!Combination::isFeatureActive())
|
||||
return array();
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT ag.*, agl.*, a.`id_attribute`, al.`name`, agl.`name` AS `attribute_group`
|
||||
FROM `'._DB_PREFIX_.'attribute_group` ag
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$id_lang.')
|
||||
@@ -221,7 +221,7 @@ class AttributeCore extends ObjectModel
|
||||
SELECT `id_attribute_group` FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute` = '.(int)$this->id.')
|
||||
AND group_type = \'color\''))
|
||||
return false;
|
||||
return Db::getInstance()->NumRows();
|
||||
return Db::getInstance()->numRows();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,7 +251,7 @@ class AttributeCore extends ObjectModel
|
||||
*/
|
||||
public function updatePosition($way, $position)
|
||||
{
|
||||
if (!$res = Db::getInstance()->ExecuteS('
|
||||
if (!$res = Db::getInstance()->executeS('
|
||||
SELECT a.`id_attribute`, a.`position`, a.`id_attribute_group`
|
||||
FROM `'._DB_PREFIX_.'attribute` a
|
||||
WHERE a.`id_attribute_group` = '.(int)Tools::getValue('id_attribute_group', 1).'
|
||||
@@ -268,7 +268,7 @@ class AttributeCore extends ObjectModel
|
||||
|
||||
// < and > statements rather than BETWEEN operator
|
||||
// since BETWEEN is treated differently according to databases
|
||||
return (Db::getInstance()->Execute('
|
||||
return (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'attribute`
|
||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||
WHERE `position`
|
||||
@@ -276,7 +276,7 @@ class AttributeCore extends ObjectModel
|
||||
? '> '.(int)$movedAttribute['position'].' AND `position` <= '.(int)$position
|
||||
: '< '.(int)$movedAttribute['position'].' AND `position` >= '.(int)$position).'
|
||||
AND `id_attribute_group`='.(int)$movedAttribute['id_attribute_group'])
|
||||
AND Db::getInstance()->Execute('
|
||||
AND Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'attribute`
|
||||
SET `position` = '.(int)$position.'
|
||||
WHERE `id_attribute` = '.(int)$movedAttribute['id_attribute'].'
|
||||
@@ -305,11 +305,11 @@ class AttributeCore extends ObjectModel
|
||||
AND `id_attribute` != '.(int)$this->id;
|
||||
$sql .= '
|
||||
ORDER BY `position`';
|
||||
$result = Db::getInstance()->ExecuteS($sql);
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
|
||||
$i = 0;
|
||||
foreach ($result as $value)
|
||||
$return = Db::getInstance()->Execute('
|
||||
$return = Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'attribute`
|
||||
SET `position` = '.(int)$i++.'
|
||||
WHERE `id_attribute_group` = '.(int)$id_attribute_group.'
|
||||
|
||||
+14
-14
@@ -96,12 +96,12 @@ class AttributeGroupCore extends ObjectModel
|
||||
|
||||
public static function cleanDeadCombinations()
|
||||
{
|
||||
$attributeCombinations = Db::getInstance()->ExecuteS('SELECT pac.`id_attribute`, pa.`id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute` pa LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pa.`id_product_attribute` = pac.`id_product_attribute`)');
|
||||
$attributeCombinations = Db::getInstance()->executeS('SELECT pac.`id_attribute`, pa.`id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute` pa LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pa.`id_product_attribute` = pac.`id_product_attribute`)');
|
||||
$toRemove = array();
|
||||
foreach ($attributeCombinations AS $attributeCombination)
|
||||
if ((int)($attributeCombination['id_attribute']) == 0)
|
||||
$toRemove[] = (int)($attributeCombination['id_product_attribute']);
|
||||
if (!empty($toRemove) AND Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product_attribute` IN ('.implode(', ', $toRemove).')') === false)
|
||||
if (!empty($toRemove) AND Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product_attribute` IN ('.implode(', ', $toRemove).')') === false)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -109,20 +109,20 @@ class AttributeGroupCore extends ObjectModel
|
||||
public function delete()
|
||||
{
|
||||
/* Select children in order to find linked combinations */
|
||||
$attributeIds = Db::getInstance()->ExecuteS('SELECT `id_attribute` FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)($this->id));
|
||||
$attributeIds = Db::getInstance()->executeS('SELECT `id_attribute` FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)($this->id));
|
||||
if ($attributeIds === false)
|
||||
return false;
|
||||
/* Removing attributes to the found combinations */
|
||||
$toRemove = array();
|
||||
foreach ($attributeIds AS $attribute)
|
||||
$toRemove[] = (int)($attribute['id_attribute']);
|
||||
if (!empty($toRemove) AND Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_attribute_combination` WHERE `id_attribute` IN ('.implode(', ', $toRemove).')') === false)
|
||||
if (!empty($toRemove) AND Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_attribute_combination` WHERE `id_attribute` IN ('.implode(', ', $toRemove).')') === false)
|
||||
return false;
|
||||
/* Remove combinations if they do not possess attributes anymore */
|
||||
if (!self::cleanDeadCombinations())
|
||||
return false;
|
||||
/* Also delete related attributes */
|
||||
if (Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'attribute_lang` WHERE `id_attribute` IN (SELECT id_attribute FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)($this->id).')') === false OR Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)($this->id)) === false)
|
||||
if (Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'attribute_lang` WHERE `id_attribute` IN (SELECT id_attribute FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)($this->id).')') === false OR Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)($this->id)) === false)
|
||||
return false;
|
||||
$return = parent::delete();
|
||||
if($return)
|
||||
@@ -141,7 +141,7 @@ class AttributeGroupCore extends ObjectModel
|
||||
{
|
||||
if (!Combination::isFeatureActive())
|
||||
return array();
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'attribute` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)($id_lang).')
|
||||
@@ -159,7 +159,7 @@ class AttributeGroupCore extends ObjectModel
|
||||
{
|
||||
if (!Combination::isFeatureActive())
|
||||
return array();
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'attribute_group` ag
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND `id_lang` = '.(int)($id_lang).')
|
||||
@@ -188,7 +188,7 @@ class AttributeGroupCore extends ObjectModel
|
||||
$ids = array();
|
||||
foreach ($values as $value)
|
||||
$ids[] = intval($value['id']);
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'attribute`
|
||||
WHERE `id_attribute_group` = '.(int)$this->id.'
|
||||
AND `id_attribute` NOT IN ('.implode(',', $ids).')'
|
||||
@@ -196,7 +196,7 @@ class AttributeGroupCore extends ObjectModel
|
||||
$ok = true;
|
||||
foreach ($values as $value)
|
||||
{
|
||||
$result = Db::getInstance()->Execute('
|
||||
$result = Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'attribute`
|
||||
SET `id_attribute_group` = '.(int)$this->id.'
|
||||
WHERE `id_attribute` = '.(int)$value['id']
|
||||
@@ -221,7 +221,7 @@ class AttributeGroupCore extends ObjectModel
|
||||
*/
|
||||
public function updatePosition($way, $position)
|
||||
{
|
||||
if (!$res = Db::getInstance()->ExecuteS('
|
||||
if (!$res = Db::getInstance()->executeS('
|
||||
SELECT ag.`position`, ag.`id_attribute_group`
|
||||
FROM `'._DB_PREFIX_.'attribute_group` ag
|
||||
WHERE ag.`id_attribute_group` = '.(int)Tools::getValue('id_attribute_group', 1).'
|
||||
@@ -238,14 +238,14 @@ class AttributeGroupCore extends ObjectModel
|
||||
|
||||
// < and > statements rather than BETWEEN operator
|
||||
// since BETWEEN is treated differently according to databases
|
||||
return (Db::getInstance()->Execute('
|
||||
return (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'attribute_group`
|
||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||
WHERE `position`
|
||||
'.($way
|
||||
? '> '.(int)$movedGroupAttribute['position'].' AND `position` <= '.(int)$position
|
||||
: '< '.(int)$movedGroupAttribute['position'].' AND `position` >= '.(int)$position))
|
||||
AND Db::getInstance()->Execute('
|
||||
AND Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'attribute_group`
|
||||
SET `position` = '.(int)$position.'
|
||||
WHERE `id_attribute_group`='.(int)$movedGroupAttribute['id_attribute_group']));
|
||||
@@ -265,11 +265,11 @@ class AttributeGroupCore extends ObjectModel
|
||||
SELECT `id_attribute_group`
|
||||
FROM `'._DB_PREFIX_.'attribute_group`
|
||||
ORDER BY `position`';
|
||||
$result = Db::getInstance()->ExecuteS($sql);
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
|
||||
$i = 0;
|
||||
foreach ($result as $value)
|
||||
$return = Db::getInstance()->Execute('
|
||||
$return = Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'attribute_group`
|
||||
SET `position` = '.(int)$i++.'
|
||||
WHERE `id_attribute_group` = '.(int)$value['id_attribute_group']);
|
||||
|
||||
+3
-3
@@ -213,7 +213,7 @@ class BackupCore
|
||||
fwrite($fp, "\n".'SET NAMES \'utf8\';'."\n\n");
|
||||
|
||||
// Find all tables
|
||||
$tables = Db::getInstance()->ExecuteS('SHOW TABLES');
|
||||
$tables = Db::getInstance()->executeS('SHOW TABLES');
|
||||
$found = 0;
|
||||
foreach ($tables AS $table)
|
||||
{
|
||||
@@ -224,7 +224,7 @@ class BackupCore
|
||||
continue;
|
||||
|
||||
// Export the table schema
|
||||
$schema = Db::getInstance()->ExecuteS('SHOW CREATE TABLE `' . $table . '`');
|
||||
$schema = Db::getInstance()->executeS('SHOW CREATE TABLE `' . $table . '`');
|
||||
|
||||
if (count($schema) != 1 || !isset($schema[0]['Table']) || !isset($schema[0]['Create Table']))
|
||||
{
|
||||
@@ -243,7 +243,7 @@ class BackupCore
|
||||
|
||||
if (!in_array($schema[0]['Table'], $ignore_insert_table))
|
||||
{
|
||||
$data = Db::getInstance()->ExecuteS('SELECT * FROM `' . $schema[0]['Table'] . '`', false);
|
||||
$data = Db::getInstance()->executeS('SELECT * FROM `' . $schema[0]['Table'] . '`', false);
|
||||
$sizeof = DB::getInstance()->NumRows();
|
||||
$lines = explode("\n", $schema[0]['Create Table']);
|
||||
|
||||
|
||||
+9
-9
@@ -91,7 +91,7 @@ class CMSCore extends ObjectModel
|
||||
{
|
||||
if (!$link)
|
||||
$link = Context::getContext()->link;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.id_cms, cl.link_rewrite, cl.meta_title
|
||||
FROM '._DB_PREFIX_.'cms c
|
||||
LEFT JOIN '._DB_PREFIX_.'cms_lang cl ON (c.id_cms = cl.id_cms AND cl.id_lang = '.(int)($id_lang).')
|
||||
@@ -115,7 +115,7 @@ class CMSCore extends ObjectModel
|
||||
if (empty($id_lang))
|
||||
$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.id_cms, l.meta_title
|
||||
FROM '._DB_PREFIX_.'cms c
|
||||
JOIN '._DB_PREFIX_.'cms_lang l ON (c.id_cms = l.id_cms)
|
||||
@@ -126,7 +126,7 @@ class CMSCore extends ObjectModel
|
||||
|
||||
public function updatePosition($way, $position)
|
||||
{
|
||||
if (!$res = Db::getInstance()->ExecuteS('
|
||||
if (!$res = Db::getInstance()->executeS('
|
||||
SELECT cp.`id_cms`, cp.`position`, cp.`id_cms_category`
|
||||
FROM `'._DB_PREFIX_.'cms` cp
|
||||
WHERE cp.`id_cms_category` = '.(int)$this->id_cms_category.'
|
||||
@@ -143,7 +143,7 @@ class CMSCore extends ObjectModel
|
||||
|
||||
// < and > statements rather than BETWEEN operator
|
||||
// since BETWEEN is treated differently according to databases
|
||||
return (Db::getInstance()->Execute('
|
||||
return (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'cms`
|
||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||
WHERE `position`
|
||||
@@ -151,7 +151,7 @@ class CMSCore extends ObjectModel
|
||||
? '> '.(int)($movedCms['position']).' AND `position` <= '.(int)($position)
|
||||
: '< '.(int)($movedCms['position']).' AND `position` >= '.(int)($position)).'
|
||||
AND `id_cms_category`='.(int)($movedCms['id_cms_category']))
|
||||
&& Db::getInstance()->Execute('
|
||||
&& Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'cms`
|
||||
SET `position` = '.(int)($position).'
|
||||
WHERE `id_cms` = '.(int)($movedCms['id_cms']).'
|
||||
@@ -160,7 +160,7 @@ class CMSCore extends ObjectModel
|
||||
|
||||
public static function cleanPositions($id_category)
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `id_cms`
|
||||
FROM `'._DB_PREFIX_.'cms`
|
||||
WHERE `id_cms_category` = '.(int)($id_category).'
|
||||
@@ -171,7 +171,7 @@ class CMSCore extends ObjectModel
|
||||
SET `position` = '.(int)$i.'
|
||||
WHERE `id_cms_category` = '.(int)$id_category.'
|
||||
AND `id_cms` = '.(int)$result[$i]['id_cms'];
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ class CMSCore extends ObjectModel
|
||||
|
||||
public static function getCMSPages($id_lang = null, $id_cms_category = null, $active = true)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'cms` c
|
||||
JOIN `'._DB_PREFIX_.'cms_lang` l ON (c.id_cms = l.id_cms)'.
|
||||
@@ -200,6 +200,6 @@ class CMSCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'lang` AS l ON c.`id_lang` = l.`id_lang`
|
||||
WHERE c.`id_cms` = '.(int)$id_cms.'
|
||||
AND l.`active` = 1';
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
}
|
||||
|
||||
+18
-18
@@ -197,7 +197,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'cms_category` c
|
||||
WHERE c.`id_parent` = '.(int)$current.
|
||||
($active ? ' AND c.`active` = 1' : '');
|
||||
$result = Db::getInstance()->ExecuteS($sql);
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
foreach ($result as $row)
|
||||
$category['children'][] = self::getRecurseCategory($id_lang, $row['id_cms_category'], $active, $links);
|
||||
|
||||
@@ -208,7 +208,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
WHERE `id_cms_category` = '.(int)$current.'
|
||||
AND cl.`id_lang` = '.$id_lang.($active ? ' AND c.`active` = 1' : '').'
|
||||
ORDER BY c.`position`';
|
||||
$category['cms'] = Db::getInstance()->ExecuteS($sql);
|
||||
$category['cms'] = Db::getInstance()->executeS($sql);
|
||||
if ($links == 1)
|
||||
{
|
||||
$category['link'] = $link->getCMSCategoryLink($current, $category['link_rewrite']);
|
||||
@@ -243,7 +243,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
if (!is_array($toDelete) OR !$id_cms_category)
|
||||
die(Tools::displayError());
|
||||
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `id_cms_category`
|
||||
FROM `'._DB_PREFIX_.'cms_category`
|
||||
WHERE `id_parent` = '.(int)($id_cms_category));
|
||||
@@ -267,13 +267,13 @@ class CMSCategoryCore extends ObjectModel
|
||||
|
||||
/* Delete CMS Category and its child from database */
|
||||
$list = sizeof($toDelete) > 1 ? implode(',', $toDelete) : (int)($this->id);
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cms_category` WHERE `id_cms_category` IN ('.$list.')');
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cms_category_lang` WHERE `id_cms_category` IN ('.$list.')');
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'cms_category` WHERE `id_cms_category` IN ('.$list.')');
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'cms_category_lang` WHERE `id_cms_category` IN ('.$list.')');
|
||||
|
||||
self::cleanPositions($this->id_parent);
|
||||
|
||||
/* Delete pages which are in categories to delete */
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `id_cms`
|
||||
FROM `'._DB_PREFIX_.'cms`
|
||||
WHERE `id_cms_category` IN ('.$list.')');
|
||||
@@ -327,7 +327,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
if (!Validate::isBool($active))
|
||||
die(Tools::displayError());
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'cms_category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON c.`id_cms_category` = cl.`id_cms_category`
|
||||
@@ -346,7 +346,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
|
||||
public static function getSimpleCategories($id_lang)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.`id_cms_category`, cl.`name`
|
||||
FROM `'._DB_PREFIX_.'cms_category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category`)
|
||||
@@ -366,7 +366,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
if (!Validate::isBool($active))
|
||||
die(Tools::displayError());
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.*, cl.id_lang, cl.name, cl.description, cl.link_rewrite, cl.meta_title, cl.meta_keywords, cl.meta_description
|
||||
FROM `'._DB_PREFIX_.'cms_category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category` AND `id_lang` = '.(int)($id_lang).')
|
||||
@@ -411,7 +411,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
if (!Validate::isBool($active))
|
||||
die(Tools::displayError());
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.`id_cms_category`, cl.`name`, cl.`link_rewrite`
|
||||
FROM `'._DB_PREFIX_.'cms_category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON c.`id_cms_category` = cl.`id_cms_category`
|
||||
@@ -508,7 +508,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category`)
|
||||
WHERE `name` LIKE \''.pSQL($query).'\'');
|
||||
else
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT c.*, cl.*
|
||||
FROM `'._DB_PREFIX_.'cms_category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category` AND `id_lang` = '.(int)($id_lang).')
|
||||
@@ -557,7 +557,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category` AND `id_lang` = '.(int)$id_lang.')
|
||||
WHERE c.`id_cms_category` = '.(int)$idCurrent.' AND c.`id_parent` != 0
|
||||
';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($query);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
|
||||
$categories[] = $result[0];
|
||||
if(!$result OR $result[0]['id_parent'] == 1)
|
||||
@@ -568,7 +568,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
|
||||
public function updatePosition($way, $position)
|
||||
{
|
||||
if (!$res = Db::getInstance()->ExecuteS('
|
||||
if (!$res = Db::getInstance()->executeS('
|
||||
SELECT cp.`id_cms_category`, cp.`position`, cp.`id_parent`
|
||||
FROM `'._DB_PREFIX_.'cms_category` cp
|
||||
WHERE cp.`id_parent` = '.(int)$this->id_parent.'
|
||||
@@ -583,7 +583,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
return false;
|
||||
// < and > statements rather than BETWEEN operator
|
||||
// since BETWEEN is treated differently according to databases
|
||||
return (Db::getInstance()->Execute('
|
||||
return (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'cms_category`
|
||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||
WHERE `position`
|
||||
@@ -591,7 +591,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
? '> '.(int)($movedCategory['position']).' AND `position` <= '.(int)($position)
|
||||
: '< '.(int)($movedCategory['position']).' AND `position` >= '.(int)($position)).'
|
||||
AND `id_parent`='.(int)($movedCategory['id_parent']))
|
||||
AND Db::getInstance()->Execute('
|
||||
AND Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'cms_category`
|
||||
SET `position` = '.(int)($position).'
|
||||
WHERE `id_parent` = '.(int)($movedCategory['id_parent']).'
|
||||
@@ -600,7 +600,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
|
||||
public static function cleanPositions($id_category_parent)
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `id_cms_category`
|
||||
FROM `'._DB_PREFIX_.'cms_category`
|
||||
WHERE `id_parent` = '.(int)($id_category_parent).'
|
||||
@@ -612,7 +612,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
SET `position` = '.(int)($i).'
|
||||
WHERE `id_parent` = '.(int)($id_category_parent).'
|
||||
AND `id_cms_category` = '.(int)($result[$i]['id_cms_category']);
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -629,7 +629,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'lang` AS l ON c.`id_lang` = l.`id_lang`
|
||||
WHERE c.`id_cms_category` = '.(int)$id_category.'
|
||||
AND l.`active` = 1';
|
||||
$arr_return = Db::getInstance()->ExecuteS($sql);
|
||||
$arr_return = Db::getInstance()->executeS($sql);
|
||||
return $arr_return;
|
||||
}
|
||||
}
|
||||
|
||||
+21
-21
@@ -153,7 +153,7 @@ class CarrierCore extends ObjectModel
|
||||
{
|
||||
if (!parent::add($autodate, $nullValues) || !Validate::isLoadedObject($this))
|
||||
return false;
|
||||
if (!Db::getInstance()->ExecuteS('SELECT `id_carrier` FROM `'._DB_PREFIX_.$this->table.'` WHERE `deleted` = 0'))
|
||||
if (!Db::getInstance()->executeS('SELECT `id_carrier` FROM `'._DB_PREFIX_.$this->table.'` WHERE `deleted` = 0'))
|
||||
return false;
|
||||
if (!$numRows = Db::getInstance()->NumRows())
|
||||
return false;
|
||||
@@ -161,7 +161,7 @@ class CarrierCore extends ObjectModel
|
||||
Configuration::updateValue('PS_CARRIER_DEFAULT', (int)($this->id));
|
||||
|
||||
// Register reference
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.$this->table.'` SET `id_reference` = '.$this->id.' WHERE `id_carrier` = '.$this->id);
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.$this->table.'` SET `id_reference` = '.$this->id.' WHERE `id_carrier` = '.$this->id);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -173,7 +173,7 @@ class CarrierCore extends ObjectModel
|
||||
*/
|
||||
public function setConfiguration($id_old)
|
||||
{
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'delivery` SET `id_carrier` = '.(int)($this->id).' WHERE `id_carrier` = '.(int)($id_old));
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'delivery` SET `id_carrier` = '.(int)($this->id).' WHERE `id_carrier` = '.(int)($id_old));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,7 +235,7 @@ class CarrierCore extends ObjectModel
|
||||
AND d.`id_carrier` = '.(int)$this->id.'
|
||||
'.Carrier::sqlDeliveryRangeShop('range_weight', $shop).'
|
||||
ORDER BY w.`delimiter2` DESC LIMIT 1';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if (!isset($result[0]['price']))
|
||||
return false;
|
||||
return $result[0]['price'];
|
||||
@@ -315,7 +315,7 @@ class CarrierCore extends ObjectModel
|
||||
AND d.`id_carrier` = '.(int)$this->id.'
|
||||
'.Carrier::sqlDeliveryRangeShop('range_price', $shop).'
|
||||
ORDER BY r.`delimiter2` DESC LIMIT 1';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if (!isset($result[0]['price']))
|
||||
return false;
|
||||
return $result[0]['price'];
|
||||
@@ -338,7 +338,7 @@ class CarrierCore extends ObjectModel
|
||||
AND d.id_'.$rangeTable.' != 0
|
||||
'.Carrier::sqlDeliveryRangeShop($rangeTable, $shop).'
|
||||
ORDER BY r.delimiter1';
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -399,7 +399,7 @@ class CarrierCore extends ObjectModel
|
||||
$sql .= ($ids_group ? ' AND c.id_carrier IN (SELECT id_carrier FROM '._DB_PREFIX_.'carrier_group WHERE id_group IN ('.$ids.')) ' : '').'
|
||||
GROUP BY c.`id_carrier`';
|
||||
|
||||
$carriers = Db::getInstance()->ExecuteS($sql);
|
||||
$carriers = Db::getInstance()->executeS($sql);
|
||||
|
||||
if (is_array($carriers) && count($carriers))
|
||||
{
|
||||
@@ -418,12 +418,12 @@ class CarrierCore extends ObjectModel
|
||||
if (!Validate::isBool($activeCountries) || !Validate::isBool($activeCarriers))
|
||||
die(Tools::displayError());
|
||||
|
||||
$states = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$states = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT s.*
|
||||
FROM `'._DB_PREFIX_.'state` s
|
||||
ORDER BY s.`name` ASC');
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT cl.*,c.*, cl.`name` AS country, zz.`name` AS zone FROM `'._DB_PREFIX_.'country` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = 1)
|
||||
INNER JOIN (`'._DB_PREFIX_.'carrier_zone` cz INNER JOIN `'._DB_PREFIX_.'carrier` cr ON ( cr.id_carrier = cz.id_carrier AND cr.deleted = 0 '.($activeCarriers ?
|
||||
@@ -537,7 +537,7 @@ class CarrierCore extends ObjectModel
|
||||
|
||||
public static function checkCarrierZone($id_carrier, $id_zone)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.`id_carrier`
|
||||
FROM `'._DB_PREFIX_.'carrier` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'carrier_zone` cz ON (cz.`id_carrier` = c.`id_carrier`)
|
||||
@@ -557,7 +557,7 @@ class CarrierCore extends ObjectModel
|
||||
*/
|
||||
public function getZones()
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'carrier_zone` cz
|
||||
LEFT JOIN `'._DB_PREFIX_.'zone` z ON cz.`id_zone` = z.`id_zone`
|
||||
@@ -571,7 +571,7 @@ class CarrierCore extends ObjectModel
|
||||
*/
|
||||
public function getZone($id_zone)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'carrier_zone`
|
||||
WHERE `id_carrier` = '.(int)($this->id).'
|
||||
@@ -583,7 +583,7 @@ class CarrierCore extends ObjectModel
|
||||
*/
|
||||
public function addZone($id_zone)
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'carrier_zone` (`id_carrier` , `id_zone`)
|
||||
VALUES ('.(int)($this->id).', '.(int)($id_zone).')');
|
||||
}
|
||||
@@ -593,7 +593,7 @@ class CarrierCore extends ObjectModel
|
||||
*/
|
||||
public function deleteZone($id_zone)
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'carrier_zone`
|
||||
WHERE `id_carrier` = '.(int)($this->id).'
|
||||
AND `id_zone` = '.(int)($id_zone).' LIMIT 1');
|
||||
@@ -667,7 +667,7 @@ class CarrierCore extends ObjectModel
|
||||
$sql = rtrim($sql, ', ').'), ';
|
||||
}
|
||||
$sql = rtrim($sql, ', ');
|
||||
return Db::getInstance()->Execute($sql);
|
||||
return Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -692,12 +692,12 @@ class CarrierCore extends ObjectModel
|
||||
{
|
||||
$sql = 'SELECT id_'.$range.' id_range, delimiter1, delimiter2 FROM `'._DB_PREFIX_.$range.'`
|
||||
WHERE id_carrier = '.(int)$oldId;
|
||||
$res = Db::getInstance()->ExecuteS($sql);
|
||||
$res = Db::getInstance()->executeS($sql);
|
||||
foreach ($res as $val)
|
||||
{
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.$range.'` (`id_carrier`, `delimiter1`, `delimiter2`)
|
||||
VALUES ('.$this->id.','.(float)$val['delimiter1'].','.(float)$val['delimiter2'].')';
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
$rangeID = (int)Db::getInstance()->Insert_ID();
|
||||
|
||||
$rangePriceID = ($range == 'range_price') ? $rangeID : 'NULL';
|
||||
@@ -706,15 +706,15 @@ class CarrierCore extends ObjectModel
|
||||
SELECT '.$this->id.', '.$rangePriceID.', '.$rangeWeightID.', id_zone, price FROM '._DB_PREFIX_.'delivery
|
||||
WHERE id_carrier = '.(int)$oldId.' AND '.(($range == 'range_price') ? 'id_range_price' : 'id_range_weight').' = '.$val['id_range'];
|
||||
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy existing zones
|
||||
$res = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'carrier_zone`
|
||||
$res = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'carrier_zone`
|
||||
WHERE id_carrier = '.(int)$oldId);
|
||||
foreach ($res as $val)
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'carrier_zone` (`id_carrier`, `id_zone`)
|
||||
VALUES ('.$this->id.','.(int)$val['id_zone'].')');
|
||||
|
||||
@@ -724,7 +724,7 @@ class CarrierCore extends ObjectModel
|
||||
|
||||
// Copy reference
|
||||
$id_reference = Db::getInstance()->getValue('SELECT `id_reference` FROM `'._DB_PREFIX_.$this->table.'` WHERE id_carrier = '.$oldId);
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.$this->table.'`
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.$this->table.'`
|
||||
SET `id_reference` = '.$id_reference.'
|
||||
WHERE `id_carrier` = '.$this->id);
|
||||
}
|
||||
|
||||
+33
-33
@@ -188,7 +188,7 @@ class CartCore extends ObjectModel
|
||||
if ($this->OrderExists()) //NOT delete a cart which is associated with an order
|
||||
return false;
|
||||
|
||||
$uploadedFiles = Db::getInstance()->ExecuteS('
|
||||
$uploadedFiles = Db::getInstance()->executeS('
|
||||
SELECT cd.`value`
|
||||
FROM `'._DB_PREFIX_.'customized_data` cd
|
||||
INNER JOIN `'._DB_PREFIX_.'customization` c ON (cd.`id_customization`= c.`id_customization`)
|
||||
@@ -200,7 +200,7 @@ class CartCore extends ObjectModel
|
||||
unlink(_PS_UPLOAD_DIR_.$mustUnlink['value']);
|
||||
}
|
||||
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'customized_data`
|
||||
WHERE `id_customization` IN (
|
||||
SELECT `id_customization`
|
||||
@@ -208,12 +208,12 @@ class CartCore extends ObjectModel
|
||||
WHERE `id_cart`='.(int)$this->id.'
|
||||
)');
|
||||
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'customization`
|
||||
WHERE `id_cart` = '.(int)$this->id);
|
||||
|
||||
if (!Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cart_discount` WHERE `id_cart` = '.(int)($this->id))
|
||||
OR !Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cart_product` WHERE `id_cart` = '.(int)($this->id)))
|
||||
if (!Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'cart_discount` WHERE `id_cart` = '.(int)($this->id))
|
||||
OR !Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'cart_product` WHERE `id_cart` = '.(int)($this->id)))
|
||||
return false;
|
||||
|
||||
return parent::delete();
|
||||
@@ -272,7 +272,7 @@ class CartCore extends ObjectModel
|
||||
return self::$_discountsLite[$this->id];
|
||||
}
|
||||
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT d.*, `id_cart`
|
||||
FROM `'._DB_PREFIX_.'cart_discount` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'discount` d ON c.`id_discount` = d.`id_discount`
|
||||
@@ -429,7 +429,7 @@ class CartCore extends ObjectModel
|
||||
$sql->select('p.`reference` AS reference, p.`supplier_reference` AS supplier_reference, p.`ean13`, p.`upc` AS upc, p.`minimal_quantity` AS minimal_quantity');
|
||||
|
||||
|
||||
$result = Db::getInstance()->ExecuteS($sql);
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
|
||||
// Reset the cache before the following return, or else an empty cart will add dozens of queries
|
||||
$productsIds = array();
|
||||
@@ -521,7 +521,7 @@ class CartCore extends ObjectModel
|
||||
if (!count($paImplode))
|
||||
return;
|
||||
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT pac.`id_product_attribute`, agl.`public_name` AS public_group_name, al.`name` AS attribute_name
|
||||
FROM `'._DB_PREFIX_.'product_attribute_combination` pac
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
|
||||
@@ -661,7 +661,7 @@ class CartCore extends ObjectModel
|
||||
elseif ($newQty < $minimalQuantity)
|
||||
return -1;
|
||||
else
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'cart_product`
|
||||
SET `quantity` = `quantity` '.$qty.', `date_add` = NOW()
|
||||
WHERE `id_product` = '.(int)$id_product.
|
||||
@@ -720,7 +720,7 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
if ($field['quantity'] == 0)
|
||||
{
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'customization`
|
||||
SET `quantity` = '.(int)($quantity).',
|
||||
`id_product_attribute` = '.(int)$id_product_attribute.',
|
||||
@@ -740,8 +740,8 @@ class CartCore extends ObjectModel
|
||||
if ($result AND Db::getInstance()->NumRows())
|
||||
{
|
||||
if ($operator == 'down' AND (int)($result['quantity']) - (int)($quantity) < 1)
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization` WHERE `id_customization` = '.(int)$id_customization);
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customization` WHERE `id_customization` = '.(int)$id_customization);
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'customization`
|
||||
SET `quantity` = `quantity` '.($operator == 'up' ? '+ ' : '- ').(int)($quantity).'
|
||||
WHERE `id_customization` = '.(int)($id_customization));
|
||||
@@ -766,7 +766,7 @@ class CartCore extends ObjectModel
|
||||
*/
|
||||
public function _addCustomization($id_product, $id_product_attribute, $index, $type, $field, $quantity)
|
||||
{
|
||||
$exising_customization = Db::getInstance()->ExecuteS('
|
||||
$exising_customization = Db::getInstance()->executeS('
|
||||
SELECT cu.`id_customization`, cd.`index`, cd.`value`, cd.`type` FROM `'._DB_PREFIX_.'customization` cu
|
||||
LEFT JOIN `'._DB_PREFIX_.'customized_data` cd
|
||||
ON cu.`id_customization` = cd.`id_customization`
|
||||
@@ -781,7 +781,7 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
if ($customization['type'] == $type && $customization['index'] == $index)
|
||||
{
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'customized_data`
|
||||
WHERE id_customization = '.(int)$customization['id_customization'].'
|
||||
AND type = '.(int)$customization['type'].'
|
||||
@@ -798,13 +798,13 @@ class CartCore extends ObjectModel
|
||||
}
|
||||
else
|
||||
{
|
||||
Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'customization` (`id_cart`, `id_product`, `id_product_attribute`, `quantity`) VALUES ('.(int)($this->id).', '.(int)($id_product).', '.(int)($id_product_attribute).', '.(int)($quantity).')');
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'customization` (`id_cart`, `id_product`, `id_product_attribute`, `quantity`) VALUES ('.(int)($this->id).', '.(int)($id_product).', '.(int)($id_product_attribute).', '.(int)($quantity).')');
|
||||
$id_customization = Db::getInstance()->Insert_ID();
|
||||
}
|
||||
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'customized_data` (`id_customization`, `type`, `index`, `value`) VALUES ('.(int)$id_customization.', '.(int)$type.', '.(int)$index.', \''.pSql($field).'\')';
|
||||
|
||||
if (!Db::getInstance()->Execute($query))
|
||||
if (!Db::getInstance()->execute($query))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -831,7 +831,7 @@ class CartCore extends ObjectModel
|
||||
*/
|
||||
public function deleteDiscount($id_discount)
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cart_discount` WHERE `id_discount` = '.(int)$id_discount.' AND `id_cart` = '.(int)$this->id.' LIMIT 1');
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'cart_discount` WHERE `id_discount` = '.(int)$id_discount.' AND `id_cart` = '.(int)$this->id.' LIMIT 1');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -877,7 +877,7 @@ class CartCore extends ObjectModel
|
||||
|
||||
/* If the product still possesses customization it does not have to be deleted */
|
||||
if (Db::getInstance()->NumRows() AND (int)($result['quantity']))
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'cart_product`
|
||||
SET `quantity` = '.(int)($result['quantity']).'
|
||||
WHERE `id_cart` = '.(int)($this->id).'
|
||||
@@ -885,7 +885,7 @@ class CartCore extends ObjectModel
|
||||
($id_product_attribute != NULL ? ' AND `id_product_attribute` = '.(int)($id_product_attribute) : ''));
|
||||
|
||||
/* Product deletion */
|
||||
if (Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cart_product` WHERE `id_product` = '.(int)($id_product).(!is_null($id_product_attribute) ? ' AND `id_product_attribute` = '.(int)($id_product_attribute) : '').' AND `id_cart` = '.(int)($this->id)))
|
||||
if (Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'cart_product` WHERE `id_product` = '.(int)($id_product).(!is_null($id_product_attribute) ? ' AND `id_product_attribute` = '.(int)($id_product_attribute) : '').' AND `id_cart` = '.(int)($this->id)))
|
||||
{
|
||||
// refresh cache of self::_products
|
||||
$this->_products = $this->getProducts(true);
|
||||
@@ -924,7 +924,7 @@ class CartCore extends ObjectModel
|
||||
WHERE `id_customization` = '.(int)($id_customization));
|
||||
|
||||
if($result)
|
||||
$result &= Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'cart_product`
|
||||
$result &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'cart_product`
|
||||
SET `quantity` = `quantity` - '.(int)($customization['quantity']).'
|
||||
WHERE `id_cart` = '.(int)($this->id).'
|
||||
AND `id_product` = '.(int)($id_product).((int)($id_product_attribute) ? '
|
||||
@@ -933,7 +933,7 @@ class CartCore extends ObjectModel
|
||||
if (!$result)
|
||||
return false;
|
||||
|
||||
return Db::getInstance()->Execute('DELETE
|
||||
return Db::getInstance()->execute('DELETE
|
||||
FROM `'._DB_PREFIX_.'customization`
|
||||
WHERE `id_customization` = '.(int)($id_customization));
|
||||
}
|
||||
@@ -1533,13 +1533,13 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
if (!ProductDownload::isFeatureActive())
|
||||
return false;
|
||||
|
||||
|
||||
if (!isset(self::$_isVirtualCart[$this->id]))
|
||||
{
|
||||
$products = $this->getProducts();
|
||||
if (!sizeof($products))
|
||||
return false;
|
||||
|
||||
|
||||
$is_virtual = 1;
|
||||
foreach ($products AS $product)
|
||||
{
|
||||
@@ -1548,10 +1548,10 @@ class CartCore extends ObjectModel
|
||||
}
|
||||
self::$_isVirtualCart[$this->id] = (int) $is_virtual;
|
||||
}
|
||||
|
||||
|
||||
return self::$_isVirtualCart[$this->id];
|
||||
}
|
||||
|
||||
|
||||
public static function getCartByOrderId($id_order)
|
||||
{
|
||||
if ($id_cart = self::getCartIdByOrderId($id_order))
|
||||
@@ -1634,7 +1634,7 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
if (!Customization::isFeatureActive())
|
||||
return array();
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT cu.id_customization, cd.index, cd.value, cd.type, cu.in_cart, cu.quantity
|
||||
FROM `'._DB_PREFIX_.'customization` cu
|
||||
LEFT JOIN `'._DB_PREFIX_.'customized_data` cd ON (cu.`id_customization` = cd.`id_customization`)
|
||||
@@ -1649,7 +1649,7 @@ class CartCore extends ObjectModel
|
||||
|
||||
public static function getCustomerCarts($id_customer)
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM '._DB_PREFIX_.'cart c
|
||||
WHERE c.`id_customer` = '.(int)($id_customer).'
|
||||
@@ -1676,13 +1676,13 @@ class CartCore extends ObjectModel
|
||||
if (!Validate::isLoadedObject($cart))
|
||||
return false;
|
||||
$success = true;
|
||||
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'cart_product` WHERE `id_cart` = '.(int)$this->id);
|
||||
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT * FROM `'._DB_PREFIX_.'cart_product` WHERE `id_cart` = '.(int)$this->id);
|
||||
|
||||
foreach ($products AS $product)
|
||||
$success &= $cart->updateQty($product['quantity'], (int)$product['id_product'], (int)$product['id_product_attribute'], NULL, 'up', new Shop($cart->id_shop));
|
||||
|
||||
// Customized products
|
||||
$customs = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$customs = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM '._DB_PREFIX_.'customization c
|
||||
LEFT JOIN '._DB_PREFIX_.'customized_data cd ON cd.id_customization = c.id_customization
|
||||
@@ -1701,7 +1701,7 @@ class CartCore extends ObjectModel
|
||||
$custom_ids = array();
|
||||
foreach($customsById as $customizationId => $val)
|
||||
{
|
||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->Execute('
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'customization` (id_cart, id_product_attribute, id_product, quantity)
|
||||
VALUES('.(int)$cart->id.', '.(int)$val['id_product_attribute'].', '.(int)$val['id_product'].', '.(int)$val['quantity'].')');
|
||||
$custom_ids[$customizationId] = Db::getInstance(_PS_USE_SQL_SLAVE_)->Insert_ID();
|
||||
@@ -1720,7 +1720,7 @@ class CartCore extends ObjectModel
|
||||
$first = false;
|
||||
$sql_custom_data .= '('.(int)$custom_ids[$custom['id_customization']].', '.(int)$custom['type'].', '.(int)$custom['index'].', \''.pSQL($custom['value']).'\')';
|
||||
}
|
||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->Execute($sql_custom_data);
|
||||
Db::getInstance()->execute($sql_custom_data);
|
||||
}
|
||||
|
||||
return array('cart' => $cart, 'success' => $success);
|
||||
@@ -1742,14 +1742,14 @@ class CartCore extends ObjectModel
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'cart_product`(`id_cart`, `id_product`, `id_product_attribute`, `quantity`, `date_add`) VALUES ';
|
||||
foreach ($values as $value)
|
||||
$query .= '('.(int)$this->id.', '.(int)$value['id_product'].', '.(isset($value['id_product_attribute']) ? (int)$value['id_product_attribute'] : 'NULL').', '.(int)$value['quantity'].', NOW()),';
|
||||
Db::getInstance()->Execute(rtrim($query, ','));
|
||||
Db::getInstance()->execute(rtrim($query, ','));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deleteAssociations()
|
||||
{
|
||||
return (Db::getInstance()->Execute('
|
||||
return (Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'cart_product`
|
||||
WHERE `id_cart` = '.(int)($this->id)) !== false);
|
||||
}
|
||||
|
||||
+35
-35
@@ -269,7 +269,7 @@ class CategoryCore extends ObjectModel
|
||||
if (!is_array($toDelete) OR !$id_category)
|
||||
die(Tools::displayError());
|
||||
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `id_category`
|
||||
FROM `'._DB_PREFIX_.'category`
|
||||
WHERE `id_parent` = '.(int)($id_category));
|
||||
@@ -293,10 +293,10 @@ class CategoryCore extends ObjectModel
|
||||
|
||||
/* Delete category and its child from database */
|
||||
$list = sizeof($toDelete) > 1 ? implode(',', array_map('intval',$toDelete)) : (int)($this->id);
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category` WHERE `id_category` IN ('.$list.')');
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category_lang` WHERE `id_category` IN ('.$list.')');
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category_product` WHERE `id_category` IN ('.$list.')');
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` IN ('.$list.')');
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category` WHERE `id_category` IN ('.$list.')');
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_lang` WHERE `id_category` IN ('.$list.')');
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_product` WHERE `id_category` IN ('.$list.')');
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` IN ('.$list.')');
|
||||
|
||||
self::cleanPositions($this->id_parent);
|
||||
|
||||
@@ -309,7 +309,7 @@ class CategoryCore extends ObjectModel
|
||||
}
|
||||
|
||||
/* Delete products which were not in others categories */
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `id_product`
|
||||
FROM `'._DB_PREFIX_.'product`
|
||||
WHERE `id_product` NOT IN (SELECT `id_product` FROM `'._DB_PREFIX_.'category_product`)');
|
||||
@@ -321,7 +321,7 @@ class CategoryCore extends ObjectModel
|
||||
}
|
||||
|
||||
/* Set category default to 1 where categorie no more exists */
|
||||
$result = Db::getInstance()->Execute('
|
||||
$result = Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'product`
|
||||
SET `id_category_default` = 1
|
||||
WHERE `id_category_default`
|
||||
@@ -379,7 +379,7 @@ class CategoryCore extends ObjectModel
|
||||
*/
|
||||
public static function regenerateEntireNtree()
|
||||
{
|
||||
$categories = Db::getInstance()->ExecuteS('SELECT id_category, id_parent FROM '._DB_PREFIX_.'category ORDER BY id_category ASC');
|
||||
$categories = Db::getInstance()->executeS('SELECT id_category, id_parent FROM '._DB_PREFIX_.'category ORDER BY id_category ASC');
|
||||
$categoriesArray = array();
|
||||
foreach ($categories AS $category)
|
||||
$categoriesArray[(int)$category['id_parent']]['subcategories'][(int)$category['id_category']] = 1;
|
||||
@@ -395,7 +395,7 @@ class CategoryCore extends ObjectModel
|
||||
self::_subTree($categories, (int)$id_subcategory, $n);
|
||||
$right = (int)$n++;
|
||||
|
||||
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'category SET nleft = '.(int)$left.', nright = '.(int)$right.' WHERE id_category = '.(int)$id_category.' LIMIT 1');
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'category SET nleft = '.(int)$left.', nright = '.(int)$right.' WHERE id_category = '.(int)$id_category.' LIMIT 1');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -406,7 +406,7 @@ class CategoryCore extends ObjectModel
|
||||
public function recalculateLevelDepth($id_category)
|
||||
{
|
||||
/* Gets all children */
|
||||
$categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT id_category, id_parent, level_depth
|
||||
FROM '._DB_PREFIX_.'category
|
||||
WHERE id_parent = '.(int)$id_category);
|
||||
@@ -418,7 +418,7 @@ class CategoryCore extends ObjectModel
|
||||
/* Updates level_depth for all children */
|
||||
foreach ($categories as $sub_category)
|
||||
{
|
||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->Execute('
|
||||
Db::getInstance()->execute('
|
||||
UPDATE '._DB_PREFIX_.'category
|
||||
SET level_depth = '.(int)($level['level_depth'] + 1).'
|
||||
WHERE id_category = '.(int)$sub_category['id_category']);
|
||||
@@ -438,7 +438,7 @@ class CategoryCore extends ObjectModel
|
||||
{
|
||||
if (!Validate::isBool($active))
|
||||
die(Tools::displayError());
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').'
|
||||
@@ -461,7 +461,7 @@ class CategoryCore extends ObjectModel
|
||||
|
||||
public static function getSimpleCategories($id_lang)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.`id_category`, cl.`name`
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').')
|
||||
@@ -485,7 +485,7 @@ class CategoryCore extends ObjectModel
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sqlGroups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.*, cl.id_lang, cl.name, cl.description, cl.link_rewrite, cl.meta_title, cl.meta_keywords, cl.meta_description
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('cl').')
|
||||
@@ -597,7 +597,7 @@ class CategoryCore extends ObjectModel
|
||||
$sql .= ' ORDER BY '.(isset($orderByPrefix) ? $orderByPrefix.'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||
LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n);
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if ($orderBy == 'orderprice')
|
||||
Tools::orderbyPrice($result, $orderWay);
|
||||
|
||||
@@ -642,7 +642,7 @@ class CategoryCore extends ObjectModel
|
||||
if (!Validate::isBool($active))
|
||||
die(Tools::displayError());
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').'
|
||||
@@ -659,7 +659,7 @@ class CategoryCore extends ObjectModel
|
||||
*/
|
||||
public function getAllChildren()
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'category`
|
||||
WHERE '. $this->nleft . ' < nleft AND nright < '. $this->nright);
|
||||
@@ -695,7 +695,7 @@ class CategoryCore extends ObjectModel
|
||||
WHERE `id_lang` = '.(int)($id_lang).'
|
||||
AND c.`id_parent` = '.(int)($id_parent).'
|
||||
ORDER BY `position` ASC';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -710,14 +710,14 @@ class CategoryCore extends ObjectModel
|
||||
$sql = 'SELECT `id_category`
|
||||
FROM `'._DB_PREFIX_.'category_product`
|
||||
WHERE `id_product` = '.(int)$id_old;
|
||||
$result = Db::getInstance()->ExecuteS($sql);
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
|
||||
$row = array();
|
||||
if ($result)
|
||||
foreach ($result AS $i)
|
||||
$row[] = '('.implode(', ', array((int)($id_new), $i['id_category'], '(SELECT tmp.max + 1 FROM (SELECT MAX(cp.`position`) AS max FROM `'._DB_PREFIX_.'category_product` cp WHERE cp.`id_category`='.(int)($i['id_category']).') AS tmp)')).')';
|
||||
|
||||
$flag = Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'category_product` (`id_product`, `id_category`, `position`) VALUES '.implode(',', $row));
|
||||
$flag = Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'category_product` (`id_product`, `id_category`, `position`) VALUES '.implode(',', $row));
|
||||
return $flag;
|
||||
}
|
||||
|
||||
@@ -799,7 +799,7 @@ class CategoryCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').')
|
||||
WHERE `name` LIKE \''.pSQL($query).'\'');
|
||||
else
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT c.*, cl.*
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('cl').')
|
||||
@@ -840,7 +840,7 @@ class CategoryCore extends ObjectModel
|
||||
$idCurrent = $this->id;
|
||||
while (true)
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.*, cl.*
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('cl').')
|
||||
@@ -872,7 +872,7 @@ class CategoryCore extends ObjectModel
|
||||
|
||||
public function cleanGroups()
|
||||
{
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` = '.(int)($this->id));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
public function addGroups($groups)
|
||||
@@ -887,7 +887,7 @@ class CategoryCore extends ObjectModel
|
||||
public function getGroups()
|
||||
{
|
||||
$groups = array();
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT cg.`id_group`
|
||||
FROM '._DB_PREFIX_.'category_group cg
|
||||
WHERE cg.`id_category` = '.(int)($this->id));
|
||||
@@ -948,7 +948,7 @@ class CategoryCore extends ObjectModel
|
||||
{
|
||||
if (!(int)($id_group))
|
||||
return false;
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'category_group`
|
||||
VALUES (1, '.(int)($id_group).')
|
||||
');
|
||||
@@ -956,7 +956,7 @@ class CategoryCore extends ObjectModel
|
||||
|
||||
public function updatePosition($way, $position)
|
||||
{
|
||||
if (!$res = Db::getInstance()->ExecuteS('
|
||||
if (!$res = Db::getInstance()->executeS('
|
||||
SELECT cp.`id_category`, cp.`position`, cp.`id_parent`
|
||||
FROM `'._DB_PREFIX_.'category` cp
|
||||
WHERE cp.`id_parent` = '.(int)$this->id_parent.'
|
||||
@@ -972,7 +972,7 @@ class CategoryCore extends ObjectModel
|
||||
return false;
|
||||
// < and > statements rather than BETWEEN operator
|
||||
// since BETWEEN is treated differently according to databases
|
||||
$result = (Db::getInstance()->Execute('
|
||||
$result = (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'category`
|
||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||
WHERE `position`
|
||||
@@ -980,7 +980,7 @@ class CategoryCore extends ObjectModel
|
||||
? '> '.(int)($movedCategory['position']).' AND `position` <= '.(int)($position)
|
||||
: '< '.(int)($movedCategory['position']).' AND `position` >= '.(int)($position)).'
|
||||
AND `id_parent`='.(int)($movedCategory['id_parent']))
|
||||
AND Db::getInstance()->Execute('
|
||||
AND Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'category`
|
||||
SET `position` = '.(int)($position).'
|
||||
WHERE `id_parent` = '.(int)($movedCategory['id_parent']).'
|
||||
@@ -1001,7 +1001,7 @@ class CategoryCore extends ObjectModel
|
||||
{
|
||||
$return = true;
|
||||
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `id_category`
|
||||
FROM `'._DB_PREFIX_.'category`
|
||||
WHERE `id_parent` = '.(int)($id_category_parent).'
|
||||
@@ -1013,7 +1013,7 @@ class CategoryCore extends ObjectModel
|
||||
SET `position` = '.(int)($i).'
|
||||
WHERE `id_parent` = '.(int)($id_category_parent).'
|
||||
AND `id_category` = '.(int)($result[$i]['id_category']);
|
||||
$return &= Db::getInstance()->Execute($sql);
|
||||
$return &= Db::getInstance()->execute($sql);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
@@ -1031,7 +1031,7 @@ class CategoryCore extends ObjectModel
|
||||
|
||||
public static function getUrlRewriteInformations($id_category)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT l.`id_lang`, c.`link_rewrite`
|
||||
FROM `'._DB_PREFIX_.'category_lang` AS c
|
||||
LEFT JOIN `'._DB_PREFIX_.'lang` AS l ON c.`id_lang` = l.`id_lang`
|
||||
@@ -1076,7 +1076,7 @@ class CategoryCore extends ObjectModel
|
||||
|
||||
public function getChildrenWs()
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.`id_category` as id
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
WHERE c.`id_parent` = '.(int)($this->id).'
|
||||
@@ -1087,7 +1087,7 @@ class CategoryCore extends ObjectModel
|
||||
|
||||
public function getProductsWs()
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT cp.`id_product` as id
|
||||
FROM `'._DB_PREFIX_.'category_product` cp
|
||||
WHERE cp.`id_category` = '.(int)($this->id).'
|
||||
@@ -1112,7 +1112,7 @@ class CategoryCore extends ObjectModel
|
||||
|
||||
public function getWsNbProductsRecursive()
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT count(distinct(id_product)) as nb_product_recursive FROM `'._DB_PREFIX_.'category_product`
|
||||
WHERE id_category IN (SELECT id_category
|
||||
FROM `'._DB_PREFIX_.'category`
|
||||
@@ -1138,7 +1138,7 @@ class CategoryCore extends ObjectModel
|
||||
return;
|
||||
|
||||
$categories = array();
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, cl.`id_lang`
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').')
|
||||
|
||||
@@ -125,7 +125,7 @@ class CombinationCore extends ObjectModel
|
||||
public function deleteAssociations()
|
||||
{
|
||||
if (
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||
WHERE `id_product_attribute` = '.(int)($this->id)) === false
|
||||
)
|
||||
@@ -140,7 +140,7 @@ class CombinationCore extends ObjectModel
|
||||
$sqlValues = array();
|
||||
foreach ($values as $value)
|
||||
$sqlValues[] = '('.(int)$value['id'].', '.(int)$this->id.')';
|
||||
$result = Db::getInstance()->Execute('
|
||||
$result = Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'product_attribute_combination` (`id_attribute`, `id_product_attribute`)
|
||||
VALUES '.implode(',', $sqlValues)
|
||||
);
|
||||
@@ -157,7 +157,7 @@ class CombinationCore extends ObjectModel
|
||||
|
||||
public function getWsImages()
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT `id_image` as id
|
||||
FROM `'._DB_PREFIX_.'product_attribute_image`
|
||||
WHERE `id_product_attribute` = '.(int)($this->id).'
|
||||
@@ -166,14 +166,14 @@ class CombinationCore extends ObjectModel
|
||||
|
||||
public function setWsImages($values)
|
||||
{
|
||||
if (Db::getInstance()->Execute('
|
||||
if (Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'product_attribute_image`
|
||||
WHERE `id_product_attribute` = '.(int)($this->id)) === false)
|
||||
return false;
|
||||
$sqlValues = array();
|
||||
foreach ($values as $value)
|
||||
$sqlValues[] = '('.(int)$this->id.', '.(int)$value['id'].')';
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'product_attribute_image` (`id_product_attribute`, `id_image`)
|
||||
VALUES '.implode(',', $sqlValues)
|
||||
);
|
||||
|
||||
@@ -62,7 +62,7 @@ class CompareProductCore extends ObjectModel
|
||||
*/
|
||||
public static function getGuestCompareProducts($id_guest)
|
||||
{
|
||||
$results = Db::getInstance()->ExecuteS('
|
||||
$results = Db::getInstance()->executeS('
|
||||
SELECT DISTINCT `id_product`
|
||||
FROM `'._DB_PREFIX_.'compare_product`
|
||||
WHERE `id_guest` = '.(int)($id_guest));
|
||||
@@ -84,7 +84,7 @@ class CompareProductCore extends ObjectModel
|
||||
*/
|
||||
public static function addGuestCompareProduct($id_guest, $id_product)
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'compare_product` (`id_product`, `id_guest`, `id_customer`, `date_add`, `date_upd`)
|
||||
VALUES ('.(int)($id_product).', '.(int)($id_guest).', 0, NOW(), NOW())
|
||||
');
|
||||
@@ -98,7 +98,7 @@ class CompareProductCore extends ObjectModel
|
||||
*/
|
||||
public static function removeGuestCompareProduct($id_guest, $id_product)
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'compare_product` WHERE `id_guest` = '.(int)($id_guest).' AND `id_product` = '.(int)($id_product));
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'compare_product` WHERE `id_guest` = '.(int)($id_guest).' AND `id_product` = '.(int)($id_product));
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ class CompareProductCore extends ObjectModel
|
||||
*/
|
||||
public static function getCustomerCompareProducts($id_customer)
|
||||
{
|
||||
$results = Db::getInstance()->ExecuteS('
|
||||
$results = Db::getInstance()->executeS('
|
||||
SELECT DISTINCT `id_product`
|
||||
FROM `'._DB_PREFIX_.'compare_product`
|
||||
WHERE `id_customer` = '.(int)($id_customer));
|
||||
@@ -145,7 +145,7 @@ class CompareProductCore extends ObjectModel
|
||||
*/
|
||||
public static function addCustomerCompareProduct($id_customer, $id_product)
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'compare_product` (`id_product`, `id_guest`, `id_customer`, `date_add`, `date_upd`)
|
||||
VALUES ('.(int)($id_product).', 0, '.(int)($id_customer).', NOW(), NOW())');
|
||||
}
|
||||
@@ -158,7 +158,7 @@ class CompareProductCore extends ObjectModel
|
||||
*/
|
||||
public static function removeCustomerCompareProduct($id_customer, $id_product)
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'compare_product` WHERE `id_customer` = '.(int)($id_customer).' AND `id_product` = '.(int)($id_product));
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'compare_product` WHERE `id_customer` = '.(int)($id_customer).' AND `id_product` = '.(int)($id_product));
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ class CompareProductCore extends ObjectModel
|
||||
|
||||
if ($interval != null)
|
||||
{
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'compare_product`
|
||||
WHERE date_upd < DATE_SUB(NOW(), INTERVAL '.pSQL($interval).')');
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class ConfigurationCore extends ObjectModel
|
||||
$sql = 'SELECT c.`name`, cl.`id_lang`, IF(cl.`id_lang` IS NULL, c.`value`, cl.`value`) AS value, c.id_group_shop, c.id_shop
|
||||
FROM `'._DB_PREFIX_.'configuration` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'configuration_lang` cl ON (c.id_configuration = cl.id_configuration)';
|
||||
if (!$results = Db::getInstance()->ExecuteS($sql))
|
||||
if (!$results = Db::getInstance()->executeS($sql))
|
||||
return;
|
||||
|
||||
foreach ($results as $row)
|
||||
@@ -307,7 +307,7 @@ class ConfigurationCore extends ObjectModel
|
||||
WHERE c.name = \''.pSQL($key).'\''
|
||||
.Configuration::sqlRestriction($shopGroupID, $shopID)
|
||||
.')';
|
||||
$result &= Db::getInstance()->Execute($sql);
|
||||
$result &= Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
// If key does not exists, create it
|
||||
@@ -361,11 +361,11 @@ class ConfigurationCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'configuration`
|
||||
WHERE `name` = \''.pSQL($key).'\'
|
||||
)';
|
||||
$result = Db::getInstance()->Execute($sql);
|
||||
$result = Db::getInstance()->execute($sql);
|
||||
|
||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'configuration`
|
||||
WHERE `name` = \''.pSQL($key).'\'';
|
||||
$result2 = Db::getInstance()->Execute($sql);
|
||||
$result2 = Db::getInstance()->execute($sql);
|
||||
return ($result && $result2);
|
||||
}
|
||||
|
||||
@@ -383,11 +383,11 @@ class ConfigurationCore extends ObjectModel
|
||||
$id = Configuration::getIdByName($key, $shopGroupID, $shopID);
|
||||
$sql = 'DELETE FROM '._DB_PREFIX_.'configuration
|
||||
WHERE id_configuration = '.$id;
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
|
||||
$sql = 'DELETE FROM '._DB_PREFIX_.'configuration_lang
|
||||
WHERE id_configuration = '.$id;
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -495,6 +495,6 @@ class ConfigurationCore extends ObjectModel
|
||||
'.($sql_sort != '' ? $sql_sort : '').'
|
||||
'.($sql_limit != '' ? $sql_limit : '').'
|
||||
';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($query);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ class ConnectionCore extends ObjectModel
|
||||
// Limited to 5 minutes because more than 5 minutes is considered as an error
|
||||
if ($time > 300000)
|
||||
$time = 300000;
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'connections_page`
|
||||
SET `time_end` = `time_start` + INTERVAL '.(int)($time / 1000).' SECOND
|
||||
WHERE `id_connections` = '.(int)($id_connections).'
|
||||
@@ -177,7 +177,7 @@ class ConnectionCore extends ObjectModel
|
||||
if ($interval != null)
|
||||
{
|
||||
// Records of connections details older than the beginning of the specified interval are deleted
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'connections_page`
|
||||
WHERE time_start < LAST_DAY(DATE_SUB(NOW(), INTERVAL '.$interval.'))');
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ class ConnectionsSourceCore extends ObjectModel
|
||||
|
||||
public static function getOrderSources($id_order)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT cos.http_referer, cos.request_uri, cos.keywords, cos.date_add
|
||||
FROM '._DB_PREFIX_.'orders o
|
||||
INNER JOIN '._DB_PREFIX_.'guest g ON g.id_customer = o.id_customer
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ class ContactCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (c.`id_contact` = cl.`id_contact`)
|
||||
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
||||
ORDER BY `name` ASC';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -126,7 +126,7 @@ class CountryCore extends ObjectModel
|
||||
if (!$shop)
|
||||
$shop = Context::getContext()->shop;
|
||||
|
||||
$states = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$states = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT s.*
|
||||
FROM `'._DB_PREFIX_.'state` s
|
||||
ORDER BY s.`name` ASC');
|
||||
@@ -140,7 +140,7 @@ class CountryCore extends ObjectModel
|
||||
.($active ? ' AND c.active = 1' : '')
|
||||
.(!is_null($containStates) ? ' AND c.`contains_states` = '.(int)($containStates) : '').'
|
||||
ORDER BY cl.name ASC';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
$countries = array();
|
||||
foreach ($result AS &$country)
|
||||
$countries[$country['id_country']] = $country;
|
||||
@@ -295,7 +295,7 @@ class CountryCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country`)
|
||||
WHERE (c.`id_zone` = '.(int)$id_zone.' OR s.`id_zone` = '.(int)$id_zone.')
|
||||
AND `id_lang` = '.(int)$id_lang;
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
public function isNeedDni()
|
||||
|
||||
@@ -190,7 +190,7 @@ class CurrencyCore extends ObjectModel
|
||||
WHERE `deleted` = 0'
|
||||
.($active == 1 ? ' AND c.`active` = 1' : '').'
|
||||
ORDER BY `name` ASC';
|
||||
$tab = Db::getInstance()->ExecuteS($sql);
|
||||
$tab = Db::getInstance()->executeS($sql);
|
||||
if ($object)
|
||||
foreach ($tab as $key => $currency)
|
||||
$tab[$key] = Currency::getCurrencyInstance($currency['id_currency']);
|
||||
@@ -222,7 +222,7 @@ class CurrencyCore extends ObjectModel
|
||||
AND c.`active` = 1
|
||||
AND mc.id_shop = '.(int)$id_shop.'
|
||||
ORDER BY c.`name` ASC';
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
static public function checkPaymentCurrencies($id_module, $id_shop = null)
|
||||
@@ -234,7 +234,7 @@ class CurrencyCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'module_currency`
|
||||
WHERE `id_module` = '.(int)$id_module.'
|
||||
AND `id_shop` = '.(int)$id_shop;
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
|
||||
public static function getCurrency($id_currency)
|
||||
|
||||
@@ -198,7 +198,7 @@ class CustomerCore extends ObjectModel
|
||||
$obj = new Address((int)($address['id_address']));
|
||||
$obj->delete();
|
||||
}
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customer_group` WHERE `id_customer` = '.(int)($this->id));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customer_group` WHERE `id_customer` = '.(int)($this->id));
|
||||
Discount::deleteByIdCustomer((int)($this->id));
|
||||
return parent::delete();
|
||||
}
|
||||
@@ -217,7 +217,7 @@ class CustomerCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE 1 '.$shop->sqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
ORDER BY `id_customer` ASC';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -344,7 +344,7 @@ class CustomerCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'state` s ON (s.`id_state` = a.`id_state`)
|
||||
WHERE `id_lang` = '.(int)($id_lang).' AND `id_customer` = '.(int)($this->id).' AND a.`deleted` = 0';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -399,7 +399,7 @@ class CustomerCore extends ObjectModel
|
||||
OR `lastname` LIKE \'%'.pSQL($query).'%\'
|
||||
OR `firstname` LIKE \'%'.pSQL($query).'%\'
|
||||
)'.$shop->sqlRestriction(Shop::SHARE_CUSTOMER);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -433,7 +433,7 @@ class CustomerCore extends ObjectModel
|
||||
|
||||
public function getLastConnections()
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.date_add, COUNT(cp.id_page) AS pages, TIMEDIFF(MAX(cp.time_end), c.date_add) as time, http_referer,INET_NTOA(ip_address) as ipaddress
|
||||
FROM `'._DB_PREFIX_.'guest` g
|
||||
LEFT JOIN `'._DB_PREFIX_.'connections` c ON c.id_guest = g.id_guest
|
||||
@@ -468,7 +468,7 @@ class CustomerCore extends ObjectModel
|
||||
|
||||
public function cleanGroups()
|
||||
{
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customer_group` WHERE `id_customer` = '.(int)($this->id));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customer_group` WHERE `id_customer` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
public function addGroups($groups)
|
||||
@@ -488,7 +488,7 @@ class CustomerCore extends ObjectModel
|
||||
if (!isset(self::$_customer_groups[$id_customer]))
|
||||
{
|
||||
self::$_customer_groups[$id_customer] = array();
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT cg.`id_group`
|
||||
FROM '._DB_PREFIX_.'customer_group cg
|
||||
WHERE cg.`id_customer` = '.(int)$id_customer);
|
||||
@@ -510,7 +510,7 @@ class CustomerCore extends ObjectModel
|
||||
|
||||
public function getBoughtProducts()
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT * FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
|
||||
WHERE o.valid = 1 AND o.`id_customer` = '.(int)($this->id));
|
||||
@@ -543,7 +543,7 @@ class CustomerCore extends ObjectModel
|
||||
parent::toggleStatus();
|
||||
|
||||
/* Change status to active/inactive */
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'.pSQL(_DB_PREFIX_.$this->table).'`
|
||||
SET `date_upd` = NOW()
|
||||
WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
||||
|
||||
@@ -60,7 +60,7 @@ class CustomerMessageCore extends ObjectModel
|
||||
|
||||
public static function getMessagesByOrderId($id_order, $private = true)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT cm.*, c.`firstname` AS cfirstname, c.`lastname` AS clastname, e.`firstname` AS efirstname, e.`lastname` AS elastname, (COUNT(cm.id_customer_message) = 0 AND ct.id_customer != 0) AS is_new_for_me
|
||||
FROM `'._DB_PREFIX_.'customer_message` cm
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer_thread` ct ON ct.`id_customer_thread` = cm.`id_customer_thread`
|
||||
|
||||
@@ -69,13 +69,13 @@ class CustomerThreadCore extends ObjectModel
|
||||
{
|
||||
if (!Validate::isUnsignedId($this->id))
|
||||
return false;
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customer_message` WHERE `id_customer_thread` = '.(int)($this->id));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customer_message` WHERE `id_customer_thread` = '.(int)($this->id));
|
||||
return (parent::delete());
|
||||
}
|
||||
|
||||
public static function getCustomerMessages($id_customer)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT * FROM '._DB_PREFIX_.'customer_thread ct
|
||||
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON ct.id_customer_thread = cm.id_customer_thread
|
||||
WHERE id_customer = '.(int)($id_customer));
|
||||
|
||||
@@ -29,7 +29,7 @@ class CustomizationCore
|
||||
{
|
||||
public static function getReturnedCustomizations($id_order)
|
||||
{
|
||||
if (($result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
if (($result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT ore.`id_order_return`, ord.`id_order_detail`, ord.`id_customization`, ord.`product_quantity`
|
||||
FROM `'._DB_PREFIX_.'order_return` ore
|
||||
INNER JOIN `'._DB_PREFIX_.'order_return_detail` ord ON (ord.`id_order_return` = ore.`id_order_return`)
|
||||
@@ -43,7 +43,7 @@ class CustomizationCore
|
||||
|
||||
public static function getOrderedCustomizations($id_cart)
|
||||
{
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT `id_customization`, `quantity` FROM `'._DB_PREFIX_.'customization` WHERE `id_cart` = '.(int)($id_cart)))
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT `id_customization`, `quantity` FROM `'._DB_PREFIX_.'customization` WHERE `id_cart` = '.(int)($id_cart)))
|
||||
return false;
|
||||
$customizations = array();
|
||||
foreach ($result AS $row)
|
||||
@@ -87,7 +87,7 @@ class CustomizationCore
|
||||
|
||||
if (!empty($in_values))
|
||||
{
|
||||
$results = Db::getInstance()->ExecuteS(
|
||||
$results = Db::getInstance()->executeS(
|
||||
'SELECT `id_customization`, `id_product`, `quantity`, `quantity_refunded`, `quantity_returned`
|
||||
FROM `'._DB_PREFIX_.'customization`
|
||||
WHERE `id_customization` IN ('.$in_values.')');
|
||||
@@ -103,7 +103,7 @@ class CustomizationCore
|
||||
{
|
||||
$quantity = array();
|
||||
|
||||
$results = Db::getInstance()->ExecuteS('
|
||||
$results = Db::getInstance()->executeS('
|
||||
SELECT `id_product`, `id_product_attribute`, SUM(`quantity`) AS quantity
|
||||
FROM `'._DB_PREFIX_.'customization`
|
||||
WHERE `id_cart` = '.(int)$id_cart.'
|
||||
|
||||
+18
-18
@@ -187,8 +187,8 @@ class DiscountCore extends ObjectModel
|
||||
// Refresh cache of feature detachable
|
||||
Configuration::updateGlobalValue('PS_DISCOUNT_FEATURE_ACTIVE', self::isCurrentlyUsed($this->table, true));
|
||||
|
||||
return (Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'cart_discount WHERE id_discount = '.(int)($this->id)) &&
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'discount_category WHERE id_discount = '.(int)($this->id)));
|
||||
return (Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cart_discount WHERE id_discount = '.(int)($this->id)) &&
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'discount_category WHERE id_discount = '.(int)($this->id)));
|
||||
}
|
||||
|
||||
public function getTranslationsFieldsChild()
|
||||
@@ -205,7 +205,7 @@ class DiscountCore extends ObjectModel
|
||||
*/
|
||||
public static function getDiscountTypes($id_lang)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM '._DB_PREFIX_.'discount_type dt
|
||||
LEFT JOIN `'._DB_PREFIX_.'discount_type_lang` dtl ON (dt.`id_discount_type` = dtl.`id_discount_type` AND dtl.`id_lang` = '.(int)($id_lang).')');
|
||||
@@ -279,7 +279,7 @@ class DiscountCore extends ObjectModel
|
||||
if ($hasStock)
|
||||
$sql .= ' AND d.`quantity` != 0';
|
||||
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
foreach ($res as &$discount)
|
||||
if ($discount['quantity_per_user'])
|
||||
@@ -390,7 +390,7 @@ class DiscountCore extends ObjectModel
|
||||
|
||||
public static function getCategories($id_discount)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT `id_category`
|
||||
FROM `'._DB_PREFIX_.'discount_category`
|
||||
WHERE `id_discount` = '.(int)($id_discount));
|
||||
@@ -404,24 +404,24 @@ class DiscountCore extends ObjectModel
|
||||
if ($categories === null)
|
||||
{
|
||||
// Compatibility for modules which create discount without setting categories (ex. fidelity, sponsorship)
|
||||
$result = Db::getInstance()->ExecuteS('SELECT id_category FROM '._DB_PREFIX_.'category');
|
||||
$result = Db::getInstance()->executeS('SELECT id_category FROM '._DB_PREFIX_.'category');
|
||||
$categories = array();
|
||||
foreach ($result as $row)
|
||||
$categories[] = $row['id_category'];
|
||||
}
|
||||
elseif (!is_array($categories) OR !sizeof($categories))
|
||||
return false;
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'discount_category`
|
||||
WHERE `id_discount`='.(int)$this->id);
|
||||
foreach($categories AS $category)
|
||||
{
|
||||
Db::getInstance()->ExecuteS('
|
||||
Db::getInstance()->executeS('
|
||||
SELECT `id_discount`
|
||||
FROM `'._DB_PREFIX_.'discount_category`
|
||||
WHERE `id_discount`='.(int)($this->id).' AND `id_category`='.(int)($category));
|
||||
if (Db::getInstance()->NumRows() == 0)
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'discount_category` (`id_discount`, `id_category`)
|
||||
VALUES('.(int)($this->id).','.(int)($category).')');
|
||||
}
|
||||
@@ -545,29 +545,29 @@ class DiscountCore extends ObjectModel
|
||||
|
||||
$sql .= ')'; // close parenthesis openned above
|
||||
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
public static function deleteByIdCustomer($id_customer)
|
||||
{
|
||||
$discounts = Db::getInstance()->ExecuteS('SELECT `id_discount` FROM `'._DB_PREFIX_.'discount` WHERE `id_customer` = '.(int)($id_customer));
|
||||
$discounts = Db::getInstance()->executeS('SELECT `id_discount` FROM `'._DB_PREFIX_.'discount` WHERE `id_customer` = '.(int)($id_customer));
|
||||
foreach ($discounts as $discount)
|
||||
{
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'discount` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'discount_category` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'discount_lang` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'discount` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'discount_category` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'discount_lang` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function deleteByIdGroup($id_group)
|
||||
{
|
||||
$discounts = Db::getInstance()->ExecuteS('SELECT `id_discount` FROM `'._DB_PREFIX_.'discount` WHERE `id_group` = '.(int)($id_group));
|
||||
$discounts = Db::getInstance()->executeS('SELECT `id_discount` FROM `'._DB_PREFIX_.'discount` WHERE `id_group` = '.(int)($id_group));
|
||||
foreach ($discounts as $discount)
|
||||
{
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'discount` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'discount_category` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'discount_lang` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'discount` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'discount_category` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'discount_lang` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ class DispatcherCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'meta_lang` ml ON (m.id_meta = ml.id_meta'.$context->shop->sqlLang('ml').')
|
||||
WHERE id_lang = '.(int)$context->language->id.'
|
||||
ORDER BY LENGTH(ml.url_rewrite) DESC';
|
||||
if ($results = Db::getInstance()->ExecuteS($sql))
|
||||
if ($results = Db::getInstance()->executeS($sql))
|
||||
foreach ($results as $row)
|
||||
{
|
||||
if ($row['url_rewrite'])
|
||||
|
||||
+10
-10
@@ -86,7 +86,7 @@ class FeatureCore extends ObjectModel
|
||||
*/
|
||||
public static function getFeatures($id_lang)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'feature` f
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl ON (f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = '.(int)($id_lang).')
|
||||
@@ -120,10 +120,10 @@ class FeatureCore extends ObjectModel
|
||||
public function delete()
|
||||
{
|
||||
/* Also delete related attributes */
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'feature_value_lang` WHERE `id_feature_value` IN (SELECT id_feature_value FROM `'._DB_PREFIX_.'feature_value` WHERE `id_feature` = '.(int)($this->id).')');
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'feature_value` WHERE `id_feature` = '.(int)($this->id));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'feature_value_lang` WHERE `id_feature_value` IN (SELECT id_feature_value FROM `'._DB_PREFIX_.'feature_value` WHERE `id_feature` = '.(int)($this->id).')');
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'feature_value` WHERE `id_feature` = '.(int)($this->id));
|
||||
/* Also delete related products */
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'feature_product` WHERE `id_feature` = '.(int)($this->id));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'feature_product` WHERE `id_feature` = '.(int)($this->id));
|
||||
|
||||
$return = parent::delete();
|
||||
if($return)
|
||||
@@ -215,7 +215,7 @@ class FeatureCore extends ObjectModel
|
||||
if (empty($ids))
|
||||
return false;
|
||||
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT * , COUNT(*) as nb
|
||||
FROM `'._DB_PREFIX_.'feature` f
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_product` fp ON f.`id_feature` = fp.`id_feature`
|
||||
@@ -244,7 +244,7 @@ class FeatureCore extends ObjectModel
|
||||
*/
|
||||
public function updatePosition($way, $position)
|
||||
{
|
||||
if (!$res = Db::getInstance()->ExecuteS('
|
||||
if (!$res = Db::getInstance()->executeS('
|
||||
SELECT `position`, `id_feature`
|
||||
FROM `'._DB_PREFIX_.'feature`
|
||||
WHERE `id_feature` = '.(int)Tools::getValue('id_feature', 1).'
|
||||
@@ -261,14 +261,14 @@ class FeatureCore extends ObjectModel
|
||||
|
||||
// < and > statements rather than BETWEEN operator
|
||||
// since BETWEEN is treated differently according to databases
|
||||
return (Db::getInstance()->Execute('
|
||||
return (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'feature`
|
||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||
WHERE `position`
|
||||
'.($way
|
||||
? '> '.(int)$movedFeature['position'].' AND `position` <= '.(int)$position
|
||||
: '< '.(int)$movedFeature['position'].' AND `position` >= '.(int)$position))
|
||||
AND Db::getInstance()->Execute('
|
||||
AND Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'feature`
|
||||
SET `position` = '.(int)$position.'
|
||||
WHERE `id_feature`='.(int)$movedFeature['id_feature']));
|
||||
@@ -288,11 +288,11 @@ class FeatureCore extends ObjectModel
|
||||
SELECT `id_feature`
|
||||
FROM `'._DB_PREFIX_.'feature`
|
||||
ORDER BY `position`';
|
||||
$result = Db::getInstance()->ExecuteS($sql);
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
|
||||
$i = 0;
|
||||
foreach ($result as $value)
|
||||
$return = Db::getInstance()->Execute('
|
||||
$return = Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'feature`
|
||||
SET `position` = '.(int)$i++.'
|
||||
WHERE `id_feature` = '.(int)$value['id_feature']);
|
||||
|
||||
@@ -83,7 +83,7 @@ class FeatureValueCore extends ObjectModel
|
||||
*/
|
||||
public static function getFeatureValues($id_feature)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'feature_value`
|
||||
WHERE `id_feature` = '.(int)$id_feature);
|
||||
@@ -99,7 +99,7 @@ class FeatureValueCore extends ObjectModel
|
||||
*/
|
||||
public static function getFeatureValuesWithLang($id_lang, $id_feature)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'feature_value` v
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_value_lang` vl ON (v.`id_feature_value` = vl.`id_feature_value` AND vl.`id_lang` = '.(int)$id_lang.')
|
||||
@@ -116,7 +116,7 @@ class FeatureValueCore extends ObjectModel
|
||||
*/
|
||||
public static function getFeatureValueLang($id_feature_value)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'feature_value_lang`
|
||||
WHERE `id_feature_value` = '.(int)$id_feature_value.'
|
||||
@@ -140,7 +140,7 @@ class FeatureValueCore extends ObjectModel
|
||||
|
||||
public static function addFeatureValueImport($id_feature, $name)
|
||||
{
|
||||
$rq = Db::getInstance()->ExecuteS('
|
||||
$rq = Db::getInstance()->executeS('
|
||||
SELECT fv.`id_feature_value`
|
||||
FROM '._DB_PREFIX_.'feature_value fv
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value`)
|
||||
@@ -178,7 +178,7 @@ class FeatureValueCore extends ObjectModel
|
||||
public function delete()
|
||||
{
|
||||
/* Also delete related products */
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'feature_product` WHERE `id_feature_value` = '.(int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'feature_product` WHERE `id_feature_value` = '.(int)$this->id);
|
||||
$return = parent::delete();
|
||||
|
||||
if ($return)
|
||||
|
||||
@@ -641,7 +641,7 @@ class FrontControllerCore extends Controller
|
||||
if (!is_array(self::$currentCustomerGroups))
|
||||
{
|
||||
self::$currentCustomerGroups = array();
|
||||
$result = Db::getInstance()->ExecuteS('SELECT id_group FROM '._DB_PREFIX_.'customer_group WHERE id_customer = '.(int)$context->customer->id);
|
||||
$result = Db::getInstance()->executeS('SELECT id_group FROM '._DB_PREFIX_.'customer_group WHERE id_customer = '.(int)$context->customer->id);
|
||||
foreach ($result as $row)
|
||||
self::$currentCustomerGroups[] = $row['id_group'];
|
||||
}
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ class GenderCore extends ObjectModel
|
||||
$sql = 'SELECT g.*, gl.*
|
||||
FROM '._DB_PREFIX_.'gender g
|
||||
LEFT JOIN '._DB_PREFIX_.'gender_lang gl ON g.id_gender = gl.id_gender AND gl.id_lang = '.(int)$id_lang;
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
return ObjectModel::hydrateCollection('Gender', $results, $id_lang);
|
||||
}
|
||||
|
||||
+12
-12
@@ -84,7 +84,7 @@ class GroupCore extends ObjectModel
|
||||
|
||||
public static function getGroups($id_lang)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT g.`id_group`, g.`reduction`, g.`price_display_method`, gl.`name`
|
||||
FROM `'._DB_PREFIX_.'group` g
|
||||
LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)($id_lang).')
|
||||
@@ -100,7 +100,7 @@ class GroupCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (cg.`id_customer` = c.`id_customer`)
|
||||
WHERE cg.`id_group` = '.(int)$this->id.'
|
||||
AND c.`deleted` != 1');
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT cg.`id_customer`, c.*
|
||||
FROM `'._DB_PREFIX_.'customer_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (cg.`id_customer` = c.`id_customer`)
|
||||
@@ -166,10 +166,10 @@ class GroupCore extends ObjectModel
|
||||
return false;
|
||||
if (parent::delete())
|
||||
{
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customer_group` WHERE `id_group` = '.(int)$this->id);
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category_group` WHERE `id_group` = '.(int)$this->id);
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'group_reduction` WHERE `id_group` = '.(int)$this->id);
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_group` = '.(int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customer_group` WHERE `id_group` = '.(int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_group` WHERE `id_group` = '.(int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'group_reduction` WHERE `id_group` = '.(int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_group` = '.(int)$this->id);
|
||||
$this->truncateRestrictionsModules($this->id);
|
||||
Discount::deleteByIdGroup((int)$this->id);
|
||||
|
||||
@@ -177,7 +177,7 @@ class GroupCore extends ObjectModel
|
||||
Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', self::isCurrentlyUsed());
|
||||
|
||||
// Add default group (id 1) to customers without groups
|
||||
Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'customer_group` (
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'customer_group` (
|
||||
SELECT c.id_customer, 1 FROM `'._DB_PREFIX_.'customer` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer_group` cg
|
||||
ON cg.id_customer = c.id_customer
|
||||
@@ -185,7 +185,7 @@ class GroupCore extends ObjectModel
|
||||
|
||||
// Set to the customer the default group
|
||||
// Select the minimal id from customer_group
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customer` cg
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'customer` cg
|
||||
SET id_default_group =
|
||||
IFNULL((
|
||||
SELECT min(id_group) FROM `'._DB_PREFIX_.'customer_group`
|
||||
@@ -234,7 +234,7 @@ class GroupCore extends ObjectModel
|
||||
*/
|
||||
public static function truncateModulesRestrictions($id_group)
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'group_module_restriction`
|
||||
WHERE `id_group` = '.(int)$id_group);
|
||||
}
|
||||
@@ -246,7 +246,7 @@ class GroupCore extends ObjectModel
|
||||
*/
|
||||
public static function truncateRestrictionsByModule($id_module)
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'group_module_restriction`
|
||||
WHERE `id_module` = '.(int)$id_module);
|
||||
}
|
||||
@@ -268,7 +268,7 @@ class GroupCore extends ObjectModel
|
||||
$sql .= '("'.(int)$id_group.'", "'.(int)Module::getModuleIdByName($mod).'", "'.(int)$authorized.'"),';
|
||||
// removing last comma to avoid SQL error
|
||||
$sql = substr($sql, 0, strlen($sql) - 1);
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ class GroupCore extends ObjectModel
|
||||
$sql .= '("'.(int)$g['id_group'].'", "'.(int)$id_module.'", "1"),';
|
||||
// removing last comma to avoid SQL error
|
||||
$sql = substr($sql, 0, strlen($sql) - 1);
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -60,7 +60,7 @@ class GroupReductionCore extends ObjectModel
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT p.`id_product`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
WHERE p.`id_category_default` = '.(int)($this->id_category)
|
||||
@@ -69,7 +69,7 @@ class GroupReductionCore extends ObjectModel
|
||||
while ($row = Db::getInstance()->nextRow($resource))
|
||||
{
|
||||
$query = 'DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_product` = '.(int)($row['id_product']);
|
||||
if (Db::getInstance()->Execute($query) === false)
|
||||
if (Db::getInstance()->execute($query) === false)
|
||||
return false;
|
||||
}
|
||||
return (parent::delete());
|
||||
@@ -77,12 +77,12 @@ class GroupReductionCore extends ObjectModel
|
||||
|
||||
protected function _clearCache()
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_group` = '.(int)($this->id_group));
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_group` = '.(int)($this->id_group));
|
||||
}
|
||||
|
||||
protected function _setCache()
|
||||
{
|
||||
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT p.`id_product`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
WHERE p.`id_category_default` = '.(int)($this->id_category)
|
||||
@@ -97,13 +97,13 @@ class GroupReductionCore extends ObjectModel
|
||||
}
|
||||
|
||||
if ($updated)
|
||||
return (Db::getInstance()->Execute(rtrim($query, ', ')));
|
||||
return (Db::getInstance()->execute(rtrim($query, ', ')));
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function _updateCache()
|
||||
{
|
||||
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT p.`id_product`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
WHERE p.`id_category_default` = '.(int)($this->id_category)
|
||||
@@ -114,7 +114,7 @@ class GroupReductionCore extends ObjectModel
|
||||
$query = 'UPDATE `'._DB_PREFIX_.'product_group_reduction_cache`
|
||||
SET `reduction` = '.(float)($this->reduction).'
|
||||
WHERE `id_product` = '.(int)($row['id_product']).' AND `id_group` = '.(int)($this->id_group);
|
||||
if (Db::getInstance()->Execute($query) === false)
|
||||
if (Db::getInstance()->execute($query) === false)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -122,7 +122,7 @@ class GroupReductionCore extends ObjectModel
|
||||
|
||||
public static function getGroupReductions($id_group, $id_lang)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT gr.`id_group_reduction`, gr.`id_group`, gr.`id_category`, gr.`reduction`, cl.`name` AS category_name
|
||||
FROM `'._DB_PREFIX_.'group_reduction` gr
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = gr.`id_category` AND cl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('cl').')
|
||||
@@ -180,13 +180,13 @@ class GroupReductionCore extends ObjectModel
|
||||
SET `reduction` = '.(float)($reduction).'
|
||||
WHERE `id_product` = '.(int)($id_product).' AND `id_group` = '.(int)($id_group);
|
||||
|
||||
return (Db::getInstance()->Execute($query));
|
||||
return (Db::getInstance()->execute($query));
|
||||
}
|
||||
|
||||
public static function deleteProductReduction($id_product)
|
||||
{
|
||||
$query = 'DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_product` = '.(int)($id_product);
|
||||
if (Db::getInstance()->Execute($query) === false)
|
||||
if (Db::getInstance()->execute($query) === false)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -203,13 +203,13 @@ class GroupReductionCore extends ObjectModel
|
||||
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'product_group_reduction_cache` (`id_product`, `id_group`, `reduction`) VALUES ';
|
||||
$query .= '('.(int)($id_product).', '.(int)($row['id_group']).', '.(float)($row['reduction']).')';
|
||||
return (Db::getInstance()->Execute($query));
|
||||
return (Db::getInstance()->execute($query));
|
||||
}
|
||||
|
||||
public static function deleteCategory($id_category)
|
||||
{
|
||||
$query = 'DELETE FROM `'._DB_PREFIX_.'group_reduction` WHERE `id_category` = '.(int)($id_category);
|
||||
if (Db::getInstance()->Execute($query) === false)
|
||||
if (Db::getInstance()->execute($query) === false)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@ class GuestCore extends ObjectModel
|
||||
public function mergeWithCustomer($id_guest, $id_customer)
|
||||
{
|
||||
// Since the guests are merged, the guest id in the connections table must be changed too
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'connections` c
|
||||
SET c.`id_guest` = '.(int)($id_guest).'
|
||||
WHERE c.`id_guest` = '.(int)($this->id));
|
||||
|
||||
@@ -36,7 +36,7 @@ class HelpAccessCore
|
||||
|
||||
public static function trackClick($label, $version)
|
||||
{
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'help_access` (`label`, `version`) VALUES (\''.pSQL($label).'\',\''.pSQL($version).'\')
|
||||
ON DUPLICATE KEY UPDATE `version` = \''.pSQL($version).'\'
|
||||
');
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ class HookCore extends ObjectModel
|
||||
|
||||
static public function getHooks($position = false)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'hook` h
|
||||
'.($position ? 'WHERE h.`position` = 1' : ''));
|
||||
|
||||
+11
-11
@@ -102,7 +102,7 @@ class ImageCore extends ObjectModel
|
||||
return false;
|
||||
|
||||
// update positions
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'image`
|
||||
WHERE `id_product` = '.(int)$this->id_product.'
|
||||
@@ -127,7 +127,7 @@ class ImageCore extends ObjectModel
|
||||
*/
|
||||
public static function getImages($id_lang, $id_product)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'image` i
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`)
|
||||
@@ -142,7 +142,7 @@ class ImageCore extends ObjectModel
|
||||
*/
|
||||
public static function getAllImages()
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT `id_image`, `id_product`
|
||||
FROM `'._DB_PREFIX_.'image`
|
||||
ORDER BY `id_image` ASC');
|
||||
@@ -191,7 +191,7 @@ class ImageCore extends ObjectModel
|
||||
|
||||
if (file_exists(_PS_TMP_IMG_DIR_.'product_'.$id_product.'.jpg'))
|
||||
unlink(_PS_TMP_IMG_DIR_.'product_'.$id_product.'.jpg');
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 0
|
||||
WHERE `id_product` = '.(int)($id_product));
|
||||
@@ -220,7 +220,7 @@ class ImageCore extends ObjectModel
|
||||
public static function duplicateProductImages($id_product_old, $id_product_new, $combinationImages)
|
||||
{
|
||||
$imagesTypes = ImageType::getImagesTypes('products');
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `id_image`
|
||||
FROM `'._DB_PREFIX_.'image`
|
||||
WHERE `id_product` = '.(int)($id_product_old));
|
||||
@@ -298,18 +298,18 @@ class ImageCore extends ObjectModel
|
||||
// temporary position
|
||||
$high_position = Image::getHighestPosition($this->id_product) + 1;
|
||||
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `position` = '.(int)($high_position).'
|
||||
WHERE `id_product` = '.(int)($this->id_product).'
|
||||
AND `position` = '.($direction ? $position - 1 : $position + 1));
|
||||
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `position` = `position`'.($direction ? '-1' : '+1').'
|
||||
WHERE `id_image` = '.(int)($this->id));
|
||||
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `position` = '.$this->position.'
|
||||
WHERE `id_product` = '.(int)($this->id_product).'
|
||||
@@ -330,7 +330,7 @@ class ImageCore extends ObjectModel
|
||||
|
||||
// < and > statements rather than BETWEEN operator
|
||||
// since BETWEEN is treated differently according to databases
|
||||
$result = (Db::getInstance()->Execute('
|
||||
$result = (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||
WHERE `position`
|
||||
@@ -338,7 +338,7 @@ class ImageCore extends ObjectModel
|
||||
? '> '.(int)($this->position).' AND `position` <= '.(int)($position)
|
||||
: '< '.(int)($this->position).' AND `position` >= '.(int)($position)).'
|
||||
AND `id_product`='.(int)($this->id_product))
|
||||
&& Db::getInstance()->Execute('
|
||||
&& Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `position` = '.(int)($position).'
|
||||
WHERE `id_image` = '.(int)($this->id_image)));
|
||||
@@ -367,7 +367,7 @@ class ImageCore extends ObjectModel
|
||||
*/
|
||||
public function deleteProductAttributeImage()
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
DELETE
|
||||
FROM `'._DB_PREFIX_.'product_attribute_image`
|
||||
WHERE `id_image` = '.(int)($this->id)
|
||||
|
||||
@@ -111,7 +111,7 @@ class ImageTypeCore extends ObjectModel
|
||||
$where = '';
|
||||
|
||||
$query = 'SELECT * FROM `'._DB_PREFIX_.'image_type`'.$where.'ORDER BY `name` ASC';
|
||||
self::$images_types_cache[$type] = Db::getInstance()->ExecuteS($query);
|
||||
self::$images_types_cache[$type] = Db::getInstance()->executeS($query);
|
||||
}
|
||||
|
||||
return self::$images_types_cache[$type];
|
||||
@@ -128,7 +128,7 @@ class ImageTypeCore extends ObjectModel
|
||||
if (!Validate::isImageTypeName($typeName))
|
||||
die(Tools::displayError());
|
||||
|
||||
Db::getInstance()->ExecuteS('
|
||||
Db::getInstance()->executeS('
|
||||
SELECT `id_image_type`
|
||||
FROM `'._DB_PREFIX_.'image_type`
|
||||
WHERE `name` = \''.pSQL($typeName).'\'');
|
||||
|
||||
@@ -70,7 +70,7 @@ abstract class ImportModuleCore extends Module
|
||||
public function getValue($query)
|
||||
{
|
||||
$this->initDatabaseConnection();
|
||||
$result = $this->ExecuteS($query);
|
||||
$result = $this->executeS($query);
|
||||
if (!sizeof($result))
|
||||
return 0;
|
||||
else
|
||||
|
||||
+15
-15
@@ -346,7 +346,7 @@ class LanguageCore extends ObjectModel
|
||||
*/
|
||||
public function loadUpdateSQL()
|
||||
{
|
||||
$tables = Db::getInstance()->ExecuteS('SHOW TABLES LIKE \''._DB_PREFIX_.'%_lang\' ');
|
||||
$tables = Db::getInstance()->executeS('SHOW TABLES LIKE \''._DB_PREFIX_.'%_lang\' ');
|
||||
$langTables = array();
|
||||
|
||||
foreach($tables as $table)
|
||||
@@ -354,12 +354,12 @@ class LanguageCore extends ObjectModel
|
||||
if ($t != _DB_PREFIX_.'configuration_lang')
|
||||
$langTables[] = $t;
|
||||
|
||||
Db::getInstance()->Execute('SET @id_lang_default = (SELECT c.`value` FROM `'._DB_PREFIX_.'configuration` c WHERE c.`name` = \'PS_LANG_DEFAULT\' LIMIT 1)');
|
||||
Db::getInstance()->execute('SET @id_lang_default = (SELECT c.`value` FROM `'._DB_PREFIX_.'configuration` c WHERE c.`name` = \'PS_LANG_DEFAULT\' LIMIT 1)');
|
||||
$return = true;
|
||||
foreach($langTables as $name)
|
||||
{
|
||||
$fields = '';
|
||||
$columns = Db::getInstance()->ExecuteS('SHOW COLUMNS FROM `'.$name.'`');
|
||||
$columns = Db::getInstance()->executeS('SHOW COLUMNS FROM `'.$name.'`');
|
||||
foreach($columns as $column)
|
||||
$fields .= $column['Field'].', ';
|
||||
$fields = rtrim($fields, ', ');
|
||||
@@ -374,7 +374,7 @@ class LanguageCore extends ObjectModel
|
||||
}
|
||||
$sql = rtrim($sql, ', ');
|
||||
$sql .= ' FROM `'._DB_PREFIX_.'lang` CROSS JOIN `'.str_replace('_lang', '', $name).'`) ;';
|
||||
$return &= Db::getInstance()->Execute(pSQL($sql));
|
||||
$return &= Db::getInstance()->execute(pSQL($sql));
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
@@ -404,17 +404,17 @@ class LanguageCore extends ObjectModel
|
||||
$this->iso_code = self::getIsoById($this->id);
|
||||
|
||||
// Database translations deletion
|
||||
$result = Db::getInstance()->ExecuteS('SHOW TABLES FROM `'._DB_NAME_.'`');
|
||||
$result = Db::getInstance()->executeS('SHOW TABLES FROM `'._DB_NAME_.'`');
|
||||
foreach ($result AS $row)
|
||||
if (preg_match('/_lang/', $row['Tables_in_'._DB_NAME_]))
|
||||
if (!Db::getInstance()->Execute('DELETE FROM `'.$row['Tables_in_'._DB_NAME_].'` WHERE `id_lang` = '.(int)($this->id)))
|
||||
if (!Db::getInstance()->execute('DELETE FROM `'.$row['Tables_in_'._DB_NAME_].'` WHERE `id_lang` = '.(int)($this->id)))
|
||||
return false;
|
||||
|
||||
// Delete tags
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'tag WHERE id_lang = '.(int)($this->id));
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'tag WHERE id_lang = '.(int)($this->id));
|
||||
|
||||
// Delete search words
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'search_word WHERE id_lang = '.(int)($this->id));
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'search_word WHERE id_lang = '.(int)($this->id));
|
||||
|
||||
// Files deletion
|
||||
foreach (self::getFilesList($this->iso_code, _THEME_NAME_, false, false, false, true, true) as $key => $file)
|
||||
@@ -567,19 +567,19 @@ class LanguageCore extends ObjectModel
|
||||
*/
|
||||
public static function getIsoIds($active = true)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT `id_lang`, `iso_code` FROM `'._DB_PREFIX_.'lang` '.($active ? 'WHERE active = 1' : ''));
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT `id_lang`, `iso_code` FROM `'._DB_PREFIX_.'lang` '.($active ? 'WHERE active = 1' : ''));
|
||||
}
|
||||
|
||||
public static function copyLanguageData($from, $to)
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS('SHOW TABLES FROM `'._DB_NAME_.'`');
|
||||
$result = Db::getInstance()->executeS('SHOW TABLES FROM `'._DB_NAME_.'`');
|
||||
foreach ($result AS $row)
|
||||
if (preg_match('/_lang/', $row['Tables_in_'._DB_NAME_]) AND $row['Tables_in_'._DB_NAME_] != _DB_PREFIX_.'lang')
|
||||
{
|
||||
$result2 = Db::getInstance()->ExecuteS('SELECT * FROM `'.$row['Tables_in_'._DB_NAME_].'` WHERE `id_lang` = '.(int)($from));
|
||||
$result2 = Db::getInstance()->executeS('SELECT * FROM `'.$row['Tables_in_'._DB_NAME_].'` WHERE `id_lang` = '.(int)($from));
|
||||
if (!sizeof($result2))
|
||||
continue;
|
||||
Db::getInstance()->Execute('DELETE FROM `'.$row['Tables_in_'._DB_NAME_].'` WHERE `id_lang` = '.(int)($to));
|
||||
Db::getInstance()->execute('DELETE FROM `'.$row['Tables_in_'._DB_NAME_].'` WHERE `id_lang` = '.(int)($to));
|
||||
$query = 'INSERT INTO `'.$row['Tables_in_'._DB_NAME_].'` VALUES ';
|
||||
foreach ($result2 AS $row2)
|
||||
{
|
||||
@@ -590,7 +590,7 @@ class LanguageCore extends ObjectModel
|
||||
$query = rtrim($query, ',').'),';
|
||||
}
|
||||
$query = rtrim($query, ',');
|
||||
Db::getInstance()->Execute($query);
|
||||
Db::getInstance()->execute($query);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -605,7 +605,7 @@ class LanguageCore extends ObjectModel
|
||||
$sql = 'SELECT l.*, ls.`id_shop`
|
||||
FROM `'._DB_PREFIX_.'lang` l
|
||||
LEFT JOIN `'._DB_PREFIX_.'lang_shop` ls ON (l.id_lang = ls.id_lang)';
|
||||
$result = Db::getInstance()->ExecuteS($sql);
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
foreach ($result AS $row)
|
||||
{
|
||||
if (!isset(self::$_LANGUAGES[(int)$row['id_lang']]))
|
||||
@@ -702,7 +702,7 @@ class LanguageCore extends ObjectModel
|
||||
if (self::$_cache_language_installation === null)
|
||||
{
|
||||
self::$_cache_language_installation = array();
|
||||
$result = Db::getInstance()->ExecuteS('SELECT `id_lang`, `iso_code` FROM `'._DB_PREFIX_.'lang`');
|
||||
$result = Db::getInstance()->executeS('SELECT `id_lang`, `iso_code` FROM `'._DB_PREFIX_.'lang`');
|
||||
foreach ($result as $row)
|
||||
self::$_cache_language_installation[$row['iso_code']] = $row['id_lang'];
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ class ManufacturerCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer_lang` ml ON (m.`id_manufacturer` = ml.`id_manufacturer` AND ml.`id_lang` = '.(int)($id_lang).')
|
||||
WHERE mgs.id_group_shop='.(int)$id_group_shop.($active ? ' AND m.`active` = 1' : '');
|
||||
$sql.= ' ORDER BY m.`name` ASC'.($p ? ' LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n) : '');
|
||||
$manufacturers = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$manufacturers = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if ($manufacturers === false)
|
||||
return false;
|
||||
if ($getNbProducts)
|
||||
@@ -190,7 +190,7 @@ class ManufacturerCore extends ObjectModel
|
||||
}
|
||||
foreach ($manufacturers as $key => $manufacturer)
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT p.`id_product`
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT p.`id_product`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` as m ON (m.`id_manufacturer`= p.`id_manufacturer`)
|
||||
WHERE m.`id_manufacturer` = '.(int)($manufacturer['id_manufacturer']).
|
||||
@@ -273,7 +273,7 @@ class ManufacturerCore extends ObjectModel
|
||||
($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
|
||||
WHERE cg.`id_group` '.$sqlGroups.'
|
||||
)';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
return (int)(sizeof($result));
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ class ManufacturerCore extends ObjectModel
|
||||
ORDER BY '.(($orderBy == 'id_product') ? 'p.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||
LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n;
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if (!$result)
|
||||
return false;
|
||||
if ($orderBy == 'price')
|
||||
@@ -317,7 +317,7 @@ class ManufacturerCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('pl').')
|
||||
WHERE p.`id_manufacturer` = '.(int)$this->id;
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
/*
|
||||
* Specify if a manufacturer already in base
|
||||
@@ -337,7 +337,7 @@ class ManufacturerCore extends ObjectModel
|
||||
|
||||
public function getAddresses($id_lang)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT a.*, cl.name AS `country`, s.name AS `state`
|
||||
FROM `'._DB_PREFIX_.'address` AS a
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` AS cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)($id_lang).')
|
||||
@@ -348,7 +348,7 @@ class ManufacturerCore extends ObjectModel
|
||||
|
||||
public function getWsAddresses()
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT a.id_address as id
|
||||
FROM `'._DB_PREFIX_.'address` AS a
|
||||
WHERE `id_manufacturer` = '.(int)($this->id).'
|
||||
@@ -360,14 +360,14 @@ class ManufacturerCore extends ObjectModel
|
||||
$ids = array();
|
||||
foreach ($id_addresses as $id)
|
||||
$ids[] = (int)$id['id'];
|
||||
$result1 = (Db::getInstance()->Execute('
|
||||
$result1 = (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'address`
|
||||
SET id_manufacturer = 0
|
||||
WHERE id_manufacturer = '.(int)$this->id.'
|
||||
AND deleted = 0') !== false);
|
||||
$result2 = true;
|
||||
if (count($ids))
|
||||
$result2 = (Db::getInstance()->Execute('
|
||||
$result2 = (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'address`
|
||||
SET id_customer = 0, id_supplier = 0, id_manufacturer = '.(int)$this->id.'
|
||||
WHERE id_address IN('.implode(',', $ids).')
|
||||
|
||||
+3
-3
@@ -106,7 +106,7 @@ class MessageCore extends ObjectModel
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT m.*, c.`firstname` AS cfirstname, c.`lastname` AS clastname, e.`firstname` AS efirstname, e.`lastname` AS elastname, (COUNT(mr.id_message) = 0 AND m.id_customer != 0) AS is_new_for_me
|
||||
FROM `'._DB_PREFIX_.'message` m
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON m.`id_customer` = c.`id_customer`
|
||||
@@ -133,7 +133,7 @@ class MessageCore extends ObjectModel
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT m.*, c.`firstname` AS cfirstname, c.`lastname` AS clastname, e.`firstname` AS efirstname, e.`lastname` AS elastname, (COUNT(mr.id_message) = 0 AND m.id_customer != 0) AS is_new_for_me
|
||||
FROM `'._DB_PREFIX_.'message` m
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON m.`id_customer` = c.`id_customer`
|
||||
@@ -156,7 +156,7 @@ class MessageCore extends ObjectModel
|
||||
if (!Validate::isUnsignedId($id_message) OR !Validate::isUnsignedId($id_employee))
|
||||
die(Tools::displayError());
|
||||
|
||||
$result = Db::getInstance()->Execute('
|
||||
$result = Db::getInstance()->execute('
|
||||
INSERT INTO '._DB_PREFIX_.'message_readed (id_message , id_employee , date_add) VALUES
|
||||
('.(int)($id_message).', '.(int)($id_employee).', NOW());
|
||||
');
|
||||
|
||||
+2
-2
@@ -89,7 +89,7 @@ class MetaCore extends ObjectModel
|
||||
|
||||
public static function getMetas()
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM '._DB_PREFIX_.'meta
|
||||
ORDER BY page ASC');
|
||||
@@ -106,7 +106,7 @@ class MetaCore extends ObjectModel
|
||||
WHERE ml.`id_lang` = '.(int)$id_lang
|
||||
.$shop->sqlLang('ml').
|
||||
'ORDER BY page ASC';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+22
-22
@@ -120,7 +120,7 @@ abstract class ModuleCore
|
||||
) as total
|
||||
FROM '._DB_PREFIX_.'module m';
|
||||
self::$modulesCache = array();
|
||||
$result = Db::getInstance()->ExecuteS($sql);
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
foreach ($result as $row)
|
||||
{
|
||||
self::$modulesCache[$row['name']] = $row;
|
||||
@@ -167,14 +167,14 @@ abstract class ModuleCore
|
||||
$this->enable(true);
|
||||
|
||||
// Permissions management
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'module_access` (`id_profile`, `id_module`, `view`, `configure`) (
|
||||
SELECT id_profile, '.(int)$this->id.', 1, 1
|
||||
FROM '._DB_PREFIX_.'access a
|
||||
WHERE id_tab = (SELECT `id_tab` FROM '._DB_PREFIX_.'tab WHERE class_name = \'AdminModules\' LIMIT 1)
|
||||
AND a.`view` = 1
|
||||
)');
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'module_access` (`id_profile`, `id_module`, `view`, `configure`) (
|
||||
SELECT id_profile, '.(int)$this->id.', 1, 0
|
||||
FROM '._DB_PREFIX_.'access a
|
||||
@@ -200,23 +200,23 @@ abstract class ModuleCore
|
||||
$sql = 'SELECT id_hook
|
||||
FROM '._DB_PREFIX_.'hook_module hm
|
||||
WHERE id_module = '.(int)$this->id;
|
||||
$result = Db::getInstance()->ExecuteS($sql);
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
foreach ($result AS $row)
|
||||
{
|
||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'hook_module`
|
||||
WHERE `id_module` = '.(int)$this->id.'
|
||||
AND `id_hook` = '.(int)$row['id_hook'];
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
$this->cleanPositions($row['id_hook']);
|
||||
}
|
||||
$this->disable(true);
|
||||
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_access` WHERE `id_module` = '.(int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'module_access` WHERE `id_module` = '.(int)$this->id);
|
||||
|
||||
// Remove restrictions for client groups
|
||||
Group::truncateRestrictionsByModule($this->id);
|
||||
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'module`
|
||||
WHERE `id_module` = '.(int)$this->id);
|
||||
}
|
||||
@@ -414,7 +414,7 @@ abstract class ModuleCore
|
||||
WHERE `id_module` = '.(int)$this->id.'
|
||||
AND `id_hook` = '.(int)$hook_id
|
||||
.(($shopList) ? ' AND id_shop IN('.implode(', ', $shopList).')' : '');
|
||||
$result = Db::getInstance()->Execute($sql);
|
||||
$result = Db::getInstance()->execute($sql);
|
||||
$this->cleanPositions($hook_id, $shopList);
|
||||
return $result;
|
||||
}
|
||||
@@ -433,7 +433,7 @@ abstract class ModuleCore
|
||||
WHERE `id_module` = '.(int)$this->id.'
|
||||
AND `id_hook` = '.(int)$hook_id
|
||||
.(($shopList) ? ' AND id_shop IN('.implode(', ', $shopList).')' : '');
|
||||
return Db::getInstance()->Execute($sql);
|
||||
return Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -742,7 +742,7 @@ abstract class ModuleCore
|
||||
$arrNativeModules[] = '"'.pSQL($module['name']).'"';
|
||||
}
|
||||
|
||||
return $db->ExecuteS('
|
||||
return $db->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'module` m
|
||||
WHERE name NOT IN ('.implode(',',$arrNativeModules).') ');
|
||||
@@ -763,7 +763,7 @@ abstract class ModuleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'hook` k ON hm.`id_hook` = k.`id_hook`
|
||||
WHERE k.`position` = 1
|
||||
GROUP BY m.id_module';
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -812,7 +812,7 @@ abstract class ModuleCore
|
||||
$sql .= '
|
||||
GROUP BY hm.id_hook, hm.id_module
|
||||
ORDER BY hm.`position`';
|
||||
$result = $db->ExecuteS($sql, false);
|
||||
$result = $db->executeS($sql, false);
|
||||
self::$_hookModulesCache = array();
|
||||
|
||||
if ($result)
|
||||
@@ -925,7 +925,7 @@ abstract class ModuleCore
|
||||
$sql .= '
|
||||
GROUP BY hm.id_hook, hm.id_module
|
||||
ORDER BY hm.`position`, m.`name` DESC';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -1016,7 +1016,7 @@ abstract class ModuleCore
|
||||
WHERE hm.`id_hook` = '.(int)$id_hook.'
|
||||
AND hm.id_shop = '.$shopID.'
|
||||
ORDER BY hm.`position` '.($way ? 'ASC' : 'DESC');
|
||||
if (!$res = Db::getInstance()->ExecuteS($sql))
|
||||
if (!$res = Db::getInstance()->executeS($sql))
|
||||
continue;
|
||||
|
||||
foreach ($res AS $key => $values)
|
||||
@@ -1038,7 +1038,7 @@ abstract class ModuleCore
|
||||
WHERE position between '.(int)(min(array($from['position'], $to['position']))) .' AND '.(int)(max(array($from['position'], $to['position']))).'
|
||||
AND `id_hook`='.(int)$from['id_hook'].'
|
||||
AND id_shop = '.$shopID;
|
||||
if (!Db::getInstance()->Execute($sql))
|
||||
if (!Db::getInstance()->execute($sql))
|
||||
return false;
|
||||
|
||||
$sql = 'UPDATE `'._DB_PREFIX_.'hook_module`
|
||||
@@ -1046,7 +1046,7 @@ abstract class ModuleCore
|
||||
WHERE `'.pSQL($this->identifier).'` = '.(int)($from[$this->identifier]).'
|
||||
AND `id_hook` = '.(int)($to['id_hook']).'
|
||||
AND id_shop = '.$shopID;
|
||||
if (!Db::getInstance()->Execute($sql))
|
||||
if (!Db::getInstance()->execute($sql))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1064,7 +1064,7 @@ abstract class ModuleCore
|
||||
WHERE id_hook = '.(int)$id_hook.'
|
||||
'.((!is_null($shopList)) ? ' AND id_shop IN('.implode(', ', $shopList).')' : '').'
|
||||
ORDER BY position';
|
||||
$results = Db::getInstance()->ExecuteS($sql);
|
||||
$results = Db::getInstance()->executeS($sql);
|
||||
$position = array();
|
||||
foreach ($results as $row)
|
||||
{
|
||||
@@ -1076,7 +1076,7 @@ abstract class ModuleCore
|
||||
WHERE id_hook = '.(int)$id_hook.'
|
||||
AND id_module = '.$row['id_module'].'
|
||||
AND id_shop = '.$row['id_shop'];
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
$position[$row['id_shop']]++;
|
||||
}
|
||||
|
||||
@@ -1117,7 +1117,7 @@ abstract class ModuleCore
|
||||
$sql = 'SELECT *
|
||||
FROM `'._DB_PREFIX_.'hook_module_exceptions`
|
||||
WHERE id_shop IN ('.implode(', ', Context::getContext()->shop->getListOfID()).')';
|
||||
$result = Db::getInstance()->ExecuteS($sql);
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
foreach ($result as $row)
|
||||
{
|
||||
if (!$row['file_name'])
|
||||
@@ -1154,7 +1154,7 @@ abstract class ModuleCore
|
||||
|
||||
public static function isInstalled($moduleName)
|
||||
{
|
||||
Db::getInstance()->ExecuteS('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($moduleName).'\'');
|
||||
Db::getInstance()->executeS('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($moduleName).'\'');
|
||||
return (bool)Db::getInstance()->NumRows();
|
||||
}
|
||||
|
||||
@@ -1293,7 +1293,7 @@ abstract class ModuleCore
|
||||
if (!isset($cache_permissions[$employee->id_profile]))
|
||||
{
|
||||
$cache_permissions[$employee->id_profile] = array();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT id_module, `view`, `configure` FROM '._DB_PREFIX_.'module_access WHERE id_profile = '.(int)$employee->id_profile);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_module, `view`, `configure` FROM '._DB_PREFIX_.'module_access WHERE id_profile = '.(int)$employee->id_profile);
|
||||
foreach ($result as $row)
|
||||
{
|
||||
$cache_permissions[$employee->id_profile][$row['id_module']]['view'] = $row['view'];
|
||||
@@ -1309,7 +1309,7 @@ abstract class ModuleCore
|
||||
*/
|
||||
public static function getAuthorizedModules($group_id)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT m.id_module, m.name FROM `'._DB_PREFIX_.'group_module_restriction` gmr
|
||||
LEFT JOIN `'._DB_PREFIX_.'module` m ON (m.`id_module` = gmr.`id_module`)
|
||||
WHERE gmr.`id_group` = '.(int) $group_id.'
|
||||
|
||||
@@ -43,7 +43,7 @@ abstract class ModuleGraphEngineCore extends Module
|
||||
|
||||
public static function getGraphEngines()
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT m.`name`
|
||||
FROM `'._DB_PREFIX_.'module` m
|
||||
LEFT JOIN `'._DB_PREFIX_.'hook_module` hm ON hm.`id_module` = m.`id_module`
|
||||
|
||||
@@ -43,7 +43,7 @@ abstract class ModuleGridEngineCore extends Module
|
||||
|
||||
public static function getGridEngines()
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT m.`name`
|
||||
FROM `'._DB_PREFIX_.'module` m
|
||||
LEFT JOIN `'._DB_PREFIX_.'hook_module` hm ON hm.`id_module` = m.`id_module`
|
||||
|
||||
@@ -77,7 +77,7 @@ class NotificationCore
|
||||
ORDER BY `id_'.pSQL($type).'` DESC LIMIT 5';
|
||||
|
||||
$json = array();
|
||||
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql) as $key => $value)
|
||||
foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql) as $key => $value)
|
||||
{
|
||||
if (isset($value['id_order']))
|
||||
{
|
||||
@@ -108,7 +108,7 @@ class NotificationCore
|
||||
{
|
||||
if (in_array($type, $this->types))
|
||||
// We update the last item viewed
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'employee`
|
||||
SET `id_last_'.pSQL($type).'` = (SELECT MAX(`id_'.$type.'`)
|
||||
FROM `'._DB_PREFIX_.(($type == 'order') ? pSQL($type).'s' : pSQL($type)).'`)
|
||||
|
||||
@@ -156,7 +156,7 @@ abstract class ObjectModelCore
|
||||
$sql = 'SELECT * FROM `'.pSQL(_DB_PREFIX_.$this->table).'_lang`
|
||||
WHERE `'.$this->identifier.'` = '.(int)$id
|
||||
.(($this->id_shop) ? ' AND `id_shop` = '.$this->id_shop : '');
|
||||
$result = Db::getInstance()->ExecuteS($sql);
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
if ($result)
|
||||
foreach ($result as $row)
|
||||
foreach ($row AS $key => $value)
|
||||
@@ -342,13 +342,13 @@ abstract class ObjectModelCore
|
||||
$this->clearCache();
|
||||
|
||||
/* Database deletion */
|
||||
$result = Db::getInstance()->Execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->table).'` WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
||||
$result = Db::getInstance()->execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->table).'` WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
||||
if (!$result)
|
||||
return false;
|
||||
|
||||
/* Database deletion for multilingual fields related to the object */
|
||||
if (method_exists($this, 'getTranslationsFieldsChild'))
|
||||
Db::getInstance()->Execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->table).'_lang` WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
||||
Db::getInstance()->execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->table).'_lang` WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ abstract class ObjectModelCore
|
||||
$this->active = (int)(!$this->active);
|
||||
|
||||
/* Change status to active/inactive */
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'.pSQL(_DB_PREFIX_.$this->table).'`
|
||||
SET `active` = !`active`
|
||||
WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
||||
@@ -733,12 +733,12 @@ abstract class ObjectModelCore
|
||||
'.($sql_sort != '' ? $sql_sort : '').'
|
||||
'.($sql_limit != '' ? $sql_limit : '').'
|
||||
';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($query);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
}
|
||||
|
||||
public function getFieldsRequiredDatabase($all = false)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT id_required_field, object_name, field_name
|
||||
FROM '._DB_PREFIX_.'required_field
|
||||
'.(!$all ? 'WHERE object_name = \''.pSQL(get_class($this)).'\'' : ''));
|
||||
@@ -749,7 +749,7 @@ abstract class ObjectModelCore
|
||||
if (!is_array($fields))
|
||||
return false;
|
||||
|
||||
if (!Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'required_field WHERE object_name = \''.pSQL(get_class($this)).'\''))
|
||||
if (!Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'required_field WHERE object_name = \''.pSQL(get_class($this)).'\''))
|
||||
return false;
|
||||
|
||||
foreach ($fields AS $field)
|
||||
@@ -807,7 +807,7 @@ abstract class ObjectModelCore
|
||||
}
|
||||
|
||||
if (!empty($sql))
|
||||
return Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.$this->table.'_'.$type.'` (`'.$this->identifier.'`, `id_'.$type.'`) VALUES '.rtrim($sql,','));
|
||||
return Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.$this->table.'_'.$type.'` (`'.$this->identifier.'`, `id_'.$type.'`) VALUES '.rtrim($sql,','));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -841,7 +841,7 @@ abstract class ObjectModelCore
|
||||
$sql = 'SELECT id_shop
|
||||
FROM '._DB_PREFIX_.$this->table.'_shop
|
||||
WHERE '.$this->identifier.' = '.(int)$id;
|
||||
if ($results = Db::getInstance()->ExecuteS($sql))
|
||||
if ($results = Db::getInstance()->executeS($sql))
|
||||
{
|
||||
$ids = array();
|
||||
foreach ($results as $row)
|
||||
|
||||
+16
-16
@@ -355,12 +355,12 @@ class OrderCore extends ObjectModel
|
||||
return false;
|
||||
|
||||
if ($this->hasBeenDelivered())
|
||||
return Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customization` SET `quantity_returned` = `quantity_returned` + '.(int)($quantity).' WHERE `id_customization` = '.(int)($id_customization).' AND `id_cart` = '.(int)($this->id_cart).' AND `id_product` = '.(int)($orderDetail->product_id));
|
||||
return Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'customization` SET `quantity_returned` = `quantity_returned` + '.(int)($quantity).' WHERE `id_customization` = '.(int)($id_customization).' AND `id_cart` = '.(int)($this->id_cart).' AND `id_product` = '.(int)($orderDetail->product_id));
|
||||
elseif ($this->hasBeenPaid())
|
||||
return Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customization` SET `quantity_refunded` = `quantity_refunded` + '.(int)($quantity).' WHERE `id_customization` = '.(int)($id_customization).' AND `id_cart` = '.(int)($this->id_cart).' AND `id_product` = '.(int)($orderDetail->product_id));
|
||||
if (!Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customization` SET `quantity` = `quantity` - '.(int)($quantity).' WHERE `id_customization` = '.(int)($id_customization).' AND `id_cart` = '.(int)($this->id_cart).' AND `id_product` = '.(int)($orderDetail->product_id)))
|
||||
return Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'customization` SET `quantity_refunded` = `quantity_refunded` + '.(int)($quantity).' WHERE `id_customization` = '.(int)($id_customization).' AND `id_cart` = '.(int)($this->id_cart).' AND `id_product` = '.(int)($orderDetail->product_id));
|
||||
if (!Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'customization` SET `quantity` = `quantity` - '.(int)($quantity).' WHERE `id_customization` = '.(int)($id_customization).' AND `id_cart` = '.(int)($this->id_cart).' AND `id_product` = '.(int)($orderDetail->product_id)))
|
||||
return false;
|
||||
if (!Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization` WHERE `quantity` = 0'))
|
||||
if (!Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customization` WHERE `quantity` = 0'))
|
||||
return false;
|
||||
return $this->_deleteProduct($orderDetail, (int)($quantity));
|
||||
}
|
||||
@@ -380,7 +380,7 @@ class OrderCore extends ObjectModel
|
||||
if (!isset(self::$_historyCache[$id_order_state]) OR $no_hidden)
|
||||
{
|
||||
$id_lang = $id_lang ? (int)($id_lang) : 'o.`id_lang`';
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT oh.*, e.`firstname` AS employee_firstname, e.`lastname` AS employee_lastname, osl.`name` AS ostate_name
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON o.`id_order` = oh.`id_order`
|
||||
@@ -400,7 +400,7 @@ class OrderCore extends ObjectModel
|
||||
|
||||
public function getProductsDetail()
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_detail` od
|
||||
WHERE od.`id_order` = '.(int)($this->id));
|
||||
@@ -532,7 +532,7 @@ class OrderCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'order_detail` od
|
||||
WHERE od.`id_order` = '.(int)($this->id).'
|
||||
AND `download_hash` <> \'\'';
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -570,7 +570,7 @@ class OrderCore extends ObjectModel
|
||||
*/
|
||||
public function getDiscounts($details = false)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_discount` od '.
|
||||
($details ? 'LEFT JOIN `'._DB_PREFIX_.'discount` d ON (d.`id_discount` = od.`id_discount`)' : '').'
|
||||
@@ -647,7 +647,7 @@ class OrderCore extends ObjectModel
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT o.*, (SELECT SUM(od.`product_quantity`) FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = o.`id_order`) nb_products
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
WHERE o.`id_customer` = '.(int)$id_customer.'
|
||||
@@ -658,7 +658,7 @@ class OrderCore extends ObjectModel
|
||||
|
||||
foreach ($res AS $key => $val)
|
||||
{
|
||||
$res2 = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$res2 = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT os.`id_order_state`, osl.`name` AS order_state, os.`invoice`
|
||||
FROM `'._DB_PREFIX_.'order_history` oh
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = oh.`id_order_state`)
|
||||
@@ -680,7 +680,7 @@ class OrderCore extends ObjectModel
|
||||
'.Context::getContext()->shop->sqlRestriction()
|
||||
.($type ? ' AND '.pSQL(strval($type)).'_number != 0' : '')
|
||||
.($id_customer ? ' AND id_customer = '.(int)($id_customer) : '');
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
$orders = array();
|
||||
foreach ($result AS $order)
|
||||
@@ -708,7 +708,7 @@ class OrderCore extends ObjectModel
|
||||
'.Context::getContext()->shop->sqlRestriction(false, 'o').'
|
||||
ORDER BY o.`date_add` DESC
|
||||
'.((int)$limit ? 'LIMIT 0, '.(int)$limit : '');
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
|
||||
public static function getOrdersIdInvoiceByDate($date_from, $date_to, $id_customer = NULL, $type = NULL)
|
||||
@@ -720,7 +720,7 @@ class OrderCore extends ObjectModel
|
||||
.($type ? ' AND '.pSQL(strval($type)).'_number != 0' : '')
|
||||
.($id_customer ? ' AND id_customer = '.(int)($id_customer) : '').
|
||||
' ORDER BY invoice_date ASC';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
$orders = array();
|
||||
foreach ($result AS $order)
|
||||
@@ -741,7 +741,7 @@ class OrderCore extends ObjectModel
|
||||
)
|
||||
'.Context::getContext()->shop->sqlRestriction(false, 'o').'
|
||||
ORDER BY invoice_date ASC';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
$orders = array();
|
||||
foreach ($result AS $order)
|
||||
@@ -884,7 +884,7 @@ class OrderCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'orders`)
|
||||
tmp )';
|
||||
// a way to avoid duplicate invoice number
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'orders`
|
||||
SET `invoice_number` = '.$number.', `invoice_date` = \''.date('Y-m-d H:i:s').'\'
|
||||
WHERE `id_order` = '.(int)$this->id
|
||||
@@ -1030,7 +1030,7 @@ class OrderCore extends ObjectModel
|
||||
|
||||
public function deleteAssociations()
|
||||
{
|
||||
return (Db::getInstance()->Execute('
|
||||
return (Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'order_detail`
|
||||
WHERE `id_order` = '.(int)($this->id)) !== false);
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ class OrderDetailCore extends ObjectModel
|
||||
SET `download_nb` = `download_nb` + '.(int)($increment).'
|
||||
WHERE `id_order_detail`= '.(int)($id_order_detail).'
|
||||
LIMIT 1';
|
||||
return Db::getInstance()->Execute($sql);
|
||||
return Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,7 +236,7 @@ class OrderDetailCore extends ObjectModel
|
||||
|
||||
$computation_method = 1;
|
||||
$taxes = array();
|
||||
if ($results = Db::getInstance()->ExecuteS($sql))
|
||||
if ($results = Db::getInstance()->executeS($sql))
|
||||
{
|
||||
|
||||
foreach ($results AS $result)
|
||||
@@ -267,7 +267,7 @@ class OrderDetailCore extends ObjectModel
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'order_detail_tax` (id_order_detail, id_tax)
|
||||
VALUES '.$values;
|
||||
|
||||
return Db::getInstance()->Execute($sql);
|
||||
return Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ class OrderMessageCore extends ObjectModel
|
||||
|
||||
public static function getOrderMessages($id_lang)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT om.id_order_message, oml.name, oml.message
|
||||
FROM '._DB_PREFIX_.'order_message om
|
||||
LEFT JOIN '._DB_PREFIX_.'order_message_lang oml ON (oml.id_order_message = om.id_order_message)
|
||||
|
||||
@@ -136,7 +136,7 @@ class OrderReturnCore extends ObjectModel
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
$data = Db::getInstance()->ExecuteS('
|
||||
$data = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_return`
|
||||
WHERE `id_customer` = '.(int)($customer_id).
|
||||
@@ -153,7 +153,7 @@ class OrderReturnCore extends ObjectModel
|
||||
|
||||
public static function getOrdersReturnDetail($id_order_return)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_return_detail`
|
||||
WHERE `id_order_return` = '.(int)($id_order_return));
|
||||
@@ -199,7 +199,7 @@ class OrderReturnCore extends ObjectModel
|
||||
|
||||
public static function deleteOrderReturnDetail($id_order_return, $id_order_detail, $id_customization = 0)
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'order_return_detail` WHERE `id_order_detail` = '.(int)($id_order_detail).' AND `id_order_return` = '.(int)($id_order_return).' AND `id_customization` = '.(int)($id_customization));
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'order_return_detail` WHERE `id_order_detail` = '.(int)($id_order_detail).' AND `id_order_return` = '.(int)($id_order_return).' AND `id_customization` = '.(int)($id_customization));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class OrderReturnStateCore extends ObjectModel
|
||||
*/
|
||||
public static function getOrderReturnStates($id_lang)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_return_state` ors
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_return_state_lang` orsl ON (ors.`id_order_return_state` = orsl.`id_order_return_state` AND orsl.`id_lang` = '.(int)($id_lang).')
|
||||
|
||||
@@ -80,7 +80,7 @@ class OrderSlipCore extends ObjectModel
|
||||
|
||||
public static function getOrdersSlip($customer_id, $order_id = false)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_slip`
|
||||
WHERE `id_customer` = '.(int)($customer_id).
|
||||
@@ -90,7 +90,7 @@ class OrderSlipCore extends ObjectModel
|
||||
|
||||
public static function getOrdersSlipDetail($id_order_slip = true, $id_order_detail = false)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
|
||||
($id_order_detail ? 'SELECT SUM(`product_quantity`) AS `total`' : 'SELECT *').
|
||||
'FROM `'._DB_PREFIX_.'order_slip_detail`'
|
||||
.($id_order_slip ? ' WHERE `id_order_slip` = '.(int)($id_order_slip) : '')
|
||||
@@ -131,7 +131,7 @@ class OrderSlipCore extends ObjectModel
|
||||
|
||||
public function getProducts()
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *, osd.product_quantity
|
||||
FROM `'._DB_PREFIX_.'order_slip_detail` osd
|
||||
INNER JOIN `'._DB_PREFIX_.'order_detail` od ON osd.id_order_detail = od.id_order_detail
|
||||
@@ -149,7 +149,7 @@ class OrderSlipCore extends ObjectModel
|
||||
|
||||
public static function getSlipsIdByDate($dateFrom, $dateTo)
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT `id_order_slip`
|
||||
FROM `'._DB_PREFIX_.'order_slip`
|
||||
WHERE `date_add` BETWEEN \''.pSQL($dateFrom).' 00:00:00\' AND \''.pSQL($dateTo).' 23:59:59\'
|
||||
|
||||
@@ -101,7 +101,7 @@ class OrderStateCore extends ObjectModel
|
||||
*/
|
||||
public static function getOrderStates($id_lang)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_state` os
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)($id_lang).')
|
||||
|
||||
+7
-7
@@ -74,7 +74,7 @@ class PackCore extends Product
|
||||
|
||||
if (array_key_exists($id_product, self::$cachePackItems))
|
||||
return self::$cachePackItems[$id_product];
|
||||
$result = Db::getInstance()->ExecuteS('SELECT id_product_item, quantity FROM '._DB_PREFIX_.'pack where id_product_pack = '.(int)($id_product));
|
||||
$result = Db::getInstance()->executeS('SELECT id_product_item, quantity FROM '._DB_PREFIX_.'pack where id_product_pack = '.(int)($id_product));
|
||||
$arrayResult = array();
|
||||
foreach ($result AS $row)
|
||||
{
|
||||
@@ -116,7 +116,7 @@ class PackCore extends Product
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE a.`id_product_pack` = '.(int)$id_product;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if (!$full)
|
||||
return $result;
|
||||
|
||||
@@ -156,7 +156,7 @@ class PackCore extends Product
|
||||
AND p.`id_product` IN ('.$packs.')';
|
||||
if ($limit)
|
||||
$sql .= ' LIMIT '.(int)$limit;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if (!$full)
|
||||
return $result;
|
||||
|
||||
@@ -169,8 +169,8 @@ class PackCore extends Product
|
||||
|
||||
public static function deleteItems($id_product)
|
||||
{
|
||||
return Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product SET cache_is_pack = 0 WHERE id_product = '.(int)($id_product).' LIMIT 1') &&
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'pack` WHERE `id_product_pack` = '.(int)($id_product)) &&
|
||||
return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET cache_is_pack = 0 WHERE id_product = '.(int)($id_product).' LIMIT 1') &&
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'pack` WHERE `id_product_pack` = '.(int)($id_product)) &&
|
||||
Configuration::updateGlobalValue('PS_PACK_FEATURE_ACTIVE', self::isCurrentlyUsed());
|
||||
}
|
||||
|
||||
@@ -184,14 +184,14 @@ class PackCore extends Product
|
||||
*/
|
||||
public static function addItem($id_product, $id_item, $qty)
|
||||
{
|
||||
return Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product SET cache_is_pack = 1 WHERE id_product = '.(int)($id_product).' LIMIT 1') &&
|
||||
return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET cache_is_pack = 1 WHERE id_product = '.(int)($id_product).' LIMIT 1') &&
|
||||
Db::getInstance()->AutoExecute(_DB_PREFIX_.'pack', array('id_product_pack' => (int)($id_product), 'id_product_item' => (int)($id_item), 'quantity' => (int)($qty)), 'INSERT') &&
|
||||
Configuration::updateGlobalValue('PS_PACK_FEATURE_ACTIVE', '1');
|
||||
}
|
||||
|
||||
public static function duplicate($id_product_old, $id_product_new)
|
||||
{
|
||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'pack (id_product_pack, id_product_item, quantity)
|
||||
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'pack (id_product_pack, id_product_item, quantity)
|
||||
(SELECT '.(int)($id_product_new).', id_product_item, quantity FROM '._DB_PREFIX_.'pack WHERE id_product_pack = '.(int)($id_product_old).')');
|
||||
|
||||
// If return query result, a non-pack product will return false
|
||||
|
||||
+1
-1
@@ -116,7 +116,7 @@ class PageCore extends ObjectModel
|
||||
WHERE `id_date_range` = '.(int)$id_date_range.'
|
||||
AND `id_page` = '.(int)$id_page.'
|
||||
AND `id_shop` = ' . $context->shop->getID();
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
|
||||
// If no one has seen the page in this date range, it is added
|
||||
if (Db::getInstance()->Affected_Rows() == 0)
|
||||
|
||||
@@ -42,14 +42,14 @@ abstract class PaymentModuleCore extends Module
|
||||
// Insert currencies availability
|
||||
if ($this->currencies_mode == 'checkbox')
|
||||
{
|
||||
if (!Db::getInstance()->Execute('
|
||||
if (!Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'module_currency` (id_module, id_currency)
|
||||
SELECT '.(int)($this->id).', id_currency FROM `'._DB_PREFIX_.'currency` WHERE deleted = 0'))
|
||||
return false;
|
||||
}
|
||||
elseif ($this->currencies_mode == 'radio')
|
||||
{
|
||||
if (!Db::getInstance()->Execute('
|
||||
if (!Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'module_currency` (id_module, id_currency)
|
||||
VALUES ('.(int)($this->id).', -2)'))
|
||||
return false;
|
||||
@@ -58,11 +58,11 @@ abstract class PaymentModuleCore extends Module
|
||||
Tools::displayError('No currency mode for payment module');
|
||||
|
||||
// Insert countries availability
|
||||
$return = Db::getInstance()->Execute('
|
||||
$return = Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'module_country` (id_module, id_country)
|
||||
SELECT '.(int)($this->id).', id_country FROM `'._DB_PREFIX_.'country` WHERE active = 1');
|
||||
// Insert group availability
|
||||
$return &= Db::getInstance()->Execute('
|
||||
$return &= Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'module_group` (id_module, id_group)
|
||||
SELECT '.(int)($this->id).', id_group FROM `'._DB_PREFIX_.'group`');
|
||||
|
||||
@@ -71,9 +71,9 @@ abstract class PaymentModuleCore extends Module
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
if (!Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_country` WHERE id_module = '.(int)($this->id))
|
||||
OR !Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_currency` WHERE id_module = '.(int)($this->id))
|
||||
OR !Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_group` WHERE id_module = '.(int)($this->id)))
|
||||
if (!Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'module_country` WHERE id_module = '.(int)($this->id))
|
||||
OR !Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'module_currency` WHERE id_module = '.(int)($this->id))
|
||||
OR !Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'module_group` WHERE id_module = '.(int)($this->id)))
|
||||
return false;
|
||||
return parent::uninstall();
|
||||
}
|
||||
@@ -563,7 +563,7 @@ abstract class PaymentModuleCore extends Module
|
||||
|
||||
if (!empty($values))
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'module_currency` (`id_module`, `id_currency`)
|
||||
VALUES '.rtrim($values, ',')
|
||||
);
|
||||
|
||||
+122
-122
@@ -458,7 +458,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function updatePosition($way, $position)
|
||||
{
|
||||
if (!$res = Db::getInstance()->ExecuteS('
|
||||
if (!$res = Db::getInstance()->executeS('
|
||||
SELECT cp.`id_product`, cp.`position`, cp.`id_category`
|
||||
FROM `'._DB_PREFIX_.'category_product` cp
|
||||
WHERE cp.`id_category` = '.(int)(Tools::getValue('id_category', 1)).'
|
||||
@@ -475,7 +475,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
// < and > statements rather than BETWEEN operator
|
||||
// since BETWEEN is treated differently according to databases
|
||||
return (Db::getInstance()->Execute('
|
||||
return (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'category_product`
|
||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||
WHERE `position`
|
||||
@@ -483,7 +483,7 @@ class ProductCore extends ObjectModel
|
||||
? '> '.(int)($movedProduct['position']).' AND `position` <= '.(int)($position)
|
||||
: '< '.(int)($movedProduct['position']).' AND `position` >= '.(int)($position)).'
|
||||
AND `id_category`='.(int)($movedProduct['id_category']))
|
||||
AND Db::getInstance()->Execute('
|
||||
AND Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'category_product`
|
||||
SET `position` = '.(int)($position).'
|
||||
WHERE `id_product` = '.(int)($movedProduct['id_product']).'
|
||||
@@ -500,7 +500,7 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
$return = true;
|
||||
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `id_product`
|
||||
FROM `'._DB_PREFIX_.'category_product`
|
||||
WHERE `id_category` = '.(int)($id_category).'
|
||||
@@ -508,7 +508,7 @@ class ProductCore extends ObjectModel
|
||||
$sizeof = count($result);
|
||||
|
||||
for ($i = 0; $i < $sizeof; $i++)
|
||||
$return &= Db::getInstance()->Execute('
|
||||
$return &= Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'category_product`
|
||||
SET `position` = '.(int)($i).'
|
||||
WHERE `id_category` = '.(int)($id_category).'
|
||||
@@ -566,7 +566,7 @@ class ProductCore extends ObjectModel
|
||||
public static function updateDefaultAttribute($id_product)
|
||||
{
|
||||
$id_product_attribute = self::getDefaultAttribute($id_product);
|
||||
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product SET cache_default_attribute = '.(int)($id_product_attribute).' WHERE id_product = '.(int)($id_product).' LIMIT 1');
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET cache_default_attribute = '.(int)($id_product_attribute).' WHERE id_product = '.(int)($id_product).' LIMIT 1');
|
||||
}
|
||||
|
||||
public function validateFieldsLang($die = true, $errorReturn = false)
|
||||
@@ -646,7 +646,7 @@ class ProductCore extends ObjectModel
|
||||
$currentCategories = $this->getCategories();
|
||||
|
||||
// for new categ, put product at last position
|
||||
$resCategNewPos = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$resCategNewPos = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT id_category, MAX(position)+1 newPos
|
||||
FROM `'._DB_PREFIX_.'category_product`
|
||||
WHERE `id_category` IN('.implode(',', array_map('intval', $categories)).')
|
||||
@@ -664,7 +664,7 @@ class ProductCore extends ObjectModel
|
||||
if (!in_array($newIdCateg, $currentCategories))
|
||||
$productCats[] = '('.$newIdCateg.', '.$this->id.', '.$newCategPos[$newIdCateg].')';
|
||||
if (count($productCats))
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'category_product` (`id_category`, `id_product`, `position`)
|
||||
VALUES '.implode(',', $productCats));
|
||||
|
||||
@@ -684,7 +684,7 @@ class ProductCore extends ObjectModel
|
||||
return false;
|
||||
|
||||
// get max position in each categories
|
||||
$result = Db::getInstance()->ExecuteS('SELECT `id_category`
|
||||
$result = Db::getInstance()->executeS('SELECT `id_category`
|
||||
FROM `'._DB_PREFIX_.'category_product`
|
||||
WHERE `id_category` NOT IN('.implode(',', array_map('intval', $categories)).')
|
||||
AND id_product = '.$this->id.'');
|
||||
@@ -712,8 +712,8 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deleteCategory($id_category, $cleanPositions = true)
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS('SELECT `id_category` FROM `'._DB_PREFIX_.'category_product` WHERE `id_product` = '.(int)($this->id).' AND id_category = '.(int)$id_category.'');
|
||||
$return = Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category_product` WHERE `id_product` = '.(int)($this->id).' AND id_category = '.(int)$id_category.'');
|
||||
$result = Db::getInstance()->executeS('SELECT `id_category` FROM `'._DB_PREFIX_.'category_product` WHERE `id_product` = '.(int)($this->id).' AND id_category = '.(int)$id_category.'');
|
||||
$return = Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_product` WHERE `id_product` = '.(int)($this->id).' AND id_category = '.(int)$id_category.'');
|
||||
if ($cleanPositions === true)
|
||||
foreach ($result as $row)
|
||||
$this->cleanPositions((int)$row['id_category']);
|
||||
@@ -728,10 +728,10 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deleteCategories($cleanPositions = false)
|
||||
{
|
||||
$return = Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category_product` WHERE `id_product` = '.(int)($this->id));
|
||||
$return = Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_product` WHERE `id_product` = '.(int)($this->id));
|
||||
if ($cleanPositions === true)
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS('SELECT `id_category` FROM `'._DB_PREFIX_.'category_product` WHERE `id_product` = '.(int)($this->id));
|
||||
$result = Db::getInstance()->executeS('SELECT `id_category` FROM `'._DB_PREFIX_.'category_product` WHERE `id_product` = '.(int)($this->id));
|
||||
foreach ($result as $row)
|
||||
$this->cleanPositions((int)($row['id_category']));
|
||||
}
|
||||
@@ -745,8 +745,8 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deleteTags()
|
||||
{
|
||||
return (Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_tag` WHERE `id_product` = '.(int)($this->id))
|
||||
AND Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'tag` WHERE `id_tag` NOT IN (SELECT `id_tag` FROM `'._DB_PREFIX_.'product_tag`)'));
|
||||
return (Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_tag` WHERE `id_product` = '.(int)($this->id))
|
||||
AND Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'tag` WHERE `id_tag` NOT IN (SELECT `id_tag` FROM `'._DB_PREFIX_.'product_tag`)'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -756,7 +756,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deleteCartProducts()
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cart_product` WHERE `id_product` = '.(int)($this->id));
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'cart_product` WHERE `id_product` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -766,7 +766,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deleteImages()
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `id_image`
|
||||
FROM `'._DB_PREFIX_.'image`
|
||||
WHERE `id_product` = '.(int)($this->id));
|
||||
@@ -830,7 +830,7 @@ class ProductCore extends ObjectModel
|
||||
($only_active ? ' AND p.`active` = 1' : '').'
|
||||
ORDER BY '.(isset($orderByPrefix) ? pSQL($orderByPrefix).'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).
|
||||
($limit > 0 ? ' LIMIT '.(int)$start.','.(int)$limit : '');
|
||||
$rq = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$rq = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if ($orderBy == 'price')
|
||||
Tools::orderbyPrice($rq, $orderWay);
|
||||
return ($rq);
|
||||
@@ -847,12 +847,12 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.$context->shop->sqlLang('pl').')
|
||||
WHERE pl.`id_lang` = '.(int)($id_lang).'
|
||||
ORDER BY pl.`name`';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
|
||||
public function isNew()
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT id_product FROM `'._DB_PREFIX_.'product` p
|
||||
WHERE 1
|
||||
AND id_product = '.(int)($this->id).'
|
||||
@@ -866,7 +866,7 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
if (!Combination::isFeatureActive())
|
||||
return false;
|
||||
$result = Db::getInstance()->ExecuteS('SELECT pac.`id_attribute`, pac.`id_product_attribute`
|
||||
$result = Db::getInstance()->executeS('SELECT pac.`id_attribute`, pac.`id_product_attribute`
|
||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
|
||||
WHERE pa.`id_product` = '.(int)($this->id));
|
||||
@@ -944,7 +944,7 @@ class ProductCore extends ObjectModel
|
||||
foreach ($id_images as $id_image)
|
||||
$query .= '('.(int)($id_product_attribute).', '.(int)($id_image).'), ';
|
||||
$query = trim($query, ', ');
|
||||
if (!Db::getInstance()->Execute($query))
|
||||
if (!Db::getInstance()->execute($query))
|
||||
return false;
|
||||
return (int)($id_product_attribute);
|
||||
}
|
||||
@@ -952,7 +952,7 @@ class ProductCore extends ObjectModel
|
||||
public function addCombinationEntity($wholesale_price, $price, $weight, $unit_impact, $ecotax, $quantity, $id_images, $reference, $supplier_reference, $ean13, $default, $location = null, $upc = null)
|
||||
{
|
||||
$id_product_attribute = $this->addProductAttribute($price, $weight, $unit_impact, $ecotax, $quantity, $id_images, $reference, $supplier_reference, $ean13, $default, $location, $upc);
|
||||
$result = Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'product_attribute` SET `wholesale_price` = '.(float)$wholesale_price.' WHERE `id_product_attribute` = '.(int)$id_product_attribute);
|
||||
$result = Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'product_attribute` SET `wholesale_price` = '.(float)$wholesale_price.' WHERE `id_product_attribute` = '.(int)$id_product_attribute);
|
||||
if (!$id_product_attribute OR !$result)
|
||||
return false;
|
||||
return $id_product_attribute;
|
||||
@@ -990,10 +990,10 @@ class ProductCore extends ObjectModel
|
||||
$values[] = '('.implode(', ', $v).')';
|
||||
$keys[] = implode(', ', $k);
|
||||
}
|
||||
Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'product_attribute` ('.$keys[0].') VALUES '.implode(', ', $values));
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'product_attribute` ('.$keys[0].') VALUES '.implode(', ', $values));
|
||||
|
||||
return (array_map(create_function('$elem', 'return $elem[\'id_product_attribute\'];'),
|
||||
Db::getInstance()->ExecuteS('
|
||||
Db::getInstance()->executeS('
|
||||
SELECT `id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product_attribute` >= '.(int)(Db::getInstance()->Insert_ID())
|
||||
)));
|
||||
}
|
||||
@@ -1003,7 +1003,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deleteDefaultAttributes()
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'product_attribute`
|
||||
SET `default_on` = 0
|
||||
WHERE `id_product` = '.(int)($this->id));
|
||||
@@ -1011,12 +1011,12 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public function setDefaultAttribute($id_product_attribute)
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'product_attribute`
|
||||
SET `default_on` = 1
|
||||
WHERE `id_product` = '.(int)$this->id.'
|
||||
AND `id_product_attribute` = '.(int)$id_product_attribute) &&
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'product`
|
||||
SET `cache_default_attribute` = '.(int)$id_product_attribute.'
|
||||
WHERE `id_product` = '.(int)$this->id.' LIMIT 1');
|
||||
@@ -1039,7 +1039,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function updateProductAttribute($id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax, $quantity, $id_images, $reference, $supplier_reference, $ean13, $default, $location = null, $upc = null, $minimal_quantity, $available_date)
|
||||
{
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||
WHERE `id_product_attribute` = '.(int)($id_product_attribute));
|
||||
|
||||
@@ -1067,7 +1067,7 @@ class ProductCore extends ObjectModel
|
||||
$this->setStock($data['quantity'], $id_product_attribute);
|
||||
}
|
||||
|
||||
if (!Db::getInstance()->AutoExecute(_DB_PREFIX_.'product_attribute', $data, 'UPDATE', '`id_product_attribute` = '.(int)($id_product_attribute)) OR !Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_attribute_image` WHERE `id_product_attribute` = '.(int)($id_product_attribute)))
|
||||
if (!Db::getInstance()->AutoExecute(_DB_PREFIX_.'product_attribute', $data, 'UPDATE', '`id_product_attribute` = '.(int)($id_product_attribute)) OR !Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_attribute_image` WHERE `id_product_attribute` = '.(int)($id_product_attribute)))
|
||||
return false;
|
||||
if ($quantity)
|
||||
Hook::updateProductAttribute($id_product_attribute);
|
||||
@@ -1078,7 +1078,7 @@ class ProductCore extends ObjectModel
|
||||
foreach ($id_images as $id_image)
|
||||
$query .= '('.(int)($id_product_attribute).', '.(int)($id_image).'), ';
|
||||
$query = trim($query, ', ');
|
||||
return Db::getInstance()->Execute($query);
|
||||
return Db::getInstance()->execute($query);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1086,7 +1086,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function updateQuantityProductWithAttributeQuantity()
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'product`
|
||||
SET `quantity` = IFNULL(
|
||||
(
|
||||
@@ -1105,11 +1105,11 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
Module::hookExec('deleteProductAttribute', array('id_product_attribute' => 0, 'id_product' => $this->id, 'deleteAllAttributes' => true));
|
||||
|
||||
$result = Db::getInstance()->Execute('
|
||||
$result = Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||
WHERE `id_product_attribute` IN (SELECT `id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)($this->id).')');
|
||||
$result2 = Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)($this->id));
|
||||
$result3 = Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_download` WHERE `id_product` = '.(int)($this->id));
|
||||
$result2 = Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)($this->id));
|
||||
$result3 = Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_download` WHERE `id_product` = '.(int)($this->id));
|
||||
|
||||
return ($result & $result2 & $result3);
|
||||
}
|
||||
@@ -1121,7 +1121,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deleteAttributesImpacts()
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'attribute_impact` WHERE `id_product` = '.(int)($this->id));
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'attribute_impact` WHERE `id_product` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1141,7 +1141,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deleteAttachments()
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'product_attachment`
|
||||
WHERE `id_product` = '.(int)$this->id);
|
||||
}
|
||||
@@ -1154,8 +1154,8 @@ class ProductCore extends ObjectModel
|
||||
public function deleteCustomization()
|
||||
{
|
||||
return
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field` WHERE `id_product` = '.(int)($this->id)) &&
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field_lang`
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customization_field` WHERE `id_product` = '.(int)($this->id)) &&
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customization_field_lang`
|
||||
WHERE `id_customization_field` NOT IN (SELECT id_customization_field FROM `'._DB_PREFIX_.'customization_field`)');
|
||||
}
|
||||
|
||||
@@ -1166,7 +1166,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deletePack()
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'pack` WHERE `id_product_pack` = '.(int)($this->id).' OR `id_product_item` = '.(int)($this->id));
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'pack` WHERE `id_product_pack` = '.(int)($this->id).' OR `id_product_item` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1176,7 +1176,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deleteProductSale()
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_sale` WHERE `id_product` = '.(int)($this->id));
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_sale` WHERE `id_product` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1186,7 +1186,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deleteSceneProducts()
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'scene_products` WHERE `id_product` = '.(int)($this->id));
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'scene_products` WHERE `id_product` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1197,8 +1197,8 @@ class ProductCore extends ObjectModel
|
||||
public function deleteSearchIndexes()
|
||||
{
|
||||
return
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'search_index` WHERE `id_product` = '.(int)($this->id)) &&
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'search_word` WHERE `id_word` NOT IN (SELECT id_word FROM `'._DB_PREFIX_.'search_index`)');
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'search_index` WHERE `id_product` = '.(int)($this->id)) &&
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'search_word` WHERE `id_word` NOT IN (SELECT id_word FROM `'._DB_PREFIX_.'search_index`)');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1222,7 +1222,7 @@ class ProductCore extends ObjectModel
|
||||
if (!Validate::isValuesList($attributesList))
|
||||
die(Tools::displayError());
|
||||
|
||||
$result = Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'product_attribute_combination` (`id_product_attribute`, `id_attribute`) VALUES '.$attributesList);
|
||||
$result = Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'product_attribute_combination` (`id_product_attribute`, `id_attribute`) VALUES '.$attributesList);
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1234,7 +1234,7 @@ class ProductCore extends ObjectModel
|
||||
foreach ($combinations[$nb] as $id_attribute)
|
||||
$attributesList .= '('.(int)($id_product_attribute).','.(int)($id_attribute).'),';
|
||||
$attributesList = rtrim($attributesList, ',');
|
||||
return Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'product_attribute_combination` (`id_product_attribute`, `id_attribute`) VALUES '.$attributesList);
|
||||
return Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'product_attribute_combination` (`id_product_attribute`, `id_attribute`) VALUES '.$attributesList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1253,15 +1253,15 @@ class ProductCore extends ObjectModel
|
||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'product_attribute`
|
||||
WHERE `id_product_attribute` = '.$id_product_attribute.'
|
||||
AND `id_product` = '.$this->id;
|
||||
$result = Db::getInstance()->Execute($sql);
|
||||
$result = Db::getInstance()->execute($sql);
|
||||
|
||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||
WHERE `id_product_attribute` = '.$id_product_attribute;
|
||||
$result2 = Db::getInstance()->Execute($sql);
|
||||
$result2 = Db::getInstance()->execute($sql);
|
||||
|
||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'cart_product`
|
||||
WHERE `id_product_attribute` = '.$id_product_attribute;
|
||||
$result3 = Db::getInstance()->Execute($sql);
|
||||
$result3 = Db::getInstance()->execute($sql);
|
||||
return ($result AND $result2 AND $result3);
|
||||
}
|
||||
|
||||
@@ -1272,7 +1272,7 @@ class ProductCore extends ObjectModel
|
||||
public function deleteFeatures()
|
||||
{
|
||||
// List products features
|
||||
$features = Db::getInstance()->ExecuteS('
|
||||
$features = Db::getInstance()->executeS('
|
||||
SELECT p.*, f.*
|
||||
FROM `'._DB_PREFIX_.'feature_product` as p
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_value` as f ON (f.`id_feature_value` = p.`id_feature_value`)
|
||||
@@ -1280,15 +1280,15 @@ class ProductCore extends ObjectModel
|
||||
foreach ($features as $tab)
|
||||
// Delete product custom features
|
||||
if ($tab['custom']) {
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'feature_value`
|
||||
WHERE `id_feature_value` = '.(int)($tab['id_feature_value']));
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'feature_value_lang`
|
||||
WHERE `id_feature_value` = '.(int)($tab['id_feature_value']));
|
||||
}
|
||||
// Delete product features
|
||||
$result = Db::getInstance()->Execute('
|
||||
$result = Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'feature_product`
|
||||
WHERE `id_product` = '.(int)($this->id));
|
||||
return ($result);
|
||||
@@ -1314,19 +1314,19 @@ class ProductCore extends ObjectModel
|
||||
'.Product::sqlStock('pa', 'pa').'
|
||||
WHERE pa.`id_product` = '.(int)$this->id.'
|
||||
ORDER BY pa.`id_product_attribute`';
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
public function getCombinationImages($id_lang)
|
||||
{
|
||||
if (!Combination::isFeatureActive())
|
||||
return false;
|
||||
if (!$productAttributes = Db::getInstance()->ExecuteS('SELECT `id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)($this->id)))
|
||||
if (!$productAttributes = Db::getInstance()->executeS('SELECT `id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)($this->id)))
|
||||
return false;
|
||||
$ids = array();
|
||||
foreach ($productAttributes as $productAttribute)
|
||||
$ids[] = (int)($productAttribute['id_product_attribute']);
|
||||
if (!$result = Db::getInstance()->ExecuteS('
|
||||
if (!$result = Db::getInstance()->executeS('
|
||||
SELECT pai.`id_image`, pai.`id_product_attribute`, il.`legend`
|
||||
FROM `'._DB_PREFIX_.'product_attribute_image` pai
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (il.`id_image` = pai.`id_image`)
|
||||
@@ -1430,7 +1430,7 @@ class ProductCore extends ObjectModel
|
||||
$sql->leftOuterJoin('product_attribute pa ON (p.`id_product` = pa.`id_product` AND `default_on` = 1)');
|
||||
}
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
if ($orderBy == 'price')
|
||||
Tools::orderbyPrice($result, $orderWay);
|
||||
@@ -1582,7 +1582,7 @@ class ProductCore extends ObjectModel
|
||||
)
|
||||
ORDER BY '.(isset($orderByPrefix) ? pSQL($orderByPrefix).'.' : '').'`'.pSQL($orderBy).'`'.' '.pSQL($orderWay).'
|
||||
LIMIT '.(int)($pageNumber * $nbProducts).', '.(int)($nbProducts);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if ($orderBy == 'price')
|
||||
Tools::orderbyPrice($result, $orderWay);
|
||||
if (!$result)
|
||||
@@ -1599,7 +1599,7 @@ class ProductCore extends ObjectModel
|
||||
public static function getProductCategories($id_product = '')
|
||||
{
|
||||
$ret = array();
|
||||
if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT `id_category` FROM `'._DB_PREFIX_.'category_product`
|
||||
WHERE `id_product` = '.(int)$id_product))
|
||||
foreach ($row as $val)
|
||||
@@ -1610,7 +1610,7 @@ class ProductCore extends ObjectModel
|
||||
public static function getProductCategoriesFull($id_product = '', $id_lang)
|
||||
{
|
||||
$ret = array();
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT cp.`id_category`, cl.`name`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'category_product` cp
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cp.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').')
|
||||
WHERE cp.`id_product` = '.(int)$id_product.'
|
||||
@@ -1647,7 +1647,7 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE i.`id_product` = '.(int)$this->id.'
|
||||
ORDER BY `position`';
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2116,14 +2116,14 @@ class ProductCore extends ObjectModel
|
||||
SET quantity = quantity + '.(int)$quantity.'
|
||||
WHERE id_product = '.$this->id.'
|
||||
AND id_product_attribute = '.$id_product_attribute;
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'UPDATE '._DB_PREFIX_.'product
|
||||
SET quantity = quantity + '.(int)$quantity.'
|
||||
WHERE id_product='.$this->id;
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2135,7 +2135,7 @@ class ProductCore extends ObjectModel
|
||||
$sql = 'UPDATE '._DB_PREFIX_.'stock
|
||||
SET quantity = '.(($update) ? 'quantity + '.$quantity : $quantity).'
|
||||
WHERE id_stock = '.$id_stock;
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
else
|
||||
Db::getInstance()->autoExecute(_DB_PREFIX_.'stock', array(
|
||||
@@ -2152,7 +2152,7 @@ class ProductCore extends ObjectModel
|
||||
$sql = 'UPDATE '._DB_PREFIX_.'stock
|
||||
SET quantity = '.(($update) ? 'quantity + '.$quantity : $quantity).'
|
||||
WHERE id_stock = '.$id_stock;
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
else
|
||||
Db::getInstance()->autoExecute(_DB_PREFIX_.'stock', array(
|
||||
@@ -2291,7 +2291,7 @@ class ProductCore extends ObjectModel
|
||||
if (!$mini)
|
||||
return false;
|
||||
|
||||
if (!Db::getInstance()->Execute('
|
||||
if (!Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'product_attribute`
|
||||
SET `default_on` = 1
|
||||
WHERE `id_product_attribute` = '.(int)($mini['id_attr'])))
|
||||
@@ -2323,7 +2323,7 @@ class ProductCore extends ObjectModel
|
||||
AND al.`id_lang` = '.(int)($id_lang).'
|
||||
AND agl.`id_lang` = '.(int)($id_lang).'
|
||||
ORDER BY ag.`position` ASC, a.`position` ASC';
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2333,7 +2333,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deleteAccessories()
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'accessory` WHERE `id_product_1` = '.(int)($this->id));
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'accessory` WHERE `id_product_1` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2343,7 +2343,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function deleteFromAccessories()
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'accessory` WHERE `id_product_2` = '.(int)($this->id));
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'accessory` WHERE `id_product_2` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2364,7 +2364,7 @@ class ProductCore extends ObjectModel
|
||||
'.$context->shop->sqlAsso('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
||||
WHERE `id_product_1` = '.(int)$id_product;
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2395,7 +2395,7 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
WHERE `id_product_1` = '.(int)($this->id).
|
||||
($active ? ' AND p.`active` = 1' : '');
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql))
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
return false;
|
||||
|
||||
return $this->getProductsProperties($id_lang, $result);
|
||||
@@ -2442,7 +2442,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public static function addFeatureProductImport($id_product, $id_feature, $id_feature_value)
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'feature_product` (`id_feature`, `id_product`, `id_feature_value`)
|
||||
VALUES ('.(int)($id_feature).', '.(int)($id_product).', '.(int)($id_feature_value).')
|
||||
ON DUPLICATE KEY UPDATE `id_feature_value` = '.(int)($id_feature_value)
|
||||
@@ -2464,7 +2464,7 @@ class ProductCore extends ObjectModel
|
||||
if (!Feature::isFeatureActive())
|
||||
return array();
|
||||
if (!array_key_exists($id_product, self::$_cacheFeatures))
|
||||
self::$_cacheFeatures[$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
self::$_cacheFeatures[$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT id_feature, id_product, id_feature_value
|
||||
FROM `'._DB_PREFIX_.'feature_product`
|
||||
WHERE `id_product` = '.(int)$id_product);
|
||||
@@ -2483,7 +2483,7 @@ class ProductCore extends ObjectModel
|
||||
if (!count($productImplode))
|
||||
return;
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT id_feature, id_product, id_feature_value
|
||||
FROM `'._DB_PREFIX_.'feature_product`
|
||||
WHERE `id_product` IN ('.implode($productImplode, ',').')');
|
||||
@@ -2507,7 +2507,7 @@ class ProductCore extends ObjectModel
|
||||
if (!count($productImplode))
|
||||
return;
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT id_product, name, value, pf.id_feature
|
||||
FROM '._DB_PREFIX_.'feature_product pf
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
|
||||
@@ -2554,7 +2554,7 @@ class ProductCore extends ObjectModel
|
||||
$sql->where($where);
|
||||
Product::sqlStock('p', 'pa', false, $context->shop, $sql);
|
||||
|
||||
$result = Db::getInstance()->ExecuteS($sql);
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
|
||||
if (!$result)
|
||||
return false;
|
||||
@@ -2579,14 +2579,14 @@ class ProductCore extends ObjectModel
|
||||
$return = true;
|
||||
$combinationImages = array();
|
||||
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'product_attribute`
|
||||
WHERE `id_product` = '.(int)($id_product_old));
|
||||
foreach ($result as $row)
|
||||
{
|
||||
$id_product_attribute_old = (int)($row['id_product_attribute']);
|
||||
$result2 = Db::getInstance()->ExecuteS('
|
||||
$result2 = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||
WHERE `id_product_attribute` = '.$id_product_attribute_old);
|
||||
@@ -2618,7 +2618,7 @@ class ProductCore extends ObjectModel
|
||||
public static function _getAttributeImageAssociations($id_product_attribute)
|
||||
{
|
||||
$combinationImages = array();
|
||||
$data = Db::getInstance()->ExecuteS('
|
||||
$data = Db::getInstance()->executeS('
|
||||
SELECT `id_image`
|
||||
FROM `'._DB_PREFIX_.'product_attribute_image`
|
||||
WHERE `id_product_attribute` = '.(int)($id_product_attribute));
|
||||
@@ -2631,7 +2631,7 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
$return = true;
|
||||
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'accessory`
|
||||
WHERE `id_product_1` = '.(int)($id_product_old));
|
||||
@@ -2647,14 +2647,14 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public static function duplicateTags($id_product_old, $id_product_new)
|
||||
{
|
||||
$tags = Db::getInstance()->ExecuteS('SELECT `id_tag` FROM `'._DB_PREFIX_.'product_tag` WHERE `id_product` = '.(int)($id_product_old));
|
||||
$tags = Db::getInstance()->executeS('SELECT `id_tag` FROM `'._DB_PREFIX_.'product_tag` WHERE `id_product` = '.(int)($id_product_old));
|
||||
if (!Db::getInstance()->NumRows())
|
||||
return true;
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'product_tag` (`id_product`, `id_tag`) VALUES';
|
||||
foreach ($tags as $tag)
|
||||
$query .= ' ('.(int)($id_product_new).', '.(int)($tag['id_tag']).'),';
|
||||
$query = rtrim($query, ',');
|
||||
return Db::getInstance()->Execute($query);
|
||||
return Db::getInstance()->execute($query);
|
||||
}
|
||||
|
||||
public static function duplicateDownload($id_product_old, $id_product_new)
|
||||
@@ -2662,7 +2662,7 @@ class ProductCore extends ObjectModel
|
||||
$sql = 'SELECT `display_filename`, `filename`, `date_add`, `date_expiration`, `nb_days_accessible`, `nb_downloadable`, `active`, `is_shareable`
|
||||
FROM `'._DB_PREFIX_.'product_download`
|
||||
WHERE `id_product` = '.(int)$id_product_old;
|
||||
$resource = Db::getInstance()->Execute($sql);
|
||||
$resource = Db::getInstance()->execute($sql);
|
||||
|
||||
if (!Db::getInstance()->NumRows())
|
||||
return true;
|
||||
@@ -2670,7 +2670,7 @@ class ProductCore extends ObjectModel
|
||||
while ($row = Db::getInstance()->nextRow($resource))
|
||||
$query .= ' ('.(int)($id_product_new).', \''.pSQL($row['display_filename']).'\', \''.pSQL($row['filename']).'\', \''.pSQL($row['date_add']).'\', \''.pSQL($row['date_expiration']).'\', '.(int)($row['nb_days_accessible']).', '.(int)($row['nb_downloadable']).', '.(int)($row['active']).'), '.(int)($row['is_shareable']).'),';
|
||||
$query = rtrim($query, ',');
|
||||
return Db::getInstance()->Execute($query);
|
||||
return Db::getInstance()->execute($query);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2683,7 +2683,7 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
$return = true;
|
||||
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'feature_product`
|
||||
WHERE `id_product` = '.(int)($id_product_old));
|
||||
@@ -2728,7 +2728,7 @@ class ProductCore extends ObjectModel
|
||||
return false;
|
||||
|
||||
$customizations = array();
|
||||
if (($customizations['fields'] = Db::getInstance()->ExecuteS('
|
||||
if (($customizations['fields'] = Db::getInstance()->executeS('
|
||||
SELECT `id_customization_field`, `type`, `required`
|
||||
FROM `'._DB_PREFIX_.'customization_field`
|
||||
WHERE `id_product` = '.(int)($productId).'
|
||||
@@ -2739,7 +2739,7 @@ class ProductCore extends ObjectModel
|
||||
$customizationFieldIds = array();
|
||||
foreach ($customizations['fields'] as $customizationField)
|
||||
$customizationFieldIds[] = (int)($customizationField['id_customization_field']);
|
||||
if (($customizationLabels = Db::getInstance()->ExecuteS('
|
||||
if (($customizationLabels = Db::getInstance()->executeS('
|
||||
SELECT `id_customization_field`, `id_lang`, `name`
|
||||
FROM `'._DB_PREFIX_.'customization_field_lang`
|
||||
WHERE `id_customization_field` IN ('.implode(', ', $customizationFieldIds).')
|
||||
@@ -2781,7 +2781,7 @@ class ProductCore extends ObjectModel
|
||||
foreach ($customizations['labels'][$oldCustomizationFieldId] as $customizationLabel)
|
||||
$query .= '('.(int)($customizationFieldId).', '.(int)($customizationLabel['id_lang']).', \''.pSQL($customizationLabel['name']).'\'), ';
|
||||
$query = rtrim($query, ', ');
|
||||
if (!Db::getInstance()->Execute($query))
|
||||
if (!Db::getInstance()->execute($query))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2905,7 +2905,7 @@ class ProductCore extends ObjectModel
|
||||
return array();
|
||||
if (!array_key_exists($id_product.'-'.$id_lang, self::$_frontFeaturesCache))
|
||||
{
|
||||
self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT name, value, pf.id_feature
|
||||
FROM '._DB_PREFIX_.'feature_product pf
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
|
||||
@@ -2924,7 +2924,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public static function getAttachmentsStatic($id_lang, $id_product)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM '._DB_PREFIX_.'product_attachment pa
|
||||
LEFT JOIN '._DB_PREFIX_.'attachment a ON a.id_attachment = pa.id_attachment
|
||||
@@ -2952,7 +2952,7 @@ class ProductCore extends ObjectModel
|
||||
if (!$id_lang)
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
|
||||
if (!$result = Db::getInstance()->ExecuteS('
|
||||
if (!$result = Db::getInstance()->executeS('
|
||||
SELECT cd.`id_customization`, c.`id_product`, cfl.`id_customization_field`, c.`id_product_attribute`, cd.`type`, cd.`index`, cd.`value`, cfl.`name`
|
||||
FROM `'._DB_PREFIX_.'customized_data` cd
|
||||
NATURAL JOIN `'._DB_PREFIX_.'customization` c
|
||||
@@ -2964,7 +2964,7 @@ class ProductCore extends ObjectModel
|
||||
$customizedDatas = array();
|
||||
foreach ($result as $row)
|
||||
$customizedDatas[(int)($row['id_product'])][(int)($row['id_product_attribute'])][(int)($row['id_customization'])]['datas'][(int)($row['type'])][] = $row;
|
||||
if (!$result = Db::getInstance()->ExecuteS('SELECT `id_product`, `id_product_attribute`, `id_customization`, `quantity`, `quantity_refunded`, `quantity_returned`
|
||||
if (!$result = Db::getInstance()->executeS('SELECT `id_product`, `id_product_attribute`, `id_customization`, `quantity`, `quantity_refunded`, `quantity_returned`
|
||||
FROM `'._DB_PREFIX_.'customization` WHERE `id_cart` = '.(int)($id_cart).($only_in_cart ? ' AND `in_cart` = 1' : '')))
|
||||
return false;
|
||||
foreach ($result as $row)
|
||||
@@ -3036,7 +3036,7 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
$max = array(Product::CUSTOMIZE_FILE => (int)(Tools::getValue('uploadable_files')), Product::CUSTOMIZE_TEXTFIELD => (int)(Tools::getValue('text_fields')));
|
||||
/* Get customization field ids */
|
||||
if (($result = Db::getInstance()->ExecuteS('SELECT `id_customization_field`, `type` FROM `'._DB_PREFIX_.'customization_field` WHERE `id_product` = '.(int)($this->id).'
|
||||
if (($result = Db::getInstance()->executeS('SELECT `id_customization_field`, `type` FROM `'._DB_PREFIX_.'customization_field` WHERE `id_product` = '.(int)($this->id).'
|
||||
ORDER BY `id_customization_field`')) === false)
|
||||
return false;
|
||||
if (empty($result))
|
||||
@@ -3049,18 +3049,18 @@ class ProductCore extends ObjectModel
|
||||
|
||||
/* If too much inside the database, deletion */
|
||||
if ($extraFile > 0 && count($customizationFields[Product::CUSTOMIZE_FILE]) - $extraFile >= 0 &&
|
||||
(!Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field`
|
||||
(!Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customization_field`
|
||||
WHERE `id_product` = '.(int)($this->id).' AND `type` = '.Product::CUSTOMIZE_FILE.'
|
||||
AND `id_customization_field` >= '.(int)($customizationFields[Product::CUSTOMIZE_FILE][count($customizationFields[Product::CUSTOMIZE_FILE]) - $extraFile]))
|
||||
|| !Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field_lang`
|
||||
|| !Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customization_field_lang`
|
||||
WHERE `id_customization_field` NOT IN (SELECT `id_customization_field` FROM `'._DB_PREFIX_.'customization_field`)')))
|
||||
return false;
|
||||
|
||||
if ($extraText > 0 && count($customizationFields[Product::CUSTOMIZE_TEXTFIELD]) - $extraText >= 0 &&
|
||||
(!Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field`
|
||||
(!Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customization_field`
|
||||
WHERE `id_product` = '.(int)($this->id).' AND `type` = '.Product::CUSTOMIZE_TEXTFIELD.'
|
||||
AND `id_customization_field` >= '.(int)($customizationFields[Product::CUSTOMIZE_TEXTFIELD][count($customizationFields[Product::CUSTOMIZE_TEXTFIELD]) - $extraText]))
|
||||
|| !Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customization_field_lang`
|
||||
|| !Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customization_field_lang`
|
||||
WHERE `id_customization_field` NOT IN (SELECT `id_customization_field` FROM `'._DB_PREFIX_.'customization_field`)')))
|
||||
return false;
|
||||
|
||||
@@ -3073,7 +3073,7 @@ class ProductCore extends ObjectModel
|
||||
protected function _createLabel(&$languages, $type)
|
||||
{
|
||||
// Label insertion
|
||||
if (!Db::getInstance()->Execute('
|
||||
if (!Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'customization_field` (`id_product`, `type`, `required`)
|
||||
VALUES ('.(int)$this->id.', '.(int)($type).', 0)') ||
|
||||
!$id_customization_field = (int)(Db::getInstance()->Insert_ID()))
|
||||
@@ -3084,7 +3084,7 @@ class ProductCore extends ObjectModel
|
||||
foreach ($languages as $language)
|
||||
$values .= '('.(int)($id_customization_field).', '.(int)($language['id_lang']).', \'\'), ';
|
||||
$values = rtrim($values, ', ');
|
||||
if (!Db::getInstance()->Execute('
|
||||
if (!Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'customization_field_lang` (`id_customization_field`, `id_lang`, `name`)
|
||||
VALUES '.$values))
|
||||
return false;
|
||||
@@ -3119,7 +3119,7 @@ class ProductCore extends ObjectModel
|
||||
if (!$tmp = $this->_checkLabelField($field, $value))
|
||||
return false;
|
||||
/* Multilingual label name update */
|
||||
if (!Db::getInstance()->Execute('
|
||||
if (!Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'customization_field_lang`
|
||||
(`id_customization_field`, `id_lang`, `name`) VALUES ('.(int)($tmp[2]).', '.(int)($tmp[3]).', \''.pSQL($value).'\')
|
||||
ON DUPLICATE KEY UPDATE `name` = \''.pSQL($value).'\''))
|
||||
@@ -3127,10 +3127,10 @@ class ProductCore extends ObjectModel
|
||||
$isRequired = isset($_POST['require_'.(int)($tmp[1]).'_'.(int)($tmp[2])]) ? 1 : 0;
|
||||
$hasRequiredFields |= $isRequired;
|
||||
/* Require option update */
|
||||
if (!Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customization_field` SET `required` = '.(int)($isRequired).' WHERE `id_customization_field` = '.(int)($tmp[2])))
|
||||
if (!Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'customization_field` SET `required` = '.(int)($isRequired).' WHERE `id_customization_field` = '.(int)($tmp[2])))
|
||||
return false;
|
||||
}
|
||||
if ($hasRequiredFields && !Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'product` SET `customizable` = 2 WHERE `id_product` = '.(int)($this->id)))
|
||||
if ($hasRequiredFields && !Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'product` SET `customizable` = 2 WHERE `id_product` = '.(int)($this->id)))
|
||||
return false;
|
||||
if (!$this->_deleteOldLabels())
|
||||
return false;
|
||||
@@ -3141,7 +3141,7 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
if (!Customization::isFeatureActive())
|
||||
return false;
|
||||
if (!$result = Db::getInstance()->ExecuteS('
|
||||
if (!$result = Db::getInstance()->executeS('
|
||||
SELECT cf.`id_customization_field`, cf.`type`, cf.`required`, cfl.`name`, cfl.`id_lang`
|
||||
FROM `'._DB_PREFIX_.'customization_field` cf
|
||||
NATURAL JOIN `'._DB_PREFIX_.'customization_field_lang` cfl
|
||||
@@ -3160,7 +3160,7 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
if (!Customization::isFeatureActive())
|
||||
return array();
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT `id_customization_field`, `type`
|
||||
FROM `'._DB_PREFIX_.'customization_field`
|
||||
WHERE `id_product` = '.(int)($this->id));
|
||||
@@ -3170,7 +3170,7 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
if (!Customization::isFeatureActive())
|
||||
return array();
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT `id_customization_field`, `type`
|
||||
FROM `'._DB_PREFIX_.'customization_field`
|
||||
WHERE `id_product` = '.(int)($this->id).'
|
||||
@@ -3218,7 +3218,7 @@ class ProductCore extends ObjectModel
|
||||
if (isset(self::$_incat[md5($sql)]))
|
||||
return self::$_incat[md5($sql)];
|
||||
|
||||
if (!Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql))
|
||||
if (!Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
return false;
|
||||
self::$_incat[md5($sql)] = (Db::getInstance(_PS_USE_SQL_SLAVE_)->NumRows() > 0 ? true : false);
|
||||
return self::$_incat[md5($sql)];
|
||||
@@ -3292,7 +3292,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public function getStockMvts($id_lang)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT sm.id_stock_mvt, sm.date_add, sm.quantity, sm.id_order,
|
||||
CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name, CONCAT(e.lastname, \' \', e.firstname) employee, mrl.name reason
|
||||
FROM `'._DB_PREFIX_.'stock_mvt` sm
|
||||
@@ -3308,7 +3308,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public static function getUrlRewriteInformations($id_product)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT pl.`id_lang`, pl.`link_rewrite`, p.`ean13`, cl.`link_rewrite` AS category_rewrite
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product`'.Context::getContext()->shop->sqlLang('pl').')
|
||||
@@ -3434,7 +3434,7 @@ class ProductCore extends ObjectModel
|
||||
$ids = array_map('intval', $ids);
|
||||
foreach ($ids as $position => $id)
|
||||
$sqlValues[] = '('.(int)$id.', '.(int)$this->id.', '.(int)$position.')';
|
||||
$result = Db::getInstance()->Execute('
|
||||
$result = Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'category_product` (`id_category`, `id_product`, `position`)
|
||||
VALUES '.implode(',', $sqlValues)
|
||||
);
|
||||
@@ -3451,7 +3451,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function getWsCombinations()
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS('SELECT `id_product_attribute` as id FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)($this->id));
|
||||
$result = Db::getInstance()->executeS('SELECT `id_product_attribute` as id FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)($this->id));
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -3468,13 +3468,13 @@ class ProductCore extends ObjectModel
|
||||
$ids_new[] = (int)$combination['id'];
|
||||
|
||||
$ids_orig = array();
|
||||
$original = Db::getInstance()->ExecuteS('SELECT `id_product_attribute` as id FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)($this->id));
|
||||
$original = Db::getInstance()->executeS('SELECT `id_product_attribute` as id FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product` = '.(int)($this->id));
|
||||
if (is_array($original))
|
||||
foreach ($original as $id)
|
||||
$ids_orig[] = $id['id'];
|
||||
|
||||
$all_ids = array();
|
||||
$all = Db::getInstance()->ExecuteS('SELECT `id_product_attribute` as id FROM `'._DB_PREFIX_.'product_attribute`');
|
||||
$all = Db::getInstance()->executeS('SELECT `id_product_attribute` as id FROM `'._DB_PREFIX_.'product_attribute`');
|
||||
if (is_array($all))
|
||||
foreach ($all as $id)
|
||||
$all_ids[] = $id['id'];
|
||||
@@ -3491,15 +3491,15 @@ class ProductCore extends ObjectModel
|
||||
|
||||
// Delete rows
|
||||
if (count($toDelete) > 0)
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product_attribute` IN ('.implode(',', $toDelete).')');
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product_attribute` IN ('.implode(',', $toDelete).')');
|
||||
|
||||
foreach ($toAdd as $id)
|
||||
{
|
||||
// Update id_product if exists else create
|
||||
if (in_array($id, $all_ids))
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'product_attribute` SET id_product = '.(int)$this->id.' WHERE id_product_attribute='.$id);
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'product_attribute` SET id_product = '.(int)$this->id.' WHERE id_product_attribute='.$id);
|
||||
else
|
||||
Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'product_attribute` (`id_product`) VALUES ('.$this->id.')');
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'product_attribute` (`id_product`) VALUES ('.$this->id.')');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -3511,7 +3511,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function getWsProductOptionValues()
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS('SELECT DISTINCT pac.id_attribute as id
|
||||
$result = Db::getInstance()->executeS('SELECT DISTINCT pac.id_attribute as id
|
||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.id_product_attribute = pa.id_product_attribute)
|
||||
WHERE pa.id_product = '.(int)$this->id);
|
||||
@@ -3525,7 +3525,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function getWsPositionInCategory()
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS('SELECT position
|
||||
$result = Db::getInstance()->executeS('SELECT position
|
||||
FROM `'._DB_PREFIX_.'category_product`
|
||||
WHERE id_category = '.(int)($this->id_category_default).'
|
||||
AND id_product = '.(int)($this->id));
|
||||
@@ -3552,10 +3552,10 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function setCoverWs($id_image)
|
||||
{
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'image`
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 0 WHERE `id_product` = '.(int)($this->id).'
|
||||
');
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'image`
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 1 WHERE `id_product` = '.(int)($this->id).' AND `id_image` = '.(int)$id_image);
|
||||
return true;
|
||||
}
|
||||
@@ -3567,7 +3567,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function getWsImages()
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT `id_image` as id
|
||||
FROM `'._DB_PREFIX_.'image`
|
||||
WHERE `id_product` = '.(int)($this->id).'
|
||||
@@ -3576,7 +3576,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public function getWsTags()
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT `id_tag` as id
|
||||
FROM `'._DB_PREFIX_.'product_tag`
|
||||
WHERE `id_product` = '.(int)($this->id));
|
||||
@@ -3590,7 +3590,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public static function resetEcoTax()
|
||||
{
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'product`
|
||||
SET ecotax = 0
|
||||
');
|
||||
|
||||
@@ -236,7 +236,7 @@ class ProductDownloadCore extends ObjectModel
|
||||
*/
|
||||
public static function getAttributeFromIdProduct($id_product)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT `id_product_download`
|
||||
FROM `'._DB_PREFIX_.'product_download`
|
||||
WHERE `id_product` = '.(int)$id_product.' AND `active` = 1');
|
||||
|
||||
@@ -37,7 +37,7 @@ class ProductSaleCore
|
||||
(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
|
||||
SELECT od.product_id, COUNT(od.product_id), SUM(od.product_quantity), NOW()
|
||||
FROM '._DB_PREFIX_.'order_detail od GROUP BY od.product_id';
|
||||
return Db::getInstance()->Execute($sql);
|
||||
return Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -103,7 +103,7 @@ class ProductSaleCore
|
||||
)
|
||||
ORDER BY `'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||
LIMIT '.(int)($pageNumber * $nbProducts).', '.(int)$nbProducts;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
if ($orderBy == 'price')
|
||||
Tools::orderbyPrice($result,$orderWay);
|
||||
@@ -147,7 +147,7 @@ class ProductSaleCore
|
||||
)
|
||||
ORDER BY sales DESC
|
||||
LIMIT '.(int)($pageNumber * $nbProducts).', '.(int)$nbProducts;
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql))
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
return false;
|
||||
|
||||
foreach ($result AS &$row)
|
||||
@@ -160,7 +160,7 @@ class ProductSaleCore
|
||||
|
||||
public static function addProductSale($product_id, $qty = 1)
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO '._DB_PREFIX_.'product_sale
|
||||
(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
|
||||
VALUES ('.(int)($product_id).', '.(int)($qty).', 1, NOW())
|
||||
@@ -179,9 +179,9 @@ class ProductSaleCore
|
||||
{
|
||||
$nbrSales = self::getNbrSales($id_product);
|
||||
if ($nbrSales > 1)
|
||||
return Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product_sale SET `quantity` = `quantity` - '.(int)($qty).', `sale_nbr` = `sale_nbr` - 1, `date_upd` = NOW() WHERE `id_product` = '.(int)($id_product));
|
||||
return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product_sale SET `quantity` = `quantity` - '.(int)($qty).', `sale_nbr` = `sale_nbr` - 1, `date_upd` = NOW() WHERE `id_product` = '.(int)($id_product));
|
||||
elseif ($nbrSales == 1)
|
||||
return Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'product_sale WHERE `id_product` = '.(int)($id_product));
|
||||
return Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'product_sale WHERE `id_product` = '.(int)($id_product));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -60,7 +60,7 @@ class ProfileCore extends ObjectModel
|
||||
*/
|
||||
public static function getProfiles($id_lang)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT p.`id_profile`, `name`
|
||||
FROM `'._DB_PREFIX_.'profile` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'profile_lang` pl ON (p.`id_profile` = pl.`id_profile` AND `id_lang` = '.(int)($id_lang).')
|
||||
@@ -89,8 +89,8 @@ class ProfileCore extends ObjectModel
|
||||
{
|
||||
if (parent::add($autodate, true))
|
||||
return (
|
||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'access (SELECT '.(int)$this->id.', id_tab, 0, 0, 0, 0 FROM '._DB_PREFIX_.'tab)')
|
||||
&& Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'module_access (`id_profile`, `id_module`, `configure`, `view`) (SELECT '.(int)$this->id.', id_module, 0, 1 FROM '._DB_PREFIX_.'module)')
|
||||
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'access (SELECT '.(int)$this->id.', id_tab, 0, 0, 0, 0 FROM '._DB_PREFIX_.'tab)')
|
||||
&& Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'module_access (`id_profile`, `id_module`, `configure`, `view`) (SELECT '.(int)$this->id.', id_module, 0, 1 FROM '._DB_PREFIX_.'module)')
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@@ -99,8 +99,8 @@ class ProfileCore extends ObjectModel
|
||||
{
|
||||
if (parent::delete())
|
||||
return (
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'access` WHERE `id_profile` = '.(int)$this->id)
|
||||
&& Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_access` WHERE `id_profile` = '.(int)$this->id)
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'access` WHERE `id_profile` = '.(int)$this->id)
|
||||
&& Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'module_access` WHERE `id_profile` = '.(int)$this->id)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ class ProfileCore extends ObjectModel
|
||||
{
|
||||
if (!isset(self::$_cache_accesses[$id_profile]))
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'access`
|
||||
WHERE `id_profile` = '.(int)$id_profile);
|
||||
|
||||
@@ -72,7 +72,7 @@ class QuickAccessCore extends ObjectModel
|
||||
*/
|
||||
public static function getQuickAccesses($id_lang)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'quick_access` qa
|
||||
LEFT JOIN `'._DB_PREFIX_.'quick_access_lang` qal ON (qa.`id_quick_access` = qal.`id_quick_access` AND qal.`id_lang` = '.(int)($id_lang).')
|
||||
|
||||
@@ -61,7 +61,7 @@ class RangePriceCore extends ObjectModel
|
||||
*/
|
||||
public static function getRanges($id_carrier)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'range_price`
|
||||
WHERE `id_carrier` = '.(int)($id_carrier).'
|
||||
|
||||
@@ -61,7 +61,7 @@ class RangeWeightCore extends ObjectModel
|
||||
*/
|
||||
public static function getRanges($id_carrier)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'range_weight`
|
||||
WHERE `id_carrier` = '.(int)($id_carrier).'
|
||||
|
||||
@@ -108,7 +108,7 @@ class ReferrerCore extends ObjectModel
|
||||
LEFT JOIN '._DB_PREFIX_.'connections_source cs ON ('.self::$_join.')
|
||||
WHERE id_connections_source = '.(int)($id_connections_source).'
|
||||
)';
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +127,7 @@ class ReferrerCore extends ObjectModel
|
||||
WHERE g.id_customer = '.(int)($id_customer).'
|
||||
AND r.name IS NOT NULL
|
||||
ORDER BY c.date_add DESC';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,7 +266,7 @@ class ReferrerCore extends ObjectModel
|
||||
public static function refreshCache($referrers = null, $employee = null)
|
||||
{
|
||||
if (!$referrers OR !is_array($referrers))
|
||||
$referrers = Db::getInstance()->ExecuteS('SELECT id_referrer FROM '._DB_PREFIX_.'referrer');
|
||||
$referrers = Db::getInstance()->executeS('SELECT id_referrer FROM '._DB_PREFIX_.'referrer');
|
||||
foreach ($referrers as $row)
|
||||
{
|
||||
$referrer = new Referrer($row['id_referrer']);
|
||||
@@ -307,8 +307,8 @@ class ReferrerCore extends ObjectModel
|
||||
{
|
||||
if (!$referrers OR !is_array($referrers))
|
||||
{
|
||||
Db::getInstance()->Execute('TRUNCATE '._DB_PREFIX_.'referrer_cache');
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('TRUNCATE '._DB_PREFIX_.'referrer_cache');
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO '._DB_PREFIX_.'referrer_cache (id_referrer, id_connections_source) (
|
||||
SELECT id_referrer, id_connections_source
|
||||
FROM '._DB_PREFIX_.'referrer r
|
||||
@@ -318,8 +318,8 @@ class ReferrerCore extends ObjectModel
|
||||
else
|
||||
foreach ($referrers as $row)
|
||||
{
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'referrer_cache WHERE id_referrer = '.(int)($row['id_referrer']));
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'referrer_cache WHERE id_referrer = '.(int)($row['id_referrer']));
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO '._DB_PREFIX_.'referrer_cache (id_referrer, id_connections_source) (
|
||||
SELECT id_referrer, id_connections_source
|
||||
FROM '._DB_PREFIX_.'referrer r
|
||||
|
||||
@@ -67,7 +67,7 @@ class RequestSqlCore extends ObjectModel
|
||||
|
||||
public static function getRequestSql()
|
||||
{
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'request_sql` ORDER BY `id_request_sql`'))
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT * FROM `'._DB_PREFIX_.'request_sql` ORDER BY `id_request_sql`'))
|
||||
return false;
|
||||
$request_sql = array();
|
||||
foreach ($result as $row)
|
||||
@@ -77,7 +77,7 @@ class RequestSqlCore extends ObjectModel
|
||||
|
||||
public static function getRequestSqlById($id)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS(sprintf('SELECT `sql` FROM `'._DB_PREFIX_.'request_sql` WHERE `id_request_sql` = %d', $id));
|
||||
return Db::getInstance()->executeS(sprintf('SELECT `sql` FROM `'._DB_PREFIX_.'request_sql` WHERE `id_request_sql` = %d', $id));
|
||||
}
|
||||
|
||||
public function parsingSql($sql)
|
||||
@@ -140,14 +140,14 @@ class RequestSqlCore extends ObjectModel
|
||||
}
|
||||
|
||||
if (empty($this->_errors))
|
||||
if (!Db::getInstance()->ExecuteS($sql))
|
||||
if (!Db::getInstance()->executeS($sql))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function showTables()
|
||||
{
|
||||
$results = Db::getInstance()->ExecuteS('SHOW TABLES');
|
||||
$results = Db::getInstance()->executeS('SHOW TABLES');
|
||||
foreach ($results as $result)
|
||||
{
|
||||
$key = array_keys($result);
|
||||
@@ -223,7 +223,7 @@ class RequestSqlCore extends ObjectModel
|
||||
{
|
||||
if (is_array($table) && (count($table) == 1))
|
||||
$table = $table[0];
|
||||
$attributs = Db::getInstance()->ExecuteS(sprintf('DESCRIBE `%s`', $table));
|
||||
$attributs = Db::getInstance()->executeS(sprintf('DESCRIBE `%s`', $table));
|
||||
foreach ($attributs as $attribut)
|
||||
if ($attribut['Field'] == trim($attr))
|
||||
return true;
|
||||
|
||||
+7
-7
@@ -146,7 +146,7 @@ class SceneCore extends ObjectModel
|
||||
$result = true;
|
||||
foreach ($categories AS $category)
|
||||
{
|
||||
if (!Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'scene_category` ( `id_scene` , `id_category`) VALUES ('.(int)($this->id).', '.(int)($category).')'))
|
||||
if (!Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'scene_category` ( `id_scene` , `id_category`) VALUES ('.(int)($this->id).', '.(int)($category).')'))
|
||||
$result = false;
|
||||
}
|
||||
return $result;
|
||||
@@ -154,7 +154,7 @@ class SceneCore extends ObjectModel
|
||||
|
||||
public function deleteCategories()
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'scene_category`
|
||||
WHERE `id_scene` = '.(int)($this->id));
|
||||
}
|
||||
@@ -175,7 +175,7 @@ class SceneCore extends ObjectModel
|
||||
{
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'scene_products` ( `id_scene` , `id_product` , `x_axis` , `y_axis` , `zone_width` , `zone_height`) VALUES
|
||||
('.(int)($this->id).', '.(int)($zone['id_product']).', '.(int)($zone['x1']).', '.(int)($zone['y1']).', '.(int)($zone['width']).', '.(int)($zone['height']).')';
|
||||
if (!Db::getInstance()->Execute($sql))
|
||||
if (!Db::getInstance()->execute($sql))
|
||||
$result = false;
|
||||
}
|
||||
return $result;
|
||||
@@ -183,7 +183,7 @@ class SceneCore extends ObjectModel
|
||||
|
||||
public function deleteZoneProducts()
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'scene_products`
|
||||
WHERE `id_scene` = '.(int)($this->id));
|
||||
}
|
||||
@@ -220,7 +220,7 @@ class SceneCore extends ObjectModel
|
||||
AND sl.id_lang = '.(int)$id_lang
|
||||
.($onlyActive ? ' AND s.active = 1' : '').'
|
||||
ORDER BY sl.name ASC';
|
||||
$scenes = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$scenes = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
if (!$liteResult AND $scenes)
|
||||
foreach($scenes AS &$scene)
|
||||
@@ -242,7 +242,7 @@ class SceneCore extends ObjectModel
|
||||
$context = Context::getContext();
|
||||
$id_lang = is_null($id_lang) ? $context->language->id : $id_lang;
|
||||
|
||||
$products = Db::getInstance()->ExecuteS('
|
||||
$products = Db::getInstance()->executeS('
|
||||
SELECT s.*
|
||||
FROM `'._DB_PREFIX_.'scene_products` s
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = s.id_product)
|
||||
@@ -268,7 +268,7 @@ class SceneCore extends ObjectModel
|
||||
*/
|
||||
public static function getIndexedCategories($id_scene)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT `id_category`
|
||||
FROM `'._DB_PREFIX_.'scene_category`
|
||||
WHERE `id_scene` = '.(int)($id_scene));
|
||||
|
||||
+15
-15
@@ -218,14 +218,14 @@ class SearchCore
|
||||
SELECT id_group FROM '._DB_PREFIX_.'customer_group
|
||||
WHERE id_customer = '.(int)$id_customer.'
|
||||
)');
|
||||
$result = $db->ExecuteS($sql, false);
|
||||
$result = $db->executeS($sql, false);
|
||||
|
||||
$eligibleProducts = array();
|
||||
while ($row = $db->nextRow($result))
|
||||
$eligibleProducts[] = $row['id_product'];
|
||||
foreach ($intersectArray as $query)
|
||||
{
|
||||
$result = $db->ExecuteS($query, false);
|
||||
$result = $db->executeS($query, false);
|
||||
$eligibleProducts2 = array();
|
||||
while ($row = $db->nextRow($result))
|
||||
$eligibleProducts2[] = $row['id_product'];
|
||||
@@ -253,7 +253,7 @@ class SearchCore
|
||||
INNER JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('cl').')
|
||||
WHERE p.`id_product` '.$productPool.'
|
||||
ORDER BY position DESC LIMIT 10';
|
||||
return $db->ExecuteS($sql);
|
||||
return $db->executeS($sql);
|
||||
}
|
||||
|
||||
$sql = 'SELECT p.*, pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
|
||||
@@ -270,7 +270,7 @@ class SearchCore
|
||||
WHERE p.`id_product` '.$productPool.'
|
||||
'.($orderBy ? 'ORDER BY '.$orderBy : '').($orderWay ? ' '.$orderWay : '').'
|
||||
LIMIT '.(int)(($pageNumber - 1) * $pageSize).','.(int)$pageSize;
|
||||
$result = $db->ExecuteS($sql);
|
||||
$result = $db->executeS($sql);
|
||||
|
||||
$sql = 'SELECT COUNT(*)
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
@@ -296,7 +296,7 @@ class SearchCore
|
||||
public static function getTags($db, $id_product, $id_lang)
|
||||
{
|
||||
$tags = '';
|
||||
$tagsArray = $db->ExecuteS('
|
||||
$tagsArray = $db->executeS('
|
||||
SELECT t.name FROM '._DB_PREFIX_.'product_tag pt
|
||||
LEFT JOIN '._DB_PREFIX_.'tag t ON (pt.id_tag = t.id_tag AND t.id_lang = '.(int)$id_lang.')
|
||||
WHERE pt.id_product = '.(int)$id_product);
|
||||
@@ -311,7 +311,7 @@ class SearchCore
|
||||
return '';
|
||||
|
||||
$attributes = '';
|
||||
$attributesArray = $db->ExecuteS('
|
||||
$attributesArray = $db->executeS('
|
||||
SELECT al.name FROM '._DB_PREFIX_.'product_attribute pa
|
||||
INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON pa.id_product_attribute = pac.id_product_attribute
|
||||
INNER JOIN '._DB_PREFIX_.'attribute_lang al ON (pac.id_attribute = al.id_attribute AND al.id_lang = '.(int)$id_lang.')
|
||||
@@ -327,7 +327,7 @@ class SearchCore
|
||||
return '';
|
||||
|
||||
$features = '';
|
||||
$featuresArray = $db->ExecuteS('
|
||||
$featuresArray = $db->executeS('
|
||||
SELECT fvl.value FROM '._DB_PREFIX_.'feature_product fp
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fp.id_feature_value = fvl.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
|
||||
WHERE fp.id_product = '.(int)$id_product);
|
||||
@@ -340,7 +340,7 @@ class SearchCore
|
||||
{
|
||||
// Adjust the limit to get only "whole" products, in every languages (and at least one)
|
||||
$limit = max(1, round($limit / $nbLanguages) * $nbLanguages);
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT p.id_product, pl.id_lang, pl.name pname, p.reference, p.ean13, p.upc, pl.description_short, pl.description, cl.name cname, m.name mname
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON p.id_product = pl.id_product
|
||||
@@ -366,7 +366,7 @@ class SearchCore
|
||||
else
|
||||
{
|
||||
// Do it even if you already know the product id in order to be sure that it exists
|
||||
$products = $db->ExecuteS('
|
||||
$products = $db->executeS('
|
||||
SELECT id_product
|
||||
FROM '._DB_PREFIX_.'product
|
||||
WHERE '.($id_product ? 'id_product = '.(int)$id_product : 'indexed = 0'));
|
||||
@@ -402,7 +402,7 @@ class SearchCore
|
||||
|
||||
// Every indexed words are cached into a PHP array
|
||||
$wordIdsByWord = array();
|
||||
$wordIds = Db::getInstance()->ExecuteS('
|
||||
$wordIds = Db::getInstance()->executeS('
|
||||
SELECT id_word, word, id_lang, id_shop
|
||||
FROM '._DB_PREFIX_.'search_word', false);
|
||||
$wordIdsByWord = array();
|
||||
@@ -458,7 +458,7 @@ class SearchCore
|
||||
$wordIdsByWord[$product['id_shop']][$product['id_lang']]['_'.$word] = 0;
|
||||
}
|
||||
|
||||
$existingWords = $db->ExecuteS('
|
||||
$existingWords = $db->executeS('
|
||||
SELECT DISTINCT word FROM '._DB_PREFIX_.'search_word
|
||||
WHERE word IN ('.implode(',', $queryArray2).')
|
||||
AND id_lang = '.(int)$product['id_lang']);
|
||||
@@ -476,7 +476,7 @@ class SearchCore
|
||||
if (count($queryArray2))
|
||||
{
|
||||
// ...then their IDs are retrieved and added to the cache
|
||||
$addedWords = $db->ExecuteS('
|
||||
$addedWords = $db->executeS('
|
||||
SELECT sw.id_word, sw.word
|
||||
FROM '._DB_PREFIX_.'search_word sw
|
||||
WHERE sw.word IN ('.implode(',', $queryArray2).')
|
||||
@@ -517,7 +517,7 @@ class SearchCore
|
||||
protected static function setProductsAsIndexed(&$products)
|
||||
{
|
||||
if (count($products))
|
||||
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product SET indexed = 1 WHERE id_product IN ('.implode(',', $products).') LIMIT '.(int)count($products));
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET indexed = 1 WHERE id_product IN ('.implode(',', $products).') LIMIT '.(int)count($products));
|
||||
$productsArray = array();
|
||||
}
|
||||
|
||||
@@ -525,7 +525,7 @@ class SearchCore
|
||||
protected static function saveIndex(&$queryArray3)
|
||||
{
|
||||
if (count($queryArray3))
|
||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'search_index (id_product, id_word, weight) VALUES '.implode(',', $queryArray3).' ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)');
|
||||
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'search_index (id_product, id_word, weight) VALUES '.implode(',', $queryArray3).' ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)');
|
||||
$queryArray3 = array();
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ class SearchCore
|
||||
AND t.`name` LIKE \'%'.pSQL($tag).'%\'
|
||||
ORDER BY position DESC'.($orderBy ? ', '.$orderBy : '').($orderWay ? ' '.$orderWay : '').'
|
||||
LIMIT '.(int)(($pageNumber - 1) * $pageSize).','.(int)$pageSize;
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql))
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
return false;
|
||||
|
||||
return Product::getProductsProperties((int)$id_lang, $result);
|
||||
|
||||
@@ -49,7 +49,7 @@ class SearchEngineCore extends ObjectModel
|
||||
$parsedUrl = @parse_url($url);
|
||||
if (!isset($parsedUrl['host']) OR !isset($parsedUrl['query']))
|
||||
return false;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT `server`, `getvar` FROM `'._DB_PREFIX_.'search_engine`');
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT `server`, `getvar` FROM `'._DB_PREFIX_.'search_engine`');
|
||||
foreach ($result as $row)
|
||||
{
|
||||
$host =& $row['server'];
|
||||
|
||||
@@ -89,7 +89,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
|
||||
public static function getByProductId($id_product)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'specific_price`
|
||||
WHERE `id_product` = '.(int)$id_product);
|
||||
@@ -97,7 +97,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
|
||||
public static function getIdsByProductId($id_product)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT `id_specific_price`
|
||||
FROM `'._DB_PREFIX_.'specific_price`
|
||||
WHERE `id_product` = '.(int)$id_product);
|
||||
@@ -185,7 +185,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
|
||||
public static function deletePriorities()
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
TRUNCATE `'._DB_PREFIX_.'specific_price_priority`
|
||||
');
|
||||
}
|
||||
@@ -196,7 +196,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
foreach ($priorities as $priority)
|
||||
$value .= pSQL($priority).';';
|
||||
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'specific_price_priority` (`id_product`, `priority`)
|
||||
VALUES ('.(int)$id_product.',\''.pSQL(rtrim($value, ';')).'\')
|
||||
ON DUPLICATE KEY UPDATE `priority` = \''.pSQL(rtrim($value, ';')).'\'
|
||||
@@ -209,7 +209,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
return array();
|
||||
|
||||
$now = date('Y-m-d H:i:s');
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *,
|
||||
'.self::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group).'
|
||||
FROM `'._DB_PREFIX_.'specific_price`
|
||||
@@ -276,7 +276,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
if (!self::isFeatureActive())
|
||||
return array();
|
||||
|
||||
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT `id_product`
|
||||
FROM `'._DB_PREFIX_.'specific_price`
|
||||
WHERE `id_shop` IN(0, '.(int)$id_shop.') AND
|
||||
@@ -300,7 +300,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
|
||||
public static function deleteByProductId($id_product)
|
||||
{
|
||||
if (Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'specific_price` WHERE `id_product` = '.(int)$id_product))
|
||||
if (Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'specific_price` WHERE `id_product` = '.(int)$id_product))
|
||||
{
|
||||
// Refresh cache of feature detachable
|
||||
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', self::isCurrentlyUsed('specific_price'));
|
||||
|
||||
+4
-4
@@ -69,7 +69,7 @@ class StateCore extends ObjectModel
|
||||
|
||||
public static function getStates($id_lang = false, $active = false)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT `id_state`, `id_country`, `id_zone`, `iso_code`, `name`, `active`
|
||||
FROM `'._DB_PREFIX_.'state`
|
||||
'.($active ? 'WHERE active = 1' : '').'
|
||||
@@ -136,13 +136,13 @@ class StateCore extends ObjectModel
|
||||
if (!$this->isUsed())
|
||||
{
|
||||
/* Database deletion */
|
||||
$result = Db::getInstance()->Execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->table).'` WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
||||
$result = Db::getInstance()->execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->table).'` WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
||||
if (!$result)
|
||||
return false;
|
||||
|
||||
/* Database deletion for multilingual fields related to the object */
|
||||
if (method_exists($this, 'getTranslationsFieldsChild'))
|
||||
Db::getInstance()->Execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->table).'_lang` WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
||||
Db::getInstance()->execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->table).'_lang` WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
@@ -178,7 +178,7 @@ class StateCore extends ObjectModel
|
||||
if (empty($id_country))
|
||||
die(Tools::displayError());
|
||||
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'state` s
|
||||
WHERE s.`id_country` = '.(int)$id_country
|
||||
|
||||
@@ -99,7 +99,7 @@ class StockMvtCore extends ObjectModel
|
||||
) = 0
|
||||
GROUP BY s.id_product, s.id_shop
|
||||
HAVING qty <> 0';
|
||||
$products_without_attributes = Db::getInstance()->ExecuteS($sql);
|
||||
$products_without_attributes = Db::getInstance()->executeS($sql);
|
||||
|
||||
// Search missing stock movement on products with attributes
|
||||
$sql = 'SELECT s.id_stock, (stock.quantity - SUM(IFNULL(sm.quantity, 0))) AS qty
|
||||
@@ -114,7 +114,7 @@ class StockMvtCore extends ObjectModel
|
||||
) > 0
|
||||
GROUP BY s.id_product_attribute
|
||||
HAVING qty <> 0';
|
||||
$products_with_attributes = Db::getInstance()->ExecuteS($sql);
|
||||
$products_with_attributes = Db::getInstance()->executeS($sql);
|
||||
|
||||
// Add missing stock movements
|
||||
$products = array_merge($products_without_attributes, $products_with_attributes);
|
||||
|
||||
@@ -68,6 +68,6 @@ class StockMvtReasonCore extends ObjectModel
|
||||
$sql = 'SELECT smrl.name, smr.id_stock_mvt_reason, smr.sign
|
||||
FROM '._DB_PREFIX_.'stock_mvt_reason smr
|
||||
LEFT JOIN '._DB_PREFIX_.'stock_mvt_reason_lang smrl ON (smr.id_stock_mvt_reason = smrl.id_stock_mvt_reason AND smrl.id_lang='.(int)$id_lang.')';
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class SubDomainCore extends ObjectModel
|
||||
|
||||
public static function getSubDomains()
|
||||
{
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT `name` FROM `'._DB_PREFIX_.'subdomain`'))
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT `name` FROM `'._DB_PREFIX_.'subdomain`'))
|
||||
return false;
|
||||
$subDomains = array();
|
||||
foreach ($result AS $row)
|
||||
|
||||
@@ -120,7 +120,7 @@ class SupplierCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'supplier_lang` sl ON (s.`id_supplier` = sl.`id_supplier` AND sl.`id_lang` = '.(int)($id_lang).')
|
||||
'.($active ? ' WHERE s.`active` = 1 ' : '');
|
||||
$query .= ' ORDER BY s.`name` ASC'.($p ? ' LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n) : '');
|
||||
$suppliers = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($query);
|
||||
$suppliers = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
if ($suppliers === false)
|
||||
return false;
|
||||
if ($getNbProducts)
|
||||
@@ -146,7 +146,7 @@ class SupplierCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sqlGroups.'
|
||||
)');
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
$suppliers[$key]['nb_products'] = sizeof($result);
|
||||
}
|
||||
}
|
||||
@@ -210,7 +210,7 @@ class SupplierCore extends ObjectModel
|
||||
($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
|
||||
WHERE cg.`id_group` '.$sqlGroups.'
|
||||
)';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
return (int)(sizeof($result));
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ class SupplierCore extends ObjectModel
|
||||
ORDER BY '.(($orderBy == 'id_product') ? 'p.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||
LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n);
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if (!$result)
|
||||
return false;
|
||||
if ($orderBy == 'price')
|
||||
@@ -249,7 +249,7 @@ class SupplierCore extends ObjectModel
|
||||
|
||||
public function getProductsLite($id_lang)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT p.`id_product`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($id_lang).')
|
||||
|
||||
+8
-8
@@ -104,7 +104,7 @@ class TabCore extends ObjectModel
|
||||
if (!$context->employee->id_profile)
|
||||
return false;
|
||||
/* Profile selection */
|
||||
$profiles = Db::getInstance()->ExecuteS('SELECT `id_profile` FROM '._DB_PREFIX_.'profile where `id_profile` != 1');
|
||||
$profiles = Db::getInstance()->executeS('SELECT `id_profile` FROM '._DB_PREFIX_.'profile where `id_profile` != 1');
|
||||
if (!$profiles || empty($profiles))
|
||||
return false;
|
||||
/* Query definition */
|
||||
@@ -120,12 +120,12 @@ class TabCore extends ObjectModel
|
||||
$query .= '('.$profile['id_profile'].', '.(int)$id_tab.', '.$rights.', '.$rights.', '.$rights.', '.$rights.'),';
|
||||
}
|
||||
$query = trim($query, ', ');
|
||||
return Db::getInstance()->Execute($query);
|
||||
return Db::getInstance()->execute($query);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'access WHERE `id_tab` = '.(int)$this->id) && parent::delete())
|
||||
if (Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'access WHERE `id_tab` = '.(int)$this->id) && parent::delete())
|
||||
return $this->cleanPositions($this->id_parent);
|
||||
return false;
|
||||
}
|
||||
@@ -178,7 +178,7 @@ class TabCore extends ObjectModel
|
||||
if (!isset(self::$_cache_tabs[$id_lang]))
|
||||
{
|
||||
self::$_cache_tabs[$id_lang] = array();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'tab` t
|
||||
LEFT JOIN `'._DB_PREFIX_.'tab_lang` tl ON (t.`id_tab` = tl.`id_tab` AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
@@ -211,7 +211,7 @@ class TabCore extends ObjectModel
|
||||
if (self::$_getIdFromClassName === null)
|
||||
{
|
||||
self::$_getIdFromClassName = array();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT id_tab, class_name FROM `'._DB_PREFIX_.'tab`');
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_tab, class_name FROM `'._DB_PREFIX_.'tab`');
|
||||
foreach ($result as $row)
|
||||
self::$_getIdFromClassName[$row['class_name']] = $row['id_tab'];
|
||||
}
|
||||
@@ -250,7 +250,7 @@ class TabCore extends ObjectModel
|
||||
return false;
|
||||
|
||||
$new_position = ($direction == 'l') ? $this->position - 1 : $this->position + 1;
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'tab` t
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'tab` t
|
||||
SET position = '.(int)$this->position.'
|
||||
WHERE id_parent = '.(int)$this->id_parent.' AND position = '.(int)$new_position);
|
||||
$this->position = $new_position;
|
||||
@@ -259,14 +259,14 @@ class TabCore extends ObjectModel
|
||||
|
||||
public function cleanPositions($id_parent)
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `id_tab`
|
||||
FROM `'._DB_PREFIX_.'tab`
|
||||
WHERE `id_parent` = '.(int)$id_parent.'
|
||||
ORDER BY `position`');
|
||||
$sizeof = count($result);
|
||||
for ($i = 0; $i < $sizeof; ++$i)
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'tab`
|
||||
SET `position` = '.($i + 1).'
|
||||
WHERE `id_tab` = '.(int)$result[$i]['id_tab']);
|
||||
|
||||
+8
-8
@@ -119,7 +119,7 @@ class TagCore extends ObjectModel
|
||||
$data .= '('.(int)$tag.','.(int)$id_product.'),';
|
||||
$data = rtrim($data, ',');
|
||||
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'product_tag` (`id_tag`, `id_product`)
|
||||
VALUES '.$data);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ class TagCore extends ObjectModel
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT t.name, COUNT(pt.id_tag) AS times
|
||||
FROM `'._DB_PREFIX_.'product_tag` pt
|
||||
LEFT JOIN `'._DB_PREFIX_.'tag` t ON (t.id_tag = pt.id_tag)
|
||||
@@ -149,7 +149,7 @@ class TagCore extends ObjectModel
|
||||
|
||||
public static function getProductTags($id_product)
|
||||
{
|
||||
if (!$tmp = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
if (!$tmp = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT t.`id_lang`, t.`name`
|
||||
FROM '._DB_PREFIX_.'tag t
|
||||
LEFT JOIN '._DB_PREFIX_.'product_tag pt ON (pt.id_tag = t.id_tag)
|
||||
@@ -171,7 +171,7 @@ class TagCore extends ObjectModel
|
||||
return array();
|
||||
|
||||
$in = $associated ? 'IN' : 'NOT IN';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT pl.name, pl.id_product
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.id_product = pl.id_product'.$context->shop->sqlLang('pl').'
|
||||
@@ -183,22 +183,22 @@ class TagCore extends ObjectModel
|
||||
|
||||
public function setProducts($array)
|
||||
{
|
||||
$result = Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'product_tag WHERE id_tag = '.(int)$this->id);
|
||||
$result = Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'product_tag WHERE id_tag = '.(int)$this->id);
|
||||
if (is_array($array))
|
||||
{
|
||||
$array = array_map('intval', $array);
|
||||
$result &= Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'product SET indexed = 0 WHERE id_product IN ('.implode(',', $array).')');
|
||||
$result &= Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET indexed = 0 WHERE id_product IN ('.implode(',', $array).')');
|
||||
$ids = array();
|
||||
foreach ($array as $id_product)
|
||||
$ids[] = '('.(int)$id_product.','.(int)$this->id.')';
|
||||
return ($result && Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'product_tag (id_product, id_tag) VALUES '.implode(',', $ids)) && Search::indexation(false));
|
||||
return ($result && Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'product_tag (id_product, id_tag) VALUES '.implode(',', $ids)) && Search::indexation(false));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function deleteTagsForProduct($id_product)
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_tag` WHERE `id_product` = '.(int)$id_product);
|
||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_tag` WHERE `id_product` = '.(int)$id_product);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -46,6 +46,6 @@ class ThemeCore extends ObjectModel
|
||||
$sql = 'SELECT *
|
||||
FROM '._DB_PREFIX_.'theme
|
||||
ORDER BY name';
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -856,7 +856,7 @@ class ToolsCore
|
||||
AND cl.id_lang = '.(int)$context->language->id.'
|
||||
AND c.active = 1
|
||||
ORDER BY c.level_depth ASC';
|
||||
$categories = Db::getInstance()->ExecuteS($sql);
|
||||
$categories = Db::getInstance()->executeS($sql);
|
||||
|
||||
$n = 1;
|
||||
$nCategories = (int)sizeof($categories);
|
||||
|
||||
@@ -43,7 +43,7 @@ class TranslatedConfigurationCore extends Configuration
|
||||
// Otherwise configuration is not set as translated configuration.
|
||||
if ($id !== null)
|
||||
{
|
||||
$id_translated = Db::getInstance()->ExecuteS('SELECT `'.$this->identifier.'` FROM `'.pSQL(_DB_PREFIX_.$this->table).'_lang` WHERE `'.$this->identifier.'`='.pSQL($id).' LIMIT 0,1');
|
||||
$id_translated = Db::getInstance()->executeS('SELECT `'.$this->identifier.'` FROM `'.pSQL(_DB_PREFIX_.$this->table).'_lang` WHERE `'.$this->identifier.'`='.pSQL($id).' LIMIT 0,1');
|
||||
if (empty($id_translated))
|
||||
$id = null;
|
||||
}
|
||||
@@ -90,6 +90,6 @@ class TranslatedConfigurationCore extends Configuration
|
||||
'.($sql_sort != '' ? $sql_sort : '').'
|
||||
'.($sql_limit != '' ? $sql_limit : '').'
|
||||
';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($query);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -60,7 +60,7 @@ class ZoneCore extends ObjectModel
|
||||
*/
|
||||
public static function getZones($active = false)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'zone`
|
||||
'.($active ? 'WHERE active = 1' : '').'
|
||||
@@ -90,12 +90,12 @@ class ZoneCore extends ObjectModel
|
||||
if (parent::delete())
|
||||
{
|
||||
/* Delete regarding delivery preferences */
|
||||
$result = Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'carrier_zone WHERE id_zone = '.(int)$this->id);
|
||||
$result &= Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'delivery WHERE id_zone = '.(int)$this->id);
|
||||
$result = Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'carrier_zone WHERE id_zone = '.(int)$this->id);
|
||||
$result &= Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'delivery WHERE id_zone = '.(int)$this->id);
|
||||
|
||||
/* Update Country & state zone with 0 */
|
||||
$result &= Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'country SET id_zone = 0 WHERE id_zone = '.(int)$this->id);
|
||||
$result &= Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'state SET id_zone = 0 WHERE id_zone = '.(int)$this->id);
|
||||
$result &= Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'country SET id_zone = 0 WHERE id_zone = '.(int)$this->id);
|
||||
$result &= Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'state SET id_zone = 0 WHERE id_zone = '.(int)$this->id);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
+83
-78
@@ -31,25 +31,25 @@ if (file_exists(dirname(__FILE__).'/../config/settings.inc.php'))
|
||||
abstract class DbCore
|
||||
{
|
||||
/** @var string Server (eg. localhost) */
|
||||
protected $_server;
|
||||
protected $server;
|
||||
|
||||
/** @var string Database user (eg. root) */
|
||||
protected $_user;
|
||||
protected $user;
|
||||
|
||||
/** @var string Database password (eg. can be empty !) */
|
||||
protected $_password;
|
||||
protected $password;
|
||||
|
||||
/** @var string Database name */
|
||||
protected $_database;
|
||||
protected $database;
|
||||
|
||||
/** @var mixed Ressource link */
|
||||
protected $_link;
|
||||
protected $link;
|
||||
|
||||
/** @var mixed SQL cached result */
|
||||
protected $_result;
|
||||
protected $result;
|
||||
|
||||
/** @var array List of DB instance */
|
||||
protected static $_instance = array();
|
||||
protected static $instance = array();
|
||||
|
||||
/** @var array Object instance for singleton */
|
||||
protected static $_servers = array(
|
||||
@@ -64,14 +64,14 @@ abstract class DbCore
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_lastQuery;
|
||||
protected $last_query;
|
||||
|
||||
/**
|
||||
* Last cached query
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_lastCached;
|
||||
protected $last_cached;
|
||||
|
||||
/**
|
||||
* Open a connection
|
||||
@@ -149,22 +149,27 @@ abstract class DbCore
|
||||
{
|
||||
static $id = 0;
|
||||
|
||||
$nServers = sizeof(self::$_servers);
|
||||
if ($master || $nServers == 1)
|
||||
$idServer = 0;
|
||||
$total_servers = count(self::$_servers);
|
||||
if ($master || $total_servers == 1)
|
||||
$id_server = 0;
|
||||
else
|
||||
{
|
||||
$id++;
|
||||
$idServer = ($nServers > 2 && ($id % $nServers) != 0) ? $id : 1;
|
||||
$id_server = ($total_servers > 2 && ($id % $total_servers) != 0) ? $id : 1;
|
||||
}
|
||||
|
||||
if (!isset(self::$_instance[$idServer]))
|
||||
if (!isset(self::$instance[$id_server]))
|
||||
{
|
||||
$class = Db::getClass();
|
||||
self::$_instance[$idServer] = new $class(self::$_servers[$idServer]['server'], self::$_servers[$idServer]['user'], self::$_servers[$idServer]['password'], self::$_servers[$idServer]['database']);
|
||||
self::$instance[$id_server] = new $class(
|
||||
self::$_servers[$id_server]['server'],
|
||||
self::$_servers[$id_server]['user'],
|
||||
self::$_servers[$id_server]['password'],
|
||||
self::$_servers[$id_server]['database']
|
||||
);
|
||||
}
|
||||
|
||||
return self::$_instance[$idServer];
|
||||
return self::$instance[$id_server];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,11 +196,11 @@ abstract class DbCore
|
||||
*/
|
||||
public function __construct($server, $user, $password, $database, $connect = true)
|
||||
{
|
||||
$this->_server = $server;
|
||||
$this->_user = $user;
|
||||
$this->_password = $password;
|
||||
$this->_type = _DB_TYPE_;
|
||||
$this->_database = $database;
|
||||
$this->server = $server;
|
||||
$this->user = $user;
|
||||
$this->password = $password;
|
||||
$this->type = _DB_TYPE_;
|
||||
$this->database = $database;
|
||||
|
||||
if (!defined('_PS_DEBUG_SQL_'))
|
||||
define('_PS_DEBUG_SQL_', false);
|
||||
@@ -209,7 +214,7 @@ abstract class DbCore
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
if ($this->_link)
|
||||
if ($this->link)
|
||||
$this->disconnect();
|
||||
}
|
||||
|
||||
@@ -221,10 +226,10 @@ abstract class DbCore
|
||||
* @param string $type INSERT or UPDATE
|
||||
* @param string $where WHERE clause, only for UPDATE (optional)
|
||||
* @param string $limit LIMIT clause (optional)
|
||||
* @param bool $useNull If true, replace empty strings and NULL by a NULL value
|
||||
* @param bool $use_null If true, replace empty strings and NULL by a NULL value
|
||||
* @return mixed|boolean SQL query result
|
||||
*/
|
||||
public function autoExecute($table, $data, $type, $where = false, $limit = false, $use_cache = 1, $useNull = false)
|
||||
public function autoExecute($table, $data, $type, $where = false, $limit = false, $use_cache = 1, $use_null = false)
|
||||
{
|
||||
if (!$data)
|
||||
return true;
|
||||
@@ -234,13 +239,13 @@ abstract class DbCore
|
||||
// Check if $data is a list of row
|
||||
if (!is_array(current($data)))
|
||||
$data = array($data);
|
||||
|
||||
|
||||
$keys = array();
|
||||
$values_stringified = array();
|
||||
foreach ($data as $row_data)
|
||||
{
|
||||
$values = array();
|
||||
foreach ($row_data AS $key => $value)
|
||||
foreach ($row_data as $key => $value)
|
||||
{
|
||||
if (isset($keys_stringified))
|
||||
{
|
||||
@@ -250,8 +255,8 @@ abstract class DbCore
|
||||
}
|
||||
else
|
||||
$keys[] = "`$key`";
|
||||
|
||||
$values[] = ($useNull && ($value === '' || is_null($value))) ? 'NULL' : "'$value'";
|
||||
|
||||
$values[] = ($use_null && ($value === '' || is_null($value))) ? 'NULL' : "'$value'";
|
||||
}
|
||||
$keys_stringified = implode(', ', $keys);
|
||||
$values_stringified[] = '('.implode(', ', $values).')';
|
||||
@@ -265,8 +270,8 @@ abstract class DbCore
|
||||
else if (strtoupper($type) == 'UPDATE')
|
||||
{
|
||||
$sql = 'UPDATE `'.$table.'` SET ';
|
||||
foreach ($data AS $key => $value)
|
||||
$sql .= ($useNull && ($value === '' || is_null($value))) ? "`$key` = NULL," : "`$key` = '$value',";
|
||||
foreach ($data as $key => $value)
|
||||
$sql .= ($use_null && ($value === '' || is_null($value))) ? "`$key` = NULL," : "`$key` = '$value',";
|
||||
$sql = rtrim($sql, ',');
|
||||
if ($where)
|
||||
$sql .= ' WHERE '.$where;
|
||||
@@ -321,10 +326,10 @@ abstract class DbCore
|
||||
*/
|
||||
public function delete($table, $where = false, $limit = false, $use_cache = 1)
|
||||
{
|
||||
$this->_result = false;
|
||||
$this->result = false;
|
||||
$sql = 'DELETE FROM `'.bqSQL($table).'`'.($where ? ' WHERE '.$where : '').($limit ? ' LIMIT '.(int)$limit : '');
|
||||
$res = $this->query($sql);
|
||||
if ($use_cache AND _PS_CACHE_ENABLED_)
|
||||
if ($use_cache && _PS_CACHE_ENABLED_)
|
||||
Cache::getInstance()->deleteQuery($sql);
|
||||
return $res;
|
||||
}
|
||||
@@ -336,13 +341,13 @@ abstract class DbCore
|
||||
* @param bool $use_cache
|
||||
* @return mixed
|
||||
*/
|
||||
public function Execute($sql, $use_cache = 1)
|
||||
public function execute($sql, $use_cache = 1)
|
||||
{
|
||||
$sql = (string)$sql;
|
||||
$this->_result = $this->query($sql);
|
||||
if ($use_cache AND _PS_CACHE_ENABLED_)
|
||||
$this->result = $this->query($sql);
|
||||
if ($use_cache && _PS_CACHE_ENABLED_)
|
||||
Cache::getInstance()->deleteQuery($sql);
|
||||
return $this->_result;
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -353,32 +358,32 @@ abstract class DbCore
|
||||
* @param int $use_cache if query has been already executed, use its result
|
||||
* @return array or result object
|
||||
*/
|
||||
public function ExecuteS($sql, $array = true, $use_cache = 1)
|
||||
public function executeS($sql, $array = true, $use_cache = 1)
|
||||
{
|
||||
$sql = (string)$sql;
|
||||
$this->_result = false;
|
||||
$this->_lastQuery = $sql;
|
||||
if ($use_cache AND _PS_CACHE_ENABLED_ && $array AND ($result = Cache::getInstance()->get(md5($sql))))
|
||||
$this->result = false;
|
||||
$this->last_query = $sql;
|
||||
if ($use_cache && _PS_CACHE_ENABLED_ && $array && ($result = Cache::getInstance()->get(md5($sql))))
|
||||
{
|
||||
$this->_lastCached = true;
|
||||
$this->last_cached = true;
|
||||
return $result;
|
||||
}
|
||||
|
||||
$this->_result = $this->query($sql);
|
||||
if (!$this->_result)
|
||||
$this->result = $this->query($sql);
|
||||
if (!$this->result)
|
||||
return false;
|
||||
|
||||
$this->_lastCached = false;
|
||||
$this->last_cached = false;
|
||||
if (!$array)
|
||||
return $this->_result;
|
||||
return $this->result;
|
||||
|
||||
$resultArray = array();
|
||||
while ($row = $this->nextRow($this->_result))
|
||||
$resultArray[] = $row;
|
||||
$result_array = array();
|
||||
while ($row = $this->nextRow($this->result))
|
||||
$result_array[] = $row;
|
||||
|
||||
if ($use_cache AND _PS_CACHE_ENABLED_)
|
||||
Cache::getInstance()->setQuery($sql, $resultArray);
|
||||
return $resultArray;
|
||||
if ($use_cache && _PS_CACHE_ENABLED_)
|
||||
Cache::getInstance()->setQuery($sql, $result_array);
|
||||
return $result_array;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -393,21 +398,21 @@ abstract class DbCore
|
||||
{
|
||||
$sql = (string)$sql;
|
||||
$sql .= ' LIMIT 1';
|
||||
$this->_result = false;
|
||||
$this->_lastQuery = $sql;
|
||||
$this->result = false;
|
||||
$this->last_query = $sql;
|
||||
if ($use_cache && _PS_CACHE_ENABLED_ && ($result = Cache::getInstance()->get(md5($sql))))
|
||||
{
|
||||
$this->_lastCached = true;
|
||||
$this->last_cached = true;
|
||||
return $result;
|
||||
}
|
||||
|
||||
$this->_result = $this->query($sql);
|
||||
if (!$this->_result)
|
||||
$this->result = $this->query($sql);
|
||||
if (!$this->result)
|
||||
return false;
|
||||
|
||||
$this->_lastCached = false;
|
||||
$result = $this->nextRow($this->_result);
|
||||
if ($use_cache AND _PS_CACHE_ENABLED_)
|
||||
$this->last_cached = false;
|
||||
$result = $this->nextRow($this->result);
|
||||
if ($use_cache && _PS_CACHE_ENABLED_)
|
||||
Cache::getInstance()->setQuery($sql, $result);
|
||||
return $result;
|
||||
}
|
||||
@@ -432,17 +437,17 @@ abstract class DbCore
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function NumRows()
|
||||
public function numRows()
|
||||
{
|
||||
if (!$this->_lastCached && $this->_result)
|
||||
if (!$this->last_cached && $this->result)
|
||||
{
|
||||
$nrows = $this->_numRows($this->_result);
|
||||
$nrows = $this->_numRows($this->result);
|
||||
if (_PS_CACHE_ENABLED_)
|
||||
Cache::getInstance()->setNumRows(md5($this->_lastQuery), $nrows);
|
||||
Cache::getInstance()->setNumRows(md5($this->last_query), $nrows);
|
||||
return $nrows;
|
||||
}
|
||||
else if (_PS_CACHE_ENABLED_ AND $this->_lastCached)
|
||||
return Cache::getInstance()->getNumRows(md5($this->_lastQuery));
|
||||
else if (_PS_CACHE_ENABLED_ && $this->last_cached)
|
||||
return Cache::getInstance()->getNumRows(md5($this->last_query));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -457,9 +462,9 @@ abstract class DbCore
|
||||
global $webservice_call;
|
||||
|
||||
$sql = (string)$sql;
|
||||
$this->_result = false;
|
||||
$this->result = false;
|
||||
$result = $this->query($sql);
|
||||
if ($use_cache AND _PS_CACHE_ENABLED_)
|
||||
if ($use_cache && _PS_CACHE_ENABLED_)
|
||||
Cache::getInstance()->deleteQuery($sql);
|
||||
return $result;
|
||||
}
|
||||
@@ -476,7 +481,7 @@ abstract class DbCore
|
||||
$errno = $this->getNumberError();
|
||||
if ($webservice_call && $errno)
|
||||
WebserviceRequest::getInstance()->setError(500, '[SQL Error] '.$this->getMsgError().'. Query was : '.$sql, 97);
|
||||
elseif (_PS_DEBUG_SQL_ AND $errno AND !defined('PS_INSTALLATION_IN_PROGRESS'))
|
||||
else if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))
|
||||
{
|
||||
if ($sql)
|
||||
die(Tools::displayError($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>'));
|
||||
@@ -488,17 +493,17 @@ abstract class DbCore
|
||||
* Sanitize data which will be injected into SQL query
|
||||
*
|
||||
* @param string $string SQL data which will be injected into SQL query
|
||||
* @param boolean $htmlOK Does data contain HTML code ? (optional)
|
||||
* @param boolean $html_ok Does data contain HTML code ? (optional)
|
||||
* @return string Sanitized data
|
||||
*/
|
||||
public function escape($string, $htmlOK)
|
||||
public function escape($string, $html_ok)
|
||||
{
|
||||
if (_PS_MAGIC_QUOTES_GPC_)
|
||||
$string = stripslashes($string);
|
||||
if (!is_numeric($string))
|
||||
{
|
||||
$string = $this->_escape($string);
|
||||
if (!$htmlOK)
|
||||
if (!$html_ok)
|
||||
$string = strip_tags(Tools::nl2br($string));
|
||||
}
|
||||
|
||||
@@ -515,9 +520,9 @@ abstract class DbCore
|
||||
* @param bool $newDbLink
|
||||
* @return int
|
||||
*/
|
||||
static public function checkConnection($server, $user, $pwd, $db, $newDbLink = true)
|
||||
public static function checkConnection($server, $user, $pwd, $db, $new_db_link = true)
|
||||
{
|
||||
return call_user_func_array(array(Db::getClass(), 'tryToConnect'), array($server, $user, $pwd, $db, $newDbLink));
|
||||
return call_user_func_array(array(Db::getClass(), 'tryToConnect'), array($server, $user, $pwd, $db, $new_db_link));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -528,7 +533,7 @@ abstract class DbCore
|
||||
* @param string $pwd Password for database connection
|
||||
* @return int
|
||||
*/
|
||||
static public function checkEncoding($server, $user, $pwd)
|
||||
public static function checkEncoding($server, $user, $pwd)
|
||||
{
|
||||
return call_user_func_array(array(Db::getClass(), 'tryUTF8'), array($server, $user, $pwd));
|
||||
}
|
||||
@@ -539,19 +544,19 @@ abstract class DbCore
|
||||
* @acces string query The query to execute
|
||||
* @return array Array of line returned by MySQL
|
||||
*/
|
||||
static public function s($sql, $use_cache = 1)
|
||||
public static function s($sql, $use_cache = 1)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS($sql, true, $use_cache);
|
||||
return Db::getInstance()->executeS($sql, true, $use_cache);
|
||||
}
|
||||
|
||||
static public function ps($sql, $use_cache = 1)
|
||||
public static function ps($sql, $use_cache = 1)
|
||||
{
|
||||
$ret = Db::s($sql, $use_cache);
|
||||
p($ret);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
static public function ds($sql, $use_cache = 1)
|
||||
public static function ds($sql, $use_cache = 1)
|
||||
{
|
||||
Db::s($sql, $use_cache);
|
||||
die();
|
||||
|
||||
+12
-12
@@ -35,17 +35,17 @@ class DbMySQLiCore extends Db
|
||||
*/
|
||||
public function connect()
|
||||
{
|
||||
$this->_link = new mysqli($this->_server, $this->_user, $this->_password, $this->_database);
|
||||
$this->link = new mysqli($this->server, $this->user, $this->password, $this->database);
|
||||
|
||||
// Do not use object way for error because this work bad before PHP 5.2.9
|
||||
if (mysqli_connect_error())
|
||||
die(Tools::displayError('Link to database cannot be established : '.mysqli_connect_error()));
|
||||
|
||||
// UTF-8 support
|
||||
if (!$this->_link->query('SET NAMES \'utf8\''))
|
||||
if (!$this->link->query('SET NAMES \'utf8\''))
|
||||
die(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
|
||||
|
||||
return $this->_link;
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,7 +53,7 @@ class DbMySQLiCore extends Db
|
||||
*/
|
||||
public function disconnect()
|
||||
{
|
||||
$this->_link->close();
|
||||
$this->link->close();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +61,7 @@ class DbMySQLiCore extends Db
|
||||
*/
|
||||
protected function _query($sql)
|
||||
{
|
||||
return $this->_link->query($sql);
|
||||
return $this->link->query($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ class DbMySQLiCore extends Db
|
||||
public function nextRow($result = false)
|
||||
{
|
||||
if (!$result)
|
||||
$result = $this->_result;
|
||||
$result = $this->result;
|
||||
return $result->fetch_assoc();
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ class DbMySQLiCore extends Db
|
||||
*/
|
||||
public function Insert_ID()
|
||||
{
|
||||
return $this->_link->insert_id;
|
||||
return $this->link->insert_id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +95,7 @@ class DbMySQLiCore extends Db
|
||||
*/
|
||||
public function Affected_Rows()
|
||||
{
|
||||
return $this->_link->affected_rows;
|
||||
return $this->link->affected_rows;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +103,7 @@ class DbMySQLiCore extends Db
|
||||
*/
|
||||
public function getMsgError($query = false)
|
||||
{
|
||||
return $this->_link->error;
|
||||
return $this->link->error;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +111,7 @@ class DbMySQLiCore extends Db
|
||||
*/
|
||||
public function getNumberError()
|
||||
{
|
||||
return $this->_link->errno;
|
||||
return $this->link->errno;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +127,7 @@ class DbMySQLiCore extends Db
|
||||
*/
|
||||
public function _escape($str)
|
||||
{
|
||||
return $this->_link->real_escape_string($str);
|
||||
return $this->link->real_escape_string($str);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,7 +135,7 @@ class DbMySQLiCore extends Db
|
||||
*/
|
||||
public function set_db($db_name)
|
||||
{
|
||||
return $this->_link->query('USE '.pSQL($db_name));
|
||||
return $this->link->query('USE '.pSQL($db_name));
|
||||
}
|
||||
|
||||
static public function tryToConnect($server, $user, $pwd, $db, $newDbLink = true)
|
||||
|
||||
+11
-11
@@ -39,7 +39,7 @@ class DbPDOCore extends Db
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->_link = new PDO('mysql:dbname='.$this->_database.';host='.$this->_server, $this->_user, $this->_password);
|
||||
$this->link = new PDO('mysql:dbname='.$this->database.';host='.$this->server, $this->user, $this->password);
|
||||
}
|
||||
catch (PDOException $e)
|
||||
{
|
||||
@@ -47,10 +47,10 @@ class DbPDOCore extends Db
|
||||
}
|
||||
|
||||
// UTF-8 support
|
||||
if ($this->_link->exec('SET NAMES \'utf8\'') === false)
|
||||
if ($this->link->exec('SET NAMES \'utf8\'') === false)
|
||||
die(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
|
||||
|
||||
return $this->_link;
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,7 +58,7 @@ class DbPDOCore extends Db
|
||||
*/
|
||||
public function disconnect()
|
||||
{
|
||||
unset($this->_link);
|
||||
unset($this->link);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ class DbPDOCore extends Db
|
||||
*/
|
||||
protected function _query($sql)
|
||||
{
|
||||
return $this->_link->query($sql);
|
||||
return $this->link->query($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,7 +75,7 @@ class DbPDOCore extends Db
|
||||
public function nextRow($result = false)
|
||||
{
|
||||
if (!$result)
|
||||
$result = $this->_result;
|
||||
$result = $this->result;
|
||||
return $result->fetch();
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class DbPDOCore extends Db
|
||||
*/
|
||||
public function Insert_ID()
|
||||
{
|
||||
return $this->_link->lastInsertId();
|
||||
return $this->link->lastInsertId();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +100,7 @@ class DbPDOCore extends Db
|
||||
*/
|
||||
public function Affected_Rows()
|
||||
{
|
||||
return $this->_result->rowCount();
|
||||
return $this->result->rowCount();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,7 +108,7 @@ class DbPDOCore extends Db
|
||||
*/
|
||||
public function getMsgError($query = false)
|
||||
{
|
||||
$error = $this->_link->errorInfo();
|
||||
$error = $this->link->errorInfo();
|
||||
return $error[2];
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class DbPDOCore extends Db
|
||||
*/
|
||||
public function getNumberError()
|
||||
{
|
||||
$error = $this->_link->errorInfo();
|
||||
$error = $this->link->errorInfo();
|
||||
return $error[1];
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ class DbPDOCore extends Db
|
||||
*/
|
||||
public function set_db($db_name)
|
||||
{
|
||||
return $this->_link->exec('USE '.pSQL($db_name));
|
||||
return $this->link->exec('USE '.pSQL($db_name));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+22
-22
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -34,18 +34,18 @@ class MySQLCore extends Db
|
||||
{
|
||||
if (!defined('_PS_MYSQL_REAL_ESCAPE_STRING_'))
|
||||
define('_PS_MYSQL_REAL_ESCAPE_STRING_', function_exists('mysql_real_escape_string'));
|
||||
|
||||
if (!$this->_link = mysql_connect($this->_server, $this->_user, $this->_password))
|
||||
|
||||
if (!$this->link = mysql_connect($this->server, $this->user, $this->password))
|
||||
die(Tools::displayError('Link to database cannot be established.'));
|
||||
|
||||
if (!$this->set_db($this->_database))
|
||||
if (!$this->set_db($this->database))
|
||||
die(Tools::displayError('The database selection cannot be made.'));
|
||||
|
||||
// UTF-8 support
|
||||
if (!mysql_query('SET NAMES \'utf8\'', $this->_link))
|
||||
if (!mysql_query('SET NAMES \'utf8\'', $this->link))
|
||||
die(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
|
||||
|
||||
return $this->_link;
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,15 +53,15 @@ class MySQLCore extends Db
|
||||
*/
|
||||
public function disconnect()
|
||||
{
|
||||
mysql_close($this->_link);
|
||||
mysql_close($this->link);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see DbCore::_query()
|
||||
*/
|
||||
protected function _query($sql)
|
||||
{
|
||||
return mysql_query($sql, $this->_link);
|
||||
return mysql_query($sql, $this->link);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,9 +69,9 @@ class MySQLCore extends Db
|
||||
*/
|
||||
public function nextRow($result = false)
|
||||
{
|
||||
return mysql_fetch_assoc($result ? $result : $this->_result);
|
||||
return mysql_fetch_assoc($result ? $result : $this->result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see DbCore::_numRows()
|
||||
*/
|
||||
@@ -79,13 +79,13 @@ class MySQLCore extends Db
|
||||
{
|
||||
return mysql_num_rows($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see DbCore::Insert_ID()
|
||||
*/
|
||||
public function Insert_ID()
|
||||
{
|
||||
return mysql_insert_id($this->_link);
|
||||
return mysql_insert_id($this->link);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +93,7 @@ class MySQLCore extends Db
|
||||
*/
|
||||
public function Affected_Rows()
|
||||
{
|
||||
return mysql_affected_rows($this->_link);
|
||||
return mysql_affected_rows($this->link);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +101,7 @@ class MySQLCore extends Db
|
||||
*/
|
||||
public function getMsgError($query = false)
|
||||
{
|
||||
return mysql_error($this->_link);
|
||||
return mysql_error($this->link);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,31 +109,31 @@ class MySQLCore extends Db
|
||||
*/
|
||||
public function getNumberError()
|
||||
{
|
||||
return mysql_errno($this->_link);
|
||||
return mysql_errno($this->link);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see DbCore::getVersion()
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return mysql_get_server_info($this->_link);
|
||||
return mysql_get_server_info($this->link);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see DbCore::_escape()
|
||||
*/
|
||||
public function _escape($str)
|
||||
{
|
||||
return _PS_MYSQL_REAL_ESCAPE_STRING_ ? mysql_real_escape_string($str, $this->_link) : addslashes($str);
|
||||
return _PS_MYSQL_REAL_ESCAPE_STRING_ ? mysql_real_escape_string($str, $this->link) : addslashes($str);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see DbCore::set_db()
|
||||
*/
|
||||
public function set_db($db_name)
|
||||
{
|
||||
return mysql_select_db($db_name, $this->_link);
|
||||
return mysql_select_db($db_name, $this->link);
|
||||
}
|
||||
|
||||
public static function tryToConnect($server, $user, $pwd, $db, $newDbLink = true)
|
||||
|
||||
@@ -75,7 +75,7 @@ class GroupShopCore extends ObjectModel
|
||||
|
||||
public static function getGroupShops($active = true)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('SELECT *
|
||||
return Db::getInstance()->executeS('SELECT *
|
||||
FROM '._DB_PREFIX_.'group_shop
|
||||
WHERE `deleted`= 0 AND `active`='.(int)$active);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ class GroupShopCore extends ObjectModel
|
||||
$id = 'id_group_shop';
|
||||
else
|
||||
$table_name .= '_'.$row['type'];
|
||||
$res &= Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.$table_name.'` WHERE `'.$id.'`='.(int)$this->id);
|
||||
$res &= Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.$table_name.'` WHERE `'.$id.'`='.(int)$this->id);
|
||||
}
|
||||
|
||||
return $res;
|
||||
@@ -164,12 +164,12 @@ class GroupShopCore extends ObjectModel
|
||||
$sql = 'INSERT IGNORE INTO `'._DB_PREFIX_.$table_name.'` ('.$keys.', '.$id.')
|
||||
(SELECT '.$keys.', '.(int)$this->id.' FROM '._DB_PREFIX_.$table_name.'
|
||||
WHERE `'.$id.'` = '.(int)$old_id.')';
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.$table_name.'` SET WHERE `'.$id.'`='.(int)$old_id);
|
||||
//Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.$table_name.'` SET WHERE `'.$id.'`='.(int)$old_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ class ShopCore extends ObjectModel
|
||||
$id = 'id_shop';
|
||||
else
|
||||
$table_name .= '_'.$row['type'];
|
||||
$res &= Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.$table_name.'` WHERE `'.$id.'`='.(int)$this->id);
|
||||
$res &= Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.$table_name.'` WHERE `'.$id.'`='.(int)$this->id);
|
||||
}
|
||||
|
||||
Shop::cacheShops(true);
|
||||
@@ -340,7 +340,7 @@ class ShopCore extends ObjectModel
|
||||
FROM '._DB_PREFIX.'shop_url
|
||||
WHERE active = 1
|
||||
AND id_shop = '.(int)$this->id;
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -399,7 +399,7 @@ class ShopCore extends ObjectModel
|
||||
'.$where.'
|
||||
ORDER BY gs.name, s.name';
|
||||
|
||||
if ($results = Db::getInstance()->ExecuteS($sql))
|
||||
if ($results = Db::getInstance()->executeS($sql))
|
||||
{
|
||||
$group_shop = new GroupShop();
|
||||
foreach ($results as $row)
|
||||
@@ -790,12 +790,12 @@ class ShopCore extends ObjectModel
|
||||
$sql = 'INSERT IGNORE INTO `'._DB_PREFIX_.$table_name.'` ('.$keys.', '.$id.')
|
||||
(SELECT '.$keys.', '.(int)$this->id.' FROM '._DB_PREFIX_.$table_name.'
|
||||
WHERE `'.$id.'` = '.(int)$old_id.')';
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
/*else
|
||||
{
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.$table_name.'` SET WHERE `'.$id.'`='.(int)$old_id);
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.$table_name.'` SET WHERE `'.$id.'`='.(int)$old_id);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class ShopUrlCore extends ObjectModel
|
||||
FROM '._DB_PREFIX_.'shop_url
|
||||
WHERE 1
|
||||
'.($id_shop ? ' AND id_shop = '.(int)$id_shop : '');
|
||||
return Db::getInstance()->ExecuteS($sql);
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
public function setMain()
|
||||
|
||||
@@ -335,7 +335,7 @@ class StockManagerCore implements StockManagerInterface
|
||||
if ($price_te != null)
|
||||
$query->where('price_te = '.(float)$price_te);
|
||||
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($query);
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
|
||||
return ObjectModel::hydrateCollection('Stock', $results);
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ class StockMvtCore extends ObjectModel
|
||||
) = 0
|
||||
GROUP BY s.id_product, s.id_shop
|
||||
HAVING qty <> 0';
|
||||
$products_without_attributes = Db::getInstance()->ExecuteS($sql);
|
||||
$products_without_attributes = Db::getInstance()->executeS($sql);
|
||||
|
||||
// Search missing stock movement on products with attributes
|
||||
$sql = 'SELECT s.id_stock, (stock.quantity - SUM(IFNULL(sm.quantity, 0))) AS qty
|
||||
@@ -176,7 +176,7 @@ class StockMvtCore extends ObjectModel
|
||||
) > 0
|
||||
GROUP BY s.id_product_attribute
|
||||
HAVING qty <> 0';
|
||||
$products_with_attributes = Db::getInstance()->ExecuteS($sql);
|
||||
$products_with_attributes = Db::getInstance()->executeS($sql);
|
||||
|
||||
// Add missing stock movements
|
||||
$products = array_merge($products_without_attributes, $products_with_attributes);
|
||||
|
||||
@@ -65,6 +65,6 @@ class StockMvtReasonCore extends ObjectModel
|
||||
$query->select('smrl.name, smr.id_stock_mvt_reason, smr.sign');
|
||||
$query->from('stock_mvt_reason smr');
|
||||
$query->leftjoin('stock_mvt_reason_lang smrl ON (smr.id_stock_mvt_reason = smrl.id_stock_mvt_reason AND smrl.id_lang='.(int)$id_lang.')');
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($query);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -169,7 +169,7 @@ class TaxCore extends ObjectModel
|
||||
if ($active_only)
|
||||
$sql->where('t.`active` = 1');
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
|
||||
public static function excludeTaxeOption()
|
||||
|
||||
@@ -69,7 +69,7 @@ class TaxRuleCore extends ObjectModel
|
||||
if (empty($id_group))
|
||||
die(Tools::displayError());
|
||||
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'tax_rule`
|
||||
WHERE `id_tax_rules_group` = '.(int)$id_group
|
||||
);
|
||||
@@ -84,7 +84,7 @@ class TaxRuleCore extends ObjectModel
|
||||
|
||||
public static function getTaxRulesByGroupId($id_lang, $id_group)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT g.`id_tax_rule`,
|
||||
c.`name` AS country_name,
|
||||
s.`name` AS state_name,
|
||||
@@ -103,7 +103,7 @@ class TaxRuleCore extends ObjectModel
|
||||
|
||||
public static function deleteTaxRuleByIdTax($id_tax)
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'tax_rule`
|
||||
WHERE `id_tax` = '.(int)$id_tax
|
||||
);
|
||||
@@ -171,7 +171,7 @@ class TaxRuleCore extends ObjectModel
|
||||
*/
|
||||
public static function swapTaxId($old_id, $new_id)
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'tax_rule`
|
||||
SET `id_tax` = '.(int)$new_id.'
|
||||
WHERE `id_tax` = '.(int)$old_id
|
||||
|
||||
@@ -52,7 +52,7 @@ class TaxRulesGroupCore extends ObjectModel
|
||||
|
||||
public static function getTaxRulesGroups($only_active = true)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'tax_rules_group` g'
|
||||
.($only_active ? ' WHERE g.`active` = 1' : '')
|
||||
@@ -74,7 +74,7 @@ class TaxRulesGroupCore extends ObjectModel
|
||||
*/
|
||||
public static function getAssociatedTaxRatesByIdCountry($id_country)
|
||||
{
|
||||
$rows = Db::getInstance()->ExecuteS('
|
||||
$rows = Db::getInstance()->executeS('
|
||||
SELECT rg.`id_tax_rules_group`, t.`rate`
|
||||
FROM `'._DB_PREFIX_.'tax_rules_group` rg
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (tr.`id_tax_rules_group` = rg.`id_tax_rules_group`)
|
||||
|
||||
@@ -67,7 +67,7 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface
|
||||
|
||||
if (!isset(self::$cache_tax_calculator[$postcode]))
|
||||
{
|
||||
$rows = Db::getInstance()->ExecuteS('
|
||||
$rows = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'tax_rule`
|
||||
WHERE `id_country` = '.(int)$this->address->id_country.'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -29,13 +29,13 @@ class WebserviceKeyCore extends ObjectModel
|
||||
{
|
||||
/** @var string Key */
|
||||
public $key;
|
||||
|
||||
|
||||
/** @var boolean Webservice Account statuts */
|
||||
public $active = true;
|
||||
|
||||
|
||||
/** @var string Webservice Account description */
|
||||
public $description;
|
||||
|
||||
|
||||
protected $fieldsRequired = array('key');
|
||||
protected $fieldsSize = array('key' => 32);
|
||||
protected $fieldsValidate = array('active' => 'isBool');
|
||||
@@ -43,56 +43,56 @@ class WebserviceKeyCore extends ObjectModel
|
||||
protected $table = 'webservice_account';
|
||||
protected $identifier = 'id_webservice_account';
|
||||
|
||||
|
||||
|
||||
public function add($autodate = true, $nullValues = false)
|
||||
{
|
||||
if (WebserviceKey::keyExists($this->key))
|
||||
return false;
|
||||
return parent::add($autodate = true, $nullValues = false);
|
||||
}
|
||||
|
||||
|
||||
static public function keyExists($key)
|
||||
{
|
||||
return (!Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT `key`
|
||||
FROM '._DB_PREFIX_.'webservice_account
|
||||
return (!Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT `key`
|
||||
FROM '._DB_PREFIX_.'webservice_account
|
||||
WHERE `key` = \''.pSQL($key).'\'') ? false : true);
|
||||
}
|
||||
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
$this->validateFields();
|
||||
|
||||
|
||||
$fields['key'] = pSQL($this->key);
|
||||
$fields['active'] = (int)($this->active);
|
||||
$fields['description'] = pSQL($this->description);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (!parent::delete() OR $this->deleteAssociations() === false)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function deleteAssociations()
|
||||
{
|
||||
if (
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'webservice_permission`
|
||||
WHERE `id_webservice_account` = '.(int)($this->id)) === false
|
||||
||
|
||||
Db::getInstance()->Execute('
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'webservice_permission`
|
||||
WHERE `id_webservice_account` = '.(int)($this->id)) === false
|
||||
)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static function getPermissionForAccount($auth_key)
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT p.*
|
||||
FROM `'._DB_PREFIX_.'webservice_permission` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'webservice_account` a ON (a.id_webservice_account = p.id_webservice_account)
|
||||
@@ -104,10 +104,10 @@ class WebserviceKeyCore extends ObjectModel
|
||||
$permissions[$row['resource']][] = $row['method'];
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
|
||||
public static function isKeyActive($auth_key)
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT a.active
|
||||
FROM `'._DB_PREFIX_.'webservice_account` a
|
||||
WHERE a.key = \''.pSQL($auth_key).'\'
|
||||
@@ -119,10 +119,10 @@ class WebserviceKeyCore extends ObjectModel
|
||||
return isset($result[0]['active']) && $result[0]['active'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function getClassFromKey($auth_key)
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT a.class_name as class
|
||||
FROM `'._DB_PREFIX_.'webservice_account` a
|
||||
WHERE a.key = \''.pSQL($auth_key).'\'
|
||||
@@ -134,12 +134,12 @@ class WebserviceKeyCore extends ObjectModel
|
||||
return $result[0]['class'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function setPermissionForAccount($idAccount, $permissionsToSet)
|
||||
{
|
||||
$ok = true;
|
||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'webservice_permission` WHERE `id_webservice_account` = '.(int)($idAccount);
|
||||
if(!Db::getInstance(_PS_USE_SQL_SLAVE_)->Execute($sql))
|
||||
if (!Db::getInstance()->execute($sql))
|
||||
$ok = false;
|
||||
if (isset($permissionsToSet))
|
||||
{
|
||||
@@ -158,7 +158,7 @@ class WebserviceKeyCore extends ObjectModel
|
||||
foreach ($permissions as $permission)
|
||||
$sql .= '(NULL , \''.pSQL($permission[1]).'\', \''.pSQL($permission[0]).'\', '.(int)($idAccount).'), ';
|
||||
$sql = rtrim($sql, ', ');
|
||||
if(!Db::getInstance(_PS_USE_SQL_SLAVE_)->Execute($sql))
|
||||
if (!Db::getInstance()->execute($sql))
|
||||
$ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1313,7 +1313,7 @@ class WebserviceRequestCore
|
||||
{
|
||||
$sql = 'DELETE FROM `'._DB_PREFIX_.$this->resourceConfiguration['retrieveData']['table'].'_'.$assoc[$this->resourceConfiguration['retrieveData']['table']]['type'].'`
|
||||
WHERE '.$this->resourceConfiguration['fields']['id']['sqlId'].' = '.$object->id;
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
if (!empty($arr_avoid_id))
|
||||
@@ -1499,7 +1499,7 @@ class WebserviceRequestCore
|
||||
$sql = 'INSERT IGNORE INTO `'._DB_PREFIX_.$this->resourceConfiguration['retrieveData']['table'].'_'.$assoc[$this->resourceConfiguration['retrieveData']['table']]['type'].'` (id_shop, '.$this->resourceConfiguration['fields']['id']['sqlId'].') VALUES ';
|
||||
foreach (self::$shopIDs as $id)
|
||||
$sql .= '('.$id.','.$object->id.')';
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user