// Remove bad _SQL_USE_SLAVE_ uses + normalize Db->executeS(), Db->execute() and Db->numRows() names
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9178 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
251dd966b7
commit
577221ff08
280 files changed
+1971
-1966
No files matched your search
+12
-12
@@ -106,7 +106,7 @@ if (Tools::isSubmit('ajaxProductAccessories'))
|
|||||||
AdminTab::$currentIndex = 'index.php?tab=AdminCatalog';
|
AdminTab::$currentIndex = 'index.php?tab=AdminCatalog';
|
||||||
$jsonArray = array();
|
$jsonArray = array();
|
||||||
|
|
||||||
$products = Db::getInstance()->ExecuteS('
|
$products = Db::getInstance()->executeS('
|
||||||
SELECT p.`id_product`, pl.`name`
|
SELECT p.`id_product`, pl.`name`
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||||
@@ -133,7 +133,7 @@ if (Tools::isSubmit('ajaxDiscountCustomers'))
|
|||||||
if (Validate::isBool_Id($filter))
|
if (Validate::isBool_Id($filter))
|
||||||
$filterArray = explode('_', $filter);
|
$filterArray = explode('_', $filter);
|
||||||
|
|
||||||
$customers = Db::getInstance()->ExecuteS('
|
$customers = Db::getInstance()->executeS('
|
||||||
SELECT `id_customer`, `email`, CONCAT(`lastname`, \' \', `firstname`) as name
|
SELECT `id_customer`, `email`, CONCAT(`lastname`, \' \', `firstname`) as name
|
||||||
FROM `'._DB_PREFIX_.'customer`
|
FROM `'._DB_PREFIX_.'customer`
|
||||||
WHERE `deleted` = 0 AND is_guest = 0
|
WHERE `deleted` = 0 AND is_guest = 0
|
||||||
@@ -145,7 +145,7 @@ if (Tools::isSubmit('ajaxDiscountCustomers'))
|
|||||||
ORDER BY CONCAT(`lastname`, \' \', `firstname`) ASC
|
ORDER BY CONCAT(`lastname`, \' \', `firstname`) ASC
|
||||||
LIMIT 50');
|
LIMIT 50');
|
||||||
|
|
||||||
$groups = Db::getInstance()->ExecuteS('
|
$groups = Db::getInstance()->executeS('
|
||||||
SELECT g.`id_group`, gl.`name`
|
SELECT g.`id_group`, gl.`name`
|
||||||
FROM `'._DB_PREFIX_.'group` g
|
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)($context->language->id).')
|
LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)($context->language->id).')
|
||||||
@@ -371,7 +371,7 @@ if (Tools::isSubmit('ajaxProductImagesPositions'))
|
|||||||
if (Tools::isSubmit('ajaxProductPackItems'))
|
if (Tools::isSubmit('ajaxProductPackItems'))
|
||||||
{
|
{
|
||||||
$jsonArray = array();
|
$jsonArray = array();
|
||||||
$products = Db::getInstance()->ExecuteS('
|
$products = Db::getInstance()->executeS('
|
||||||
SELECT p.`id_product`, pl.`name`
|
SELECT p.`id_product`, pl.`name`
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||||
@@ -387,7 +387,7 @@ if (Tools::isSubmit('ajaxProductPackItems'))
|
|||||||
|
|
||||||
if (Tools::isSubmit('ajaxStates') AND Tools::isSubmit('id_country'))
|
if (Tools::isSubmit('ajaxStates') AND Tools::isSubmit('id_country'))
|
||||||
{
|
{
|
||||||
$states = Db::getInstance()->ExecuteS('
|
$states = Db::getInstance()->executeS('
|
||||||
SELECT s.id_state, s.name
|
SELECT s.id_state, s.name
|
||||||
FROM '._DB_PREFIX_.'state s
|
FROM '._DB_PREFIX_.'state s
|
||||||
LEFT JOIN '._DB_PREFIX_.'country c ON (s.`id_country` = c.`id_country`)
|
LEFT JOIN '._DB_PREFIX_.'country c ON (s.`id_country` = c.`id_country`)
|
||||||
@@ -417,7 +417,7 @@ if (Tools::isSubmit('submitCustomerNote') AND $id_customer = (int)Tools::getValu
|
|||||||
$note = html_entity_decode(Tools::getValue('note'));
|
$note = html_entity_decode(Tools::getValue('note'));
|
||||||
if (!empty($note) AND !Validate::isCleanHtml($note))
|
if (!empty($note) AND !Validate::isCleanHtml($note))
|
||||||
die ('error:validation');
|
die ('error:validation');
|
||||||
if (!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer SET `note` = "'.pSQL($note, true).'" WHERE id_customer = '.(int)$id_customer.' LIMIT 1'))
|
if (!Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'customer SET `note` = "'.pSQL($note, true).'" WHERE id_customer = '.(int)$id_customer.' LIMIT 1'))
|
||||||
die ('error:update');
|
die ('error:update');
|
||||||
die('ok');
|
die('ok');
|
||||||
}
|
}
|
||||||
@@ -509,7 +509,7 @@ if (Tools::isSubmit('submitTrackClickOnHelp'))
|
|||||||
if (Tools::isSubmit('saveImportMatchs'))
|
if (Tools::isSubmit('saveImportMatchs'))
|
||||||
{
|
{
|
||||||
$match = implode('|', Tools::getValue('type_value'));
|
$match = implode('|', Tools::getValue('type_value'));
|
||||||
Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'import_match` (
|
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'import_match` (
|
||||||
`id_import_match` ,
|
`id_import_match` ,
|
||||||
`name` ,
|
`name` ,
|
||||||
`match`,
|
`match`,
|
||||||
@@ -527,12 +527,12 @@ if (Tools::isSubmit('saveImportMatchs'))
|
|||||||
|
|
||||||
if (Tools::isSubmit('deleteImportMatchs'))
|
if (Tools::isSubmit('deleteImportMatchs'))
|
||||||
{
|
{
|
||||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'import_match` WHERE `id_import_match` = '.(int)Tools::getValue('idImportMatchs'));
|
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'import_match` WHERE `id_import_match` = '.(int)Tools::getValue('idImportMatchs'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tools::isSubmit('loadImportMatchs'))
|
if (Tools::isSubmit('loadImportMatchs'))
|
||||||
{
|
{
|
||||||
$return = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'import_match` WHERE `id_import_match` = '.(int)Tools::getValue('idImportMatchs'));
|
$return = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'import_match` WHERE `id_import_match` = '.(int)Tools::getValue('idImportMatchs'));
|
||||||
die('{"id" : "'.$return[0]['id_import_match'].'", "matchs" : "'.$return[0]['match'].'", "skip" : "'.$return[0]['skip'].'"}');
|
die('{"id" : "'.$return[0]['id_import_match'].'", "matchs" : "'.$return[0]['match'].'", "skip" : "'.$return[0]['skip'].'"}');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,7 +595,7 @@ if (Tools::isSubmit('getHookableModuleList'))
|
|||||||
include('../init.php');
|
include('../init.php');
|
||||||
$hook_name = Tools::getValue('hook');
|
$hook_name = Tools::getValue('hook');
|
||||||
$hookableModulesList = array();
|
$hookableModulesList = array();
|
||||||
$modules = Db::getInstance()->ExecuteS('SELECT id_module, name FROM `'._DB_PREFIX_.'module` ');
|
$modules = Db::getInstance()->executeS('SELECT id_module, name FROM `'._DB_PREFIX_.'module` ');
|
||||||
foreach ($modules as $module)
|
foreach ($modules as $module)
|
||||||
{
|
{
|
||||||
if (file_exists(_PS_MODULE_DIR_.$module['name'].'/'.$module['name'].'.php'))
|
if (file_exists(_PS_MODULE_DIR_.$module['name'].'/'.$module['name'].'.php'))
|
||||||
@@ -625,7 +625,7 @@ if (Tools::isSubmit('saveHook'))
|
|||||||
$sql = 'DELETE FROM '._DB_PREFIX_.'hook_module
|
$sql = 'DELETE FROM '._DB_PREFIX_.'hook_module
|
||||||
WHERE id_hook = (SELECT id_hook FROM '._DB_PREFIX_.'hook WHERE `name` = \''.pSQL($hook).'\' LIMIT 1)
|
WHERE id_hook = (SELECT id_hook FROM '._DB_PREFIX_.'hook WHERE `name` = \''.pSQL($hook).'\' LIMIT 1)
|
||||||
AND id_shop = '.$id_shop;
|
AND id_shop = '.$id_shop;
|
||||||
Db::getInstance()->Execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
$hookedModules = explode(',', Tools::getValue($hook));
|
$hookedModules = explode(',', Tools::getValue($hook));
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$value = '';
|
$value = '';
|
||||||
@@ -636,7 +636,7 @@ if (Tools::isSubmit('saveHook'))
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$value = rtrim($value, ',');
|
$value = rtrim($value, ',');
|
||||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'hook_module (id_module, id_shop, id_hook, position) VALUES '.$value);
|
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'hook_module (id_module, id_shop, id_hook, position) VALUES '.$value);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ $sql = 'SELECT p.`id_product`, `reference`, pl.name
|
|||||||
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'.
|
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'.
|
||||||
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
|
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
|
||||||
($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : '');
|
($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : '');
|
||||||
$items = Db::getInstance()->ExecuteS($sql);
|
$items = Db::getInstance()->executeS($sql);
|
||||||
|
|
||||||
if ($items)
|
if ($items)
|
||||||
foreach ($items AS $item)
|
foreach ($items AS $item)
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ function getPath($urlBase, $id_category, $path = '', $highlight = '', $categoryT
|
|||||||
GROUP BY c.id_category
|
GROUP BY c.id_category
|
||||||
ORDER BY c.level_depth ASC
|
ORDER BY c.level_depth ASC
|
||||||
LIMIT '.(!$home ? (int)($category['level_depth'] + 1) : 1);
|
LIMIT '.(!$home ? (int)($category['level_depth'] + 1) : 1);
|
||||||
$categories = Db::getInstance()->ExecuteS($sql);
|
$categories = Db::getInstance()->executeS($sql);
|
||||||
$fullPath = '';
|
$fullPath = '';
|
||||||
$n = 1;
|
$n = 1;
|
||||||
$nCategories = (int)sizeof($categories);
|
$nCategories = (int)sizeof($categories);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ if ($id = Tools::getValue('id_request_sql'))
|
|||||||
|
|
||||||
if ($sql)
|
if ($sql)
|
||||||
{
|
{
|
||||||
$results = Db::getInstance()->ExecuteS($sql[0]['sql']);
|
$results = Db::getInstance()->executeS($sql[0]['sql']);
|
||||||
foreach (array_keys($results[0]) as $key)
|
foreach (array_keys($results[0]) as $key)
|
||||||
{
|
{
|
||||||
$tab_key[] = $key;
|
$tab_key[] = $key;
|
||||||
|
|||||||
@@ -44,15 +44,15 @@ class AdminAccess extends AdminTab
|
|||||||
$res = true;
|
$res = true;
|
||||||
|
|
||||||
if ($id_tab == -1 AND $perm == 'all' AND $enabled == 0)
|
if ($id_tab == -1 AND $perm == 'all' AND $enabled == 0)
|
||||||
$res &= Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'access` SET `view` = '.$enabled.', `add` = '.$enabled.', `edit` = '.$enabled.', `delete` = '.$enabled.' WHERE `id_profile` = '.(int)($id_profile).' AND `id_tab` != 31');
|
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'access` SET `view` = '.$enabled.', `add` = '.$enabled.', `edit` = '.$enabled.', `delete` = '.$enabled.' WHERE `id_profile` = '.(int)($id_profile).' AND `id_tab` != 31');
|
||||||
else if ($id_tab == -1 AND $perm == 'all')
|
else if ($id_tab == -1 AND $perm == 'all')
|
||||||
$res &= Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'access` SET `view` = '.$enabled.', `add` = '.$enabled.', `edit` = '.$enabled.', `delete` = '.$enabled.' WHERE `id_profile` = '.(int)($id_profile));
|
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'access` SET `view` = '.$enabled.', `add` = '.$enabled.', `edit` = '.$enabled.', `delete` = '.$enabled.' WHERE `id_profile` = '.(int)($id_profile));
|
||||||
else if ($id_tab == -1)
|
else if ($id_tab == -1)
|
||||||
$res &= Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'access` SET `'.pSQL($perm).'` = '.$enabled.' WHERE `id_profile` = '.(int)($id_profile));
|
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'access` SET `'.pSQL($perm).'` = '.$enabled.' WHERE `id_profile` = '.(int)($id_profile));
|
||||||
else if ($perm == 'all')
|
else if ($perm == 'all')
|
||||||
$res &= Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'access` SET `view` = '.$enabled.', `add` = '.$enabled.', `edit` = '.$enabled.', `delete` = '.$enabled.' WHERE `id_tab` = '.(int)($id_tab).' AND `id_profile` = '.(int)($id_profile));
|
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'access` SET `view` = '.$enabled.', `add` = '.$enabled.', `edit` = '.$enabled.', `delete` = '.$enabled.' WHERE `id_tab` = '.(int)($id_tab).' AND `id_profile` = '.(int)($id_profile));
|
||||||
else
|
else
|
||||||
$res &= Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'access` SET `'.pSQL($perm).'` = '.$enabled.' WHERE `id_tab` = '.(int)($id_tab).' AND `id_profile` = '.(int)($id_profile));
|
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'access` SET `'.pSQL($perm).'` = '.$enabled.' WHERE `id_tab` = '.(int)($id_tab).' AND `id_profile` = '.(int)($id_profile));
|
||||||
|
|
||||||
$this->return_status = $res?'ok':'error';
|
$this->return_status = $res?'ok':'error';
|
||||||
if ($res)
|
if ($res)
|
||||||
@@ -73,9 +73,9 @@ class AdminAccess extends AdminTab
|
|||||||
throw new PrestashopException('permission not exists');
|
throw new PrestashopException('permission not exists');
|
||||||
|
|
||||||
if ($id_module == -1)
|
if ($id_module == -1)
|
||||||
$res &= Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'module_access` SET `'.pSQL($perm).'` = '.(int)$enabled.' WHERE `id_profile` = '.(int)$id_profile);
|
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'module_access` SET `'.pSQL($perm).'` = '.(int)$enabled.' WHERE `id_profile` = '.(int)$id_profile);
|
||||||
else
|
else
|
||||||
$res &= Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'module_access` SET `'.pSQL($perm).'` = '.(int)$enabled.' WHERE `id_module` = '.(int)$id_module.' AND `id_profile` = '.(int)$id_profile);
|
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'module_access` SET `'.pSQL($perm).'` = '.(int)$enabled.' WHERE `id_module` = '.(int)$id_module.' AND `id_profile` = '.(int)$id_profile);
|
||||||
|
|
||||||
$this->return_status = $res?'ok':'error';
|
$this->return_status = $res?'ok':'error';
|
||||||
if ($res)
|
if ($res)
|
||||||
@@ -324,7 +324,7 @@ class AdminAccess extends AdminTab
|
|||||||
<th class="center"><input type="checkbox" id="ajax-ma-configure-master" '.($this->tabAccess['edit'] == 1 ? 'class="changeModuleAccess" rel="-1||configure"' : 'disabled="disabled"').' /> '.$this->l('Configure').'</th>
|
<th class="center"><input type="checkbox" id="ajax-ma-configure-master" '.($this->tabAccess['edit'] == 1 ? 'class="changeModuleAccess" rel="-1||configure"' : 'disabled="disabled"').' /> '.$this->l('Configure').'</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
|
|
||||||
$modules = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$modules = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT ma.id_module, m.name, ma.`view`, ma.`configure`
|
SELECT ma.id_module, m.name, ma.`view`, ma.`configure`
|
||||||
FROM '._DB_PREFIX_.'module_access ma
|
FROM '._DB_PREFIX_.'module_access ma
|
||||||
LEFT JOIN '._DB_PREFIX_.'module m ON ma.id_module = m.id_module
|
LEFT JOIN '._DB_PREFIX_.'module m ON ma.id_module = m.id_module
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ class AdminAttributeGenerator extends AdminTab
|
|||||||
foreach ($tab AS $group)
|
foreach ($tab AS $group)
|
||||||
foreach ($group AS $attribute)
|
foreach ($group AS $attribute)
|
||||||
$attributes[] = '('.(int)($id_product).', '.(int)($attribute).', '.(float)($_POST['price_impact_'.(int)($attribute)]).', '.(float)($_POST['weight_impact'][(int)($attribute)]).')';
|
$attributes[] = '('.(int)($id_product).', '.(int)($attribute).', '.(float)($_POST['price_impact_'.(int)($attribute)]).', '.(float)($_POST['weight_impact'][(int)($attribute)]).')';
|
||||||
return Db::getInstance()->Execute(
|
return Db::getInstance()->execute(
|
||||||
'INSERT INTO `'._DB_PREFIX_.'attribute_impact` (`id_product`, `id_attribute`, `price`, `weight`)
|
'INSERT INTO `'._DB_PREFIX_.'attribute_impact` (`id_product`, `id_attribute`, `price`, `weight`)
|
||||||
VALUES '.implode(',', $attributes).'
|
VALUES '.implode(',', $attributes).'
|
||||||
ON DUPLICATE KEY UPDATE `price`=VALUES(price), `weight`=VALUES(weight)'
|
ON DUPLICATE KEY UPDATE `price`=VALUES(price), `weight`=VALUES(weight)'
|
||||||
@@ -158,7 +158,7 @@ class AdminAttributeGenerator extends AdminTab
|
|||||||
private static function getAttributesImpacts($id_product)
|
private static function getAttributesImpacts($id_product)
|
||||||
{
|
{
|
||||||
$tab = array();
|
$tab = array();
|
||||||
$result = Db::getInstance()->ExecuteS(
|
$result = Db::getInstance()->executeS(
|
||||||
'SELECT ai.`id_attribute`, ai.`price`, ai.`weight`
|
'SELECT ai.`id_attribute`, ai.`price`, ai.`weight`
|
||||||
FROM `'._DB_PREFIX_.'attribute_impact` ai
|
FROM `'._DB_PREFIX_.'attribute_impact` ai
|
||||||
WHERE ai.`id_product` = '.(int)($id_product));
|
WHERE ai.`id_product` = '.(int)($id_product));
|
||||||
|
|||||||
@@ -275,11 +275,11 @@ class AdminCarriers extends AdminTab
|
|||||||
private function changeGroups($id_carrier, $delete = true)
|
private function changeGroups($id_carrier, $delete = true)
|
||||||
{
|
{
|
||||||
if ($delete)
|
if ($delete)
|
||||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier = '.(int)$id_carrier);
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier = '.(int)$id_carrier);
|
||||||
$groups = Db::getInstance()->ExecuteS('SELECT id_group FROM `'._DB_PREFIX_.'group`');
|
$groups = Db::getInstance()->executeS('SELECT id_group FROM `'._DB_PREFIX_.'group`');
|
||||||
foreach ($groups as $group)
|
foreach ($groups as $group)
|
||||||
if (Tools::getIsset('groupBox') && in_array($group['id_group'], Tools::getValue('groupBox')))
|
if (Tools::getIsset('groupBox') && in_array($group['id_group'], Tools::getValue('groupBox')))
|
||||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'carrier_group (id_group, id_carrier) VALUES('.(int)$group['id_group'].','.(int)$id_carrier.')');
|
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'carrier_group (id_group, id_carrier) VALUES('.(int)$group['id_group'].','.(int)$id_carrier.')');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postProcess()
|
public function postProcess()
|
||||||
@@ -300,7 +300,7 @@ class AdminCarriers extends AdminTab
|
|||||||
$object = new $this->className($id);
|
$object = new $this->className($id);
|
||||||
if (Validate::isLoadedObject($object))
|
if (Validate::isLoadedObject($object))
|
||||||
{
|
{
|
||||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier = '.(int)$id);
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier = '.(int)$id);
|
||||||
$object->deleted = 1;
|
$object->deleted = 1;
|
||||||
$object->update();
|
$object->update();
|
||||||
$objectNew = new $this->className();
|
$objectNew = new $this->className();
|
||||||
|
|||||||
@@ -111,16 +111,16 @@ class AdminCustomerThreads extends AdminTab
|
|||||||
if ($id_customer_thread = (int)Tools::getValue('id_customer_thread'))
|
if ($id_customer_thread = (int)Tools::getValue('id_customer_thread'))
|
||||||
{
|
{
|
||||||
if (($id_contact = (int)Tools::getValue('id_contact')))
|
if (($id_contact = (int)Tools::getValue('id_contact')))
|
||||||
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer_thread SET id_contact = '.(int)$id_contact.' WHERE id_customer_thread = '.(int)$id_customer_thread);
|
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'customer_thread SET id_contact = '.(int)$id_contact.' WHERE id_customer_thread = '.(int)$id_customer_thread);
|
||||||
if ($id_status = (int)Tools::getValue('setstatus'))
|
if ($id_status = (int)Tools::getValue('setstatus'))
|
||||||
{
|
{
|
||||||
$statusArray = array(1 => 'open', 2 => 'closed', 3 => 'pending1', 4 => 'pending2');
|
$statusArray = array(1 => 'open', 2 => 'closed', 3 => 'pending1', 4 => 'pending2');
|
||||||
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer_thread SET status = "'.$statusArray[$id_status].'" WHERE id_customer_thread = '.(int)$id_customer_thread.' LIMIT 1');
|
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'customer_thread SET status = "'.$statusArray[$id_status].'" WHERE id_customer_thread = '.(int)$id_customer_thread.' LIMIT 1');
|
||||||
}
|
}
|
||||||
if (isset($_POST['id_employee_forward']))
|
if (isset($_POST['id_employee_forward']))
|
||||||
{
|
{
|
||||||
// Todo: need to avoid doubles
|
// Todo: need to avoid doubles
|
||||||
$messages = Db::getInstance()->ExecuteS('
|
$messages = Db::getInstance()->executeS('
|
||||||
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
|
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
|
||||||
FROM '._DB_PREFIX_.'customer_thread ct
|
FROM '._DB_PREFIX_.'customer_thread ct
|
||||||
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON (ct.id_customer_thread = cm.id_customer_thread)
|
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON (ct.id_customer_thread = cm.id_customer_thread)
|
||||||
@@ -233,7 +233,7 @@ class AdminCustomerThreads extends AdminTab
|
|||||||
|
|
||||||
public function displayListHeader($token = NULL)
|
public function displayListHeader($token = NULL)
|
||||||
{
|
{
|
||||||
$contacts = Db::getInstance()->ExecuteS('
|
$contacts = Db::getInstance()->executeS('
|
||||||
SELECT cl.*, COUNT(*) as total, (
|
SELECT cl.*, COUNT(*) as total, (
|
||||||
SELECT id_customer_thread
|
SELECT id_customer_thread
|
||||||
FROM '._DB_PREFIX_.'customer_thread ct2
|
FROM '._DB_PREFIX_.'customer_thread ct2
|
||||||
@@ -245,7 +245,7 @@ class AdminCustomerThreads extends AdminTab
|
|||||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$this->context->language->id.')
|
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$this->context->language->id.')
|
||||||
WHERE ct.status = "open"
|
WHERE ct.status = "open"
|
||||||
GROUP BY ct.id_contact HAVING COUNT(*) > 0');
|
GROUP BY ct.id_contact HAVING COUNT(*) > 0');
|
||||||
$categories = Db::getInstance()->ExecuteS('
|
$categories = Db::getInstance()->executeS('
|
||||||
SELECT cl.*
|
SELECT cl.*
|
||||||
FROM '._DB_PREFIX_.'contact ct
|
FROM '._DB_PREFIX_.'contact ct
|
||||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$this->context->language->id.')
|
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$this->context->language->id.')
|
||||||
@@ -430,7 +430,7 @@ class AdminCustomerThreads extends AdminTab
|
|||||||
return;
|
return;
|
||||||
$this->context->cookie->{'customer_threadFilter_cl!id_contact'} = $thread->id_contact;
|
$this->context->cookie->{'customer_threadFilter_cl!id_contact'} = $thread->id_contact;
|
||||||
|
|
||||||
$employees = Db::getInstance()->ExecuteS('
|
$employees = Db::getInstance()->executeS('
|
||||||
SELECT e.id_employee, e.firstname, e.lastname FROM '._DB_PREFIX_.'employee e
|
SELECT e.id_employee, e.firstname, e.lastname FROM '._DB_PREFIX_.'employee e
|
||||||
WHERE e.active = 1 ORDER BY e.lastname ASC');
|
WHERE e.active = 1 ORDER BY e.lastname ASC');
|
||||||
|
|
||||||
@@ -465,7 +465,7 @@ class AdminCustomerThreads extends AdminTab
|
|||||||
</form>
|
</form>
|
||||||
<div class="clear"> </div>';
|
<div class="clear"> </div>';
|
||||||
|
|
||||||
$messages = Db::getInstance()->ExecuteS('
|
$messages = Db::getInstance()->executeS('
|
||||||
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
|
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
|
||||||
FROM '._DB_PREFIX_.'customer_thread ct
|
FROM '._DB_PREFIX_.'customer_thread ct
|
||||||
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON (ct.id_customer_thread = cm.id_customer_thread)
|
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON (ct.id_customer_thread = cm.id_customer_thread)
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ class AdminCustomers extends AdminTab
|
|||||||
$customer = new Customer($id_customer);
|
$customer = new Customer($id_customer);
|
||||||
if (!Validate::isLoadedObject($customer))
|
if (!Validate::isLoadedObject($customer))
|
||||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||||
$update = Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customer` SET newsletter = '.($customer->newsletter ? 0 : 1).' WHERE `id_customer` = '.(int)($customer->id));
|
$update = Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'customer` SET newsletter = '.($customer->newsletter ? 0 : 1).' WHERE `id_customer` = '.(int)($customer->id));
|
||||||
if (!$update)
|
if (!$update)
|
||||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
||||||
@@ -273,7 +273,7 @@ class AdminCustomers extends AdminTab
|
|||||||
$customer = new Customer($id_customer);
|
$customer = new Customer($id_customer);
|
||||||
if (!Validate::isLoadedObject($customer))
|
if (!Validate::isLoadedObject($customer))
|
||||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||||
$update = Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customer` SET optin = '.($customer->optin ? 0 : 1).' WHERE `id_customer` = '.(int)($customer->id));
|
$update = Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'customer` SET optin = '.($customer->optin ? 0 : 1).' WHERE `id_customer` = '.(int)($customer->id));
|
||||||
if (!$update)
|
if (!$update)
|
||||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
||||||
@@ -638,7 +638,7 @@ class AdminCustomers extends AdminTab
|
|||||||
JOIN '._DB_PREFIX_.'order_detail od ON (o.id_order = od.id_order)
|
JOIN '._DB_PREFIX_.'order_detail od ON (o.id_order = od.id_order)
|
||||||
WHERE o.valid = 1 AND o.id_customer = '.(int)$customer->id.'
|
WHERE o.valid = 1 AND o.id_customer = '.(int)$customer->id.'
|
||||||
)';
|
)';
|
||||||
$interested = Db::getInstance()->ExecuteS($sql);
|
$interested = Db::getInstance()->executeS($sql);
|
||||||
if (count($interested))
|
if (count($interested))
|
||||||
{
|
{
|
||||||
echo '<div style="float:left;margin-left:20px">
|
echo '<div style="float:left;margin-left:20px">
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class AdminDb extends AdminPreferences
|
|||||||
if ($engineType == $tables_engine[$table])
|
if ($engineType == $tables_engine[$table])
|
||||||
$this->_errors[] = $table.' '.$this->l('is already in').' '.$engineType;
|
$this->_errors[] = $table.' '.$this->l('is already in').' '.$engineType;
|
||||||
else
|
else
|
||||||
if (!Db::getInstance()->Execute('ALTER TABLE `'.bqSQL($table).'` ENGINE=`'.bqSQL($engineType).'`'))
|
if (!Db::getInstance()->execute('ALTER TABLE `'.bqSQL($table).'` ENGINE=`'.bqSQL($engineType).'`'))
|
||||||
$this->_errors[] = $this->l('Can\'t change engine for').' '.$table;
|
$this->_errors[] = $this->l('Can\'t change engine for').' '.$table;
|
||||||
else
|
else
|
||||||
echo '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" />'.$this->l('Engine change of').' '.$table.' '.$this->l('to').' '.$engineType.'</div>';
|
echo '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" />'.$this->l('Engine change of').' '.$table.' '.$this->l('to').' '.$engineType.'</div>';
|
||||||
@@ -155,7 +155,7 @@ class AdminDb extends AdminPreferences
|
|||||||
|
|
||||||
private function _getEngines()
|
private function _getEngines()
|
||||||
{
|
{
|
||||||
$engines = Db::getInstance()->ExecuteS('SHOW ENGINES');
|
$engines = Db::getInstance()->executeS('SHOW ENGINES');
|
||||||
$allowed_engines = array();
|
$allowed_engines = array();
|
||||||
foreach ($engines AS $engine)
|
foreach ($engines AS $engine)
|
||||||
{
|
{
|
||||||
@@ -167,7 +167,7 @@ class AdminDb extends AdminPreferences
|
|||||||
|
|
||||||
private function _getTablesStatus()
|
private function _getTablesStatus()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('SHOW TABLE STATUS');
|
return Db::getInstance()->executeS('SHOW TABLE STATUS');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ class AdminImages extends AdminTab
|
|||||||
// Hook watermark optimization
|
// Hook watermark optimization
|
||||||
private function _regenerateWatermark($dir)
|
private function _regenerateWatermark($dir)
|
||||||
{
|
{
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT m.`name` FROM `'._DB_PREFIX_.'module` m
|
SELECT m.`name` FROM `'._DB_PREFIX_.'module` m
|
||||||
LEFT JOIN `'._DB_PREFIX_.'hook_module` hm ON hm.`id_module` = m.`id_module`
|
LEFT JOIN `'._DB_PREFIX_.'hook_module` hm ON hm.`id_module` = m.`id_module`
|
||||||
LEFT JOIN `'._DB_PREFIX_.'hook` h ON hm.`id_hook` = h.`id_hook`
|
LEFT JOIN `'._DB_PREFIX_.'hook` h ON hm.`id_hook` = h.`id_hook`
|
||||||
|
|||||||
@@ -1038,7 +1038,7 @@ class AdminImport extends AdminTab
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'product_attribute_combination (id_attribute, id_product_attribute) VALUES ('.(int)($attributes[$group.'_'.$attribute]).','.(int)$id_product_attribute.')');
|
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'product_attribute_combination (id_attribute, id_product_attribute) VALUES ('.(int)($attributes[$group.'_'.$attribute]).','.(int)$id_product_attribute.')');
|
||||||
}
|
}
|
||||||
$this->closeCsvFile($handle);
|
$this->closeCsvFile($handle);
|
||||||
|
|
||||||
@@ -1615,7 +1615,7 @@ class AdminImport extends AdminTab
|
|||||||
|
|
||||||
public function displayCSV()
|
public function displayCSV()
|
||||||
{
|
{
|
||||||
$importMatchs = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'import_match');
|
$importMatchs = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'import_match');
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<script src="'._PS_JS_DIR_.'adminImport.js"></script>
|
<script src="'._PS_JS_DIR_.'adminImport.js"></script>
|
||||||
@@ -1714,51 +1714,51 @@ class AdminImport extends AdminTab
|
|||||||
switch ((int)($case))
|
switch ((int)($case))
|
||||||
{
|
{
|
||||||
case $this->entities[$this->l('Categories')]:
|
case $this->entities[$this->l('Categories')]:
|
||||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category` WHERE id_category != 1');
|
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category` WHERE id_category != 1');
|
||||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category_lang` WHERE id_category != 1');
|
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_lang` WHERE id_category != 1');
|
||||||
Db::getInstance()->Execute('ALTER TABLE `'._DB_PREFIX_.'category` AUTO_INCREMENT = 2');
|
Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'category` AUTO_INCREMENT = 2');
|
||||||
foreach (scandir(_PS_CAT_IMG_DIR_) AS $d)
|
foreach (scandir(_PS_CAT_IMG_DIR_) AS $d)
|
||||||
if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d))
|
if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d))
|
||||||
unlink(_PS_CAT_IMG_DIR_.$d);
|
unlink(_PS_CAT_IMG_DIR_.$d);
|
||||||
break;
|
break;
|
||||||
case $this->entities[$this->l('Products')]:
|
case $this->entities[$this->l('Products')]:
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'feature_product');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'feature_product');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_lang');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_lang');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'category_product');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'category_product');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_tag');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_tag');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'image');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'image');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'image_lang');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'image_lang');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price_priority');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price_priority');
|
||||||
Image::deleteAllImages(_PS_PROD_IMG_DIR_);
|
Image::deleteAllImages(_PS_PROD_IMG_DIR_);
|
||||||
break;
|
break;
|
||||||
case $this->entities[$this->l('Customers')]:
|
case $this->entities[$this->l('Customers')]:
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer');
|
||||||
break;
|
break;
|
||||||
case $this->entities[$this->l('Addresses')]:
|
case $this->entities[$this->l('Addresses')]:
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'address');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'address');
|
||||||
break;
|
break;
|
||||||
case $this->entities[$this->l('Combinations')]:
|
case $this->entities[$this->l('Combinations')]:
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_impact');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_impact');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute`');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute`');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_combination`');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_combination`');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_image`');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_image`');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_group`');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_group`');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_group_lang`');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_group_lang`');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute`');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute`');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_lang`');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_lang`');
|
||||||
break;
|
break;
|
||||||
case $this->entities[$this->l('Manufacturers')]:
|
case $this->entities[$this->l('Manufacturers')]:
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer_lang');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer_lang');
|
||||||
foreach (scandir(_PS_MANU_IMG_DIR_) AS $d)
|
foreach (scandir(_PS_MANU_IMG_DIR_) AS $d)
|
||||||
if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d))
|
if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d))
|
||||||
unlink(_PS_MANU_IMG_DIR_.$d);
|
unlink(_PS_MANU_IMG_DIR_.$d);
|
||||||
break;
|
break;
|
||||||
case $this->entities[$this->l('Suppliers')]:
|
case $this->entities[$this->l('Suppliers')]:
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'supplier');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'supplier');
|
||||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'supplier_lang');
|
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'supplier_lang');
|
||||||
foreach (scandir(_PS_SUPP_IMG_DIR_) AS $d)
|
foreach (scandir(_PS_SUPP_IMG_DIR_) AS $d)
|
||||||
if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d))
|
if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d))
|
||||||
unlink(_PS_SUPP_IMG_DIR_.$d);
|
unlink(_PS_SUPP_IMG_DIR_.$d);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class AdminInvoices extends AdminTab
|
|||||||
public function displayForm($isMainTab = true)
|
public function displayForm($isMainTab = true)
|
||||||
{
|
{
|
||||||
$statuses = OrderState::getOrderStates($this->context->language->id);
|
$statuses = OrderState::getOrderStates($this->context->language->id);
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT COUNT(*) as nbOrders, (
|
SELECT COUNT(*) as nbOrders, (
|
||||||
SELECT oh.id_order_state
|
SELECT oh.id_order_state
|
||||||
FROM '._DB_PREFIX_.'order_history oh
|
FROM '._DB_PREFIX_.'order_history oh
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class AdminMessages extends AdminTab
|
|||||||
is_numeric($_POST['submitFilter'.$this->table]))
|
is_numeric($_POST['submitFilter'.$this->table]))
|
||||||
$start = (int)($_POST['submitFilter'.$this->table] - 1) * $limit;
|
$start = (int)($_POST['submitFilter'.$this->table] - 1) * $limit;
|
||||||
|
|
||||||
$this->_list = Db::getInstance()->ExecuteS('
|
$this->_list = Db::getInstance()->executeS('
|
||||||
SELECT SQL_CALC_FOUND_ROWS m.id_message, m.id_cart, m.id_employee, IF(m.id_order > 0, m.id_order, \'--\') id_order, m.message, m.private, m.date_add, CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS customer,
|
SELECT SQL_CALC_FOUND_ROWS m.id_message, m.id_cart, m.id_employee, IF(m.id_order > 0, m.id_order, \'--\') id_order, m.message, m.private, m.date_add, CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS customer,
|
||||||
c.id_customer, count(m.id_message) nb_messages, (SELECT message FROM '._DB_PREFIX_.'message WHERE id_order = m.id_order ORDER BY date_add DESC LIMIT 1) last_message,
|
c.id_customer, count(m.id_message) nb_messages, (SELECT message FROM '._DB_PREFIX_.'message WHERE id_order = m.id_order ORDER BY date_add DESC LIMIT 1) last_message,
|
||||||
(SELECT COUNT(m2.id_message) FROM '._DB_PREFIX_.'message m2 WHERE 1 AND m2.id_customer != 0 AND m2.id_order = m.id_order AND m2.id_message NOT IN
|
(SELECT COUNT(m2.id_message) FROM '._DB_PREFIX_.'message m2 WHERE 1 AND m2.id_customer != 0 AND m2.id_order = m.id_order AND m2.id_message NOT IN
|
||||||
|
|||||||
@@ -43,19 +43,19 @@ class AdminPayment extends AdminTab
|
|||||||
{
|
{
|
||||||
if(!get_class($module) == 'SimpleXMLElement')
|
if(!get_class($module) == 'SimpleXMLElement')
|
||||||
$module->country = array();
|
$module->country = array();
|
||||||
$countries = DB::getInstance()->ExecuteS('SELECT id_country FROM '._DB_PREFIX_.'module_country WHERE id_module = '.(int)$module->id.' AND `id_shop`='.$shopID);
|
$countries = DB::getInstance()->executeS('SELECT id_country FROM '._DB_PREFIX_.'module_country WHERE id_module = '.(int)$module->id.' AND `id_shop`='.$shopID);
|
||||||
foreach ($countries as $country)
|
foreach ($countries as $country)
|
||||||
$module->country[] = $country['id_country'];
|
$module->country[] = $country['id_country'];
|
||||||
|
|
||||||
if(!get_class($module) == 'SimpleXMLElement')
|
if(!get_class($module) == 'SimpleXMLElement')
|
||||||
$module->currency = array();
|
$module->currency = array();
|
||||||
$currencies = DB::getInstance()->ExecuteS('SELECT id_currency FROM '._DB_PREFIX_.'module_currency WHERE id_module = '.(int)$module->id.' AND `id_shop`='.$shopID);
|
$currencies = DB::getInstance()->executeS('SELECT id_currency FROM '._DB_PREFIX_.'module_currency WHERE id_module = '.(int)$module->id.' AND `id_shop`='.$shopID);
|
||||||
foreach ($currencies as $currency)
|
foreach ($currencies as $currency)
|
||||||
$module->currency[] = $currency['id_currency'];
|
$module->currency[] = $currency['id_currency'];
|
||||||
|
|
||||||
if(!get_class($module) == 'SimpleXMLElement')
|
if(!get_class($module) == 'SimpleXMLElement')
|
||||||
$module->group = array();
|
$module->group = array();
|
||||||
$groups = DB::getInstance()->ExecuteS('SELECT id_group FROM '._DB_PREFIX_.'module_group WHERE id_module = '.(int)$module->id.' AND `id_shop`='.$shopID);
|
$groups = DB::getInstance()->executeS('SELECT id_group FROM '._DB_PREFIX_.'module_group WHERE id_module = '.(int)$module->id.' AND `id_shop`='.$shopID);
|
||||||
foreach ($groups as $group)
|
foreach ($groups as $group)
|
||||||
$module->group[] = $group['id_group'];
|
$module->group[] = $group['id_group'];
|
||||||
}
|
}
|
||||||
@@ -84,13 +84,13 @@ class AdminPayment extends AdminTab
|
|||||||
|
|
||||||
private function saveRestrictions($type)
|
private function saveRestrictions($type)
|
||||||
{
|
{
|
||||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'module_'.$type.' WHERE id_shop = '.Context::getContext()->shop->getID(true));
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'module_'.$type.' WHERE id_shop = '.Context::getContext()->shop->getID(true));
|
||||||
foreach ($this->paymentModules as $module)
|
foreach ($this->paymentModules as $module)
|
||||||
if ($module->active AND isset($_POST[$module->name.'_'.$type.'']))
|
if ($module->active AND isset($_POST[$module->name.'_'.$type.'']))
|
||||||
foreach ($_POST[$module->name.'_'.$type.''] as $selected)
|
foreach ($_POST[$module->name.'_'.$type.''] as $selected)
|
||||||
$values[] = '('.(int)$module->id.', '.Context::getContext()->shop->getID(true).', '.(int)$selected.')';
|
$values[] = '('.(int)$module->id.', '.Context::getContext()->shop->getID(true).', '.(int)$selected.')';
|
||||||
if (sizeof($values))
|
if (sizeof($values))
|
||||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'module_'.$type.' (`id_module`, `id_shop`, `id_'.$type.'`) VALUES '.implode(',', $values));
|
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'module_'.$type.' (`id_module`, `id_shop`, `id_'.$type.'`) VALUES '.implode(',', $values));
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4'.'&token='.$this->token);
|
Tools::redirectAdmin(self::$currentIndex.'&conf=4'.'&token='.$this->token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class AdminPreferences extends AdminTab
|
|||||||
// Prevent classes which extend AdminPreferences to load useless data
|
// Prevent classes which extend AdminPreferences to load useless data
|
||||||
if (get_class($this) == 'AdminPreferences')
|
if (get_class($this) == 'AdminPreferences')
|
||||||
{
|
{
|
||||||
$timezones = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT name FROM '._DB_PREFIX_.'timezone');
|
$timezones = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT name FROM '._DB_PREFIX_.'timezone');
|
||||||
$taxes[] = array('id' => 0, 'name' => $this->l('None'));
|
$taxes[] = array('id' => 0, 'name' => $this->l('None'));
|
||||||
foreach (Tax::getTaxes($this->context->language->id) as $tax)
|
foreach (Tax::getTaxes($this->context->language->id) as $tax)
|
||||||
$taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']);
|
$taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']);
|
||||||
|
|||||||
@@ -903,9 +903,9 @@ class AdminProducts extends AdminTab
|
|||||||
{
|
{
|
||||||
if ($id_image = (int)Tools::getValue('id_image') && $id_shop = (int)Tools::getValue('id_shop'))
|
if ($id_image = (int)Tools::getValue('id_image') && $id_shop = (int)Tools::getValue('id_shop'))
|
||||||
if (Tools::getValue('active') == "true")
|
if (Tools::getValue('active') == "true")
|
||||||
die(Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'image_shop (`id_image`, `id_shop`) VALUES('.(int)$id_image.', '.(int)$id_shop.')'));
|
die(Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'image_shop (`id_image`, `id_shop`) VALUES('.(int)$id_image.', '.(int)$id_shop.')'));
|
||||||
else
|
else
|
||||||
die(Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'image_shop WHERE `id_image`='.(int)$id_image.' && `id_shop`='.(int)$id_shop));
|
die(Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'image_shop WHERE `id_image`='.(int)$id_image.' && `id_shop`='.(int)$id_shop));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tools::getValue('deleteImage'))
|
if (Tools::getValue('deleteImage'))
|
||||||
@@ -917,7 +917,7 @@ class AdminProducts extends AdminTab
|
|||||||
$first_img = Db::getInstance()->getRow('
|
$first_img = Db::getInstance()->getRow('
|
||||||
SELECT `id_image` FROM `'._DB_PREFIX_.'image`
|
SELECT `id_image` FROM `'._DB_PREFIX_.'image`
|
||||||
WHERE `id_product` = '.(int)($image->id_product));
|
WHERE `id_product` = '.(int)($image->id_product));
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'image`
|
UPDATE `'._DB_PREFIX_.'image`
|
||||||
SET `cover` = 1
|
SET `cover` = 1
|
||||||
WHERE `id_image` = '.(int)($first_img['id_image']));
|
WHERE `id_image` = '.(int)($first_img['id_image']));
|
||||||
@@ -1454,7 +1454,7 @@ class AdminProducts extends AdminTab
|
|||||||
{
|
{
|
||||||
$tagError = true;
|
$tagError = true;
|
||||||
/* Reset all tags for THIS product */
|
/* Reset all tags for THIS product */
|
||||||
if (!Db::getInstance()->Execute('
|
if (!Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'product_tag`
|
DELETE FROM `'._DB_PREFIX_.'product_tag`
|
||||||
WHERE `id_product` = '.(int)($product->id)))
|
WHERE `id_product` = '.(int)($product->id)))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ if (Tools::getValue('token') == Tools::getAdminToken('AdminReferrers'.(int)(Tab:
|
|||||||
else if (Tools::isSubmit('ajaxFillProducts'))
|
else if (Tools::isSubmit('ajaxFillProducts'))
|
||||||
{
|
{
|
||||||
$jsonArray = array();
|
$jsonArray = array();
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT p.id_product, pl.name
|
SELECT p.id_product, pl.name
|
||||||
FROM '._DB_PREFIX_.'product p
|
FROM '._DB_PREFIX_.'product p
|
||||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)(Tools::getValue('id_lang')).')
|
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)(Tools::getValue('id_lang')).')
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class AdminRequestSql extends AdminTab
|
|||||||
if (!($obj = $this->loadObject(true)))
|
if (!($obj = $this->loadObject(true)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT `id_request_sql`
|
SELECT `id_request_sql`
|
||||||
FROM `'._DB_PREFIX_.'request_sql`
|
FROM `'._DB_PREFIX_.'request_sql`
|
||||||
');
|
');
|
||||||
@@ -215,7 +215,7 @@ class AdminRequestSql extends AdminTab
|
|||||||
return;
|
return;
|
||||||
echo '<h2>'.$obj->name.'</h2>';
|
echo '<h2>'.$obj->name.'</h2>';
|
||||||
|
|
||||||
if ($results = Db::getInstance()->ExecuteS($obj->sql))
|
if ($results = Db::getInstance()->executeS($obj->sql))
|
||||||
{
|
{
|
||||||
$tab_key = array();
|
$tab_key = array();
|
||||||
foreach (array_keys($results[0]) as $key)
|
foreach (array_keys($results[0]) as $key)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class AdminSearch extends AdminTab
|
|||||||
if (!ip2long(trim($query)))
|
if (!ip2long(trim($query)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$this->_list['customers'] = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$this->_list['customers'] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT DISTINCT c.*
|
SELECT DISTINCT c.*
|
||||||
FROM `'._DB_PREFIX_.'customer` c
|
FROM `'._DB_PREFIX_.'customer` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'guest` g ON g.id_customer = c.id_customer
|
LEFT JOIN `'._DB_PREFIX_.'guest` g ON g.id_customer = c.id_customer
|
||||||
@@ -84,7 +84,7 @@ class AdminSearch extends AdminTab
|
|||||||
{
|
{
|
||||||
global $_LANGADM;
|
global $_LANGADM;
|
||||||
$tabs = array();
|
$tabs = array();
|
||||||
$result = Db::getInstance()->ExecuteS('SELECT class_name, name FROM '._DB_PREFIX_.'tab t INNER JOIN '._DB_PREFIX_.'tab_lang tl ON t.id_tab = tl.id_tab AND tl.id_lang = '.(int)$this->context->language->id);
|
$result = Db::getInstance()->executeS('SELECT class_name, name FROM '._DB_PREFIX_.'tab t INNER JOIN '._DB_PREFIX_.'tab_lang tl ON t.id_tab = tl.id_tab AND tl.id_lang = '.(int)$this->context->language->id);
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
$tabs[$row['class_name']] = $row['name'];
|
$tabs[$row['class_name']] = $row['name'];
|
||||||
foreach (AdminTab::$tabParenting as $key => $value)
|
foreach (AdminTab::$tabParenting as $key => $value)
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ abstract class AdminStatsTab extends AdminPreferences
|
|||||||
AND m.`active` = 1
|
AND m.`active` = 1
|
||||||
GROUP BY hm.id_module
|
GROUP BY hm.id_module
|
||||||
ORDER BY hm.`position`';
|
ORDER BY hm.`position`';
|
||||||
return Db::getInstance()->ExecuteS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayMenu()
|
public function displayMenu()
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class AdminSubDomains extends AdminTab
|
|||||||
|
|
||||||
public function postProcess()
|
public function postProcess()
|
||||||
{
|
{
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT `id_subdomain`
|
SELECT `id_subdomain`
|
||||||
FROM `'._DB_PREFIX_.'subdomain`
|
FROM `'._DB_PREFIX_.'subdomain`
|
||||||
');
|
');
|
||||||
|
|||||||
Vendored
+92
-90
@@ -1,10 +1,10 @@
|
|||||||
<?php return array (
|
<?php return array (
|
||||||
'AbstractLoggerCore' => 'classes/AbstractLogger.php',
|
'AbstractLoggerCore' => 'classes/AbstractLogger.php',
|
||||||
'AbstractLogger' => 'override/classes/AbstractLogger.php',
|
'AbstractLogger' => 'override/classes/AbstractLogger.php',
|
||||||
'AddressFormatCore' => 'classes/AddressFormat.php',
|
|
||||||
'AddressFormat' => 'override/classes/AddressFormat.php',
|
|
||||||
'AddressCore' => 'classes/Address.php',
|
'AddressCore' => 'classes/Address.php',
|
||||||
'Address' => 'override/classes/Address.php',
|
'Address' => 'override/classes/Address.php',
|
||||||
|
'AddressFormatCore' => 'classes/AddressFormat.php',
|
||||||
|
'AddressFormat' => 'override/classes/AddressFormat.php',
|
||||||
'AdminControllerCore' => 'classes/AdminController.php',
|
'AdminControllerCore' => 'classes/AdminController.php',
|
||||||
'AdminController' => 'override/classes/AdminController.php',
|
'AdminController' => 'override/classes/AdminController.php',
|
||||||
'AdminTabCore' => 'classes/AdminTab.php',
|
'AdminTabCore' => 'classes/AdminTab.php',
|
||||||
@@ -13,35 +13,29 @@
|
|||||||
'Alias' => 'override/classes/Alias.php',
|
'Alias' => 'override/classes/Alias.php',
|
||||||
'AttachmentCore' => 'classes/Attachment.php',
|
'AttachmentCore' => 'classes/Attachment.php',
|
||||||
'Attachment' => 'override/classes/Attachment.php',
|
'Attachment' => 'override/classes/Attachment.php',
|
||||||
'AttributeGroupCore' => 'classes/AttributeGroup.php',
|
|
||||||
'AttributeGroup' => 'override/classes/AttributeGroup.php',
|
|
||||||
'AttributeCore' => 'classes/Attribute.php',
|
'AttributeCore' => 'classes/Attribute.php',
|
||||||
'Attribute' => 'override/classes/Attribute.php',
|
'Attribute' => 'override/classes/Attribute.php',
|
||||||
|
'AttributeGroupCore' => 'classes/AttributeGroup.php',
|
||||||
|
'AttributeGroup' => 'override/classes/AttributeGroup.php',
|
||||||
'Autoload' => 'classes/Autoload.php',
|
'Autoload' => 'classes/Autoload.php',
|
||||||
'BackupCore' => 'classes/Backup.php',
|
'BackupCore' => 'classes/Backup.php',
|
||||||
'Backup' => 'override/classes/Backup.php',
|
'Backup' => 'override/classes/Backup.php',
|
||||||
'BlowfishCore' => 'classes/Blowfish.php',
|
'BlowfishCore' => 'classes/Blowfish.php',
|
||||||
'Blowfish' => 'override/classes/Blowfish.php',
|
'Blowfish' => 'override/classes/Blowfish.php',
|
||||||
'CacheFsCore' => 'classes/cache/CacheFs.php',
|
'CMSCore' => 'classes/CMS.php',
|
||||||
'CacheFs' => 'override/classes/cache/CacheFs.php',
|
'CMS' => 'override/classes/CMS.php',
|
||||||
'CacheMemcacheCore' => 'classes/cache/CacheMemcache.php',
|
'CMSCategoryCore' => 'classes/CMSCategory.php',
|
||||||
'CacheMemcache' => 'override/classes/cache/CacheMemcache.php',
|
'CMSCategory' => 'override/classes/CMSCategory.php',
|
||||||
'CacheCore' => 'classes/cache/Cache.php',
|
|
||||||
'Cache' => 'override/classes/cache/Cache.php',
|
|
||||||
'CarrierModuleCore' => 'classes/CarrierModule.php',
|
|
||||||
'CarrierModule' => 'override/classes/CarrierModule.php',
|
|
||||||
'CarrierCore' => 'classes/Carrier.php',
|
'CarrierCore' => 'classes/Carrier.php',
|
||||||
'Carrier' => 'override/classes/Carrier.php',
|
'Carrier' => 'override/classes/Carrier.php',
|
||||||
|
'CarrierModuleCore' => 'classes/CarrierModule.php',
|
||||||
|
'CarrierModule' => 'override/classes/CarrierModule.php',
|
||||||
'CartCore' => 'classes/Cart.php',
|
'CartCore' => 'classes/Cart.php',
|
||||||
'Cart' => 'override/classes/Cart.php',
|
'Cart' => 'override/classes/Cart.php',
|
||||||
'CategoryCore' => 'classes/Category.php',
|
'CategoryCore' => 'classes/Category.php',
|
||||||
'Category' => 'override/classes/Category.php',
|
'Category' => 'override/classes/Category.php',
|
||||||
'ChartCore' => 'classes/Chart.php',
|
'ChartCore' => 'classes/Chart.php',
|
||||||
'Chart' => 'override/classes/Chart.php',
|
'Chart' => 'override/classes/Chart.php',
|
||||||
'CMSCategoryCore' => 'classes/CMSCategory.php',
|
|
||||||
'CMSCategory' => 'override/classes/CMSCategory.php',
|
|
||||||
'CMSCore' => 'classes/CMS.php',
|
|
||||||
'CMS' => 'override/classes/CMS.php',
|
|
||||||
'CombinationCore' => 'classes/Combination.php',
|
'CombinationCore' => 'classes/Combination.php',
|
||||||
'Combination' => 'override/classes/Combination.php',
|
'Combination' => 'override/classes/Combination.php',
|
||||||
'CompareProductCore' => 'classes/CompareProduct.php',
|
'CompareProductCore' => 'classes/CompareProduct.php',
|
||||||
@@ -58,10 +52,10 @@
|
|||||||
'Contact' => 'override/classes/Contact.php',
|
'Contact' => 'override/classes/Contact.php',
|
||||||
'ContextCore' => 'classes/Context.php',
|
'ContextCore' => 'classes/Context.php',
|
||||||
'Context' => 'override/classes/Context.php',
|
'Context' => 'override/classes/Context.php',
|
||||||
'ControllerFactoryCore' => 'classes/ControllerFactory.php',
|
|
||||||
'ControllerFactory' => 'override/classes/ControllerFactory.php',
|
|
||||||
'ControllerCore' => 'classes/Controller.php',
|
'ControllerCore' => 'classes/Controller.php',
|
||||||
'Controller' => 'override/classes/Controller.php',
|
'Controller' => 'override/classes/Controller.php',
|
||||||
|
'ControllerFactoryCore' => 'classes/ControllerFactory.php',
|
||||||
|
'ControllerFactory' => 'override/classes/ControllerFactory.php',
|
||||||
'CookieCore' => 'classes/Cookie.php',
|
'CookieCore' => 'classes/Cookie.php',
|
||||||
'Cookie' => 'override/classes/Cookie.php',
|
'Cookie' => 'override/classes/Cookie.php',
|
||||||
'CountryCore' => 'classes/Country.php',
|
'CountryCore' => 'classes/Country.php',
|
||||||
@@ -70,26 +64,16 @@
|
|||||||
'County' => 'override/classes/County.php',
|
'County' => 'override/classes/County.php',
|
||||||
'CurrencyCore' => 'classes/Currency.php',
|
'CurrencyCore' => 'classes/Currency.php',
|
||||||
'Currency' => 'override/classes/Currency.php',
|
'Currency' => 'override/classes/Currency.php',
|
||||||
'CustomerMessageCore' => 'classes/CustomerMessage.php',
|
|
||||||
'CustomerMessage' => 'override/classes/CustomerMessage.php',
|
|
||||||
'CustomerCore' => 'classes/Customer.php',
|
'CustomerCore' => 'classes/Customer.php',
|
||||||
'Customer' => 'override/classes/Customer.php',
|
'Customer' => 'override/classes/Customer.php',
|
||||||
|
'CustomerMessageCore' => 'classes/CustomerMessage.php',
|
||||||
|
'CustomerMessage' => 'override/classes/CustomerMessage.php',
|
||||||
'CustomerThreadCore' => 'classes/CustomerThread.php',
|
'CustomerThreadCore' => 'classes/CustomerThread.php',
|
||||||
'CustomerThread' => 'override/classes/CustomerThread.php',
|
'CustomerThread' => 'override/classes/CustomerThread.php',
|
||||||
'CustomizationCore' => 'classes/Customization.php',
|
'CustomizationCore' => 'classes/Customization.php',
|
||||||
'Customization' => 'override/classes/Customization.php',
|
'Customization' => 'override/classes/Customization.php',
|
||||||
'DateRangeCore' => 'classes/DateRange.php',
|
'DateRangeCore' => 'classes/DateRange.php',
|
||||||
'DateRange' => 'override/classes/DateRange.php',
|
'DateRange' => 'override/classes/DateRange.php',
|
||||||
'DbMySQLiCore' => 'classes/db/DbMySQLi.php',
|
|
||||||
'DbMySQLi' => 'override/classes/db/DbMySQLi.php',
|
|
||||||
'DbPDOCore' => 'classes/db/DbPDO.php',
|
|
||||||
'DbPDO' => 'override/classes/db/DbPDO.php',
|
|
||||||
'DbCore' => 'classes/db/Db.php',
|
|
||||||
'Db' => 'override/classes/db/Db.php',
|
|
||||||
'DbQueryCore' => 'classes/db/DbQuery.php',
|
|
||||||
'DbQuery' => 'override/classes/db/DbQuery.php',
|
|
||||||
'MySQLCore' => 'classes/db/MySQL.php',
|
|
||||||
'MySQL' => 'override/classes/db/MySQL.php',
|
|
||||||
'DeliveryCore' => 'classes/Delivery.php',
|
'DeliveryCore' => 'classes/Delivery.php',
|
||||||
'Delivery' => 'override/classes/Delivery.php',
|
'Delivery' => 'override/classes/Delivery.php',
|
||||||
'DiscountCore' => 'classes/Discount.php',
|
'DiscountCore' => 'classes/Discount.php',
|
||||||
@@ -98,14 +82,6 @@
|
|||||||
'Dispatcher' => 'override/classes/Dispatcher.php',
|
'Dispatcher' => 'override/classes/Dispatcher.php',
|
||||||
'EmployeeCore' => 'classes/Employee.php',
|
'EmployeeCore' => 'classes/Employee.php',
|
||||||
'Employee' => 'override/classes/Employee.php',
|
'Employee' => 'override/classes/Employee.php',
|
||||||
'PrestashopDatabaseExceptionCore' => 'classes/exception/PrestashopDatabaseException.php',
|
|
||||||
'PrestashopDatabaseException' => 'override/classes/exception/PrestashopDatabaseException.php',
|
|
||||||
'PrestashopExceptionCore' => 'classes/exception/PrestashopException.php',
|
|
||||||
'PrestashopException' => 'override/classes/exception/PrestashopException.php',
|
|
||||||
'PrestashopModuleExceptionCore' => 'classes/exception/PrestashopModuleException.php',
|
|
||||||
'PrestashopModuleException' => 'override/classes/exception/PrestashopModuleException.php',
|
|
||||||
'PrestashopPaymentExceptionCore' => 'classes/exception/PrestashopPaymentException.php',
|
|
||||||
'PrestashopPaymentException' => 'override/classes/exception/PrestashopPaymentException.php',
|
|
||||||
'FeatureCore' => 'classes/Feature.php',
|
'FeatureCore' => 'classes/Feature.php',
|
||||||
'Feature' => 'override/classes/Feature.php',
|
'Feature' => 'override/classes/Feature.php',
|
||||||
'FeatureValueCore' => 'classes/FeatureValue.php',
|
'FeatureValueCore' => 'classes/FeatureValue.php',
|
||||||
@@ -126,10 +102,10 @@
|
|||||||
'Guest' => 'override/classes/Guest.php',
|
'Guest' => 'override/classes/Guest.php',
|
||||||
'HelpAccessCore' => 'classes/HelpAccess.php',
|
'HelpAccessCore' => 'classes/HelpAccess.php',
|
||||||
'HelpAccess' => 'override/classes/HelpAccess.php',
|
'HelpAccess' => 'override/classes/HelpAccess.php',
|
||||||
'HelperListCore' => 'classes/HelperList.php',
|
|
||||||
'HelperList' => '',
|
|
||||||
'HelperCore' => 'classes/Helper.php',
|
'HelperCore' => 'classes/Helper.php',
|
||||||
'Helper' => 'override/classes/Helper.php',
|
'Helper' => 'override/classes/Helper.php',
|
||||||
|
'HelperListCore' => 'classes/HelperList.php',
|
||||||
|
'HelperList' => '',
|
||||||
'HookCore' => 'classes/Hook.php',
|
'HookCore' => 'classes/Hook.php',
|
||||||
'Hook' => 'override/classes/Hook.php',
|
'Hook' => 'override/classes/Hook.php',
|
||||||
'ImageCore' => 'classes/Image.php',
|
'ImageCore' => 'classes/Image.php',
|
||||||
@@ -156,20 +132,22 @@
|
|||||||
'Message' => 'override/classes/Message.php',
|
'Message' => 'override/classes/Message.php',
|
||||||
'MetaCore' => 'classes/Meta.php',
|
'MetaCore' => 'classes/Meta.php',
|
||||||
'Meta' => 'override/classes/Meta.php',
|
'Meta' => 'override/classes/Meta.php',
|
||||||
'ModuleGraphEngineCore' => 'classes/ModuleGraphEngine.php',
|
|
||||||
'ModuleGraphEngine' => 'override/classes/ModuleGraphEngine.php',
|
|
||||||
'ModuleGraphCore' => 'classes/ModuleGraph.php',
|
|
||||||
'ModuleGraph' => 'override/classes/ModuleGraph.php',
|
|
||||||
'ModuleGridEngineCore' => 'classes/ModuleGridEngine.php',
|
|
||||||
'ModuleGridEngine' => 'override/classes/ModuleGridEngine.php',
|
|
||||||
'ModuleGridCore' => 'classes/ModuleGrid.php',
|
|
||||||
'ModuleGrid' => 'override/classes/ModuleGrid.php',
|
|
||||||
'ModuleCore' => 'classes/Module.php',
|
'ModuleCore' => 'classes/Module.php',
|
||||||
'Module' => 'override/classes/Module.php',
|
'Module' => 'override/classes/Module.php',
|
||||||
|
'ModuleGraphCore' => 'classes/ModuleGraph.php',
|
||||||
|
'ModuleGraph' => 'override/classes/ModuleGraph.php',
|
||||||
|
'ModuleGraphEngineCore' => 'classes/ModuleGraphEngine.php',
|
||||||
|
'ModuleGraphEngine' => 'override/classes/ModuleGraphEngine.php',
|
||||||
|
'ModuleGridCore' => 'classes/ModuleGrid.php',
|
||||||
|
'ModuleGrid' => 'override/classes/ModuleGrid.php',
|
||||||
|
'ModuleGridEngineCore' => 'classes/ModuleGridEngine.php',
|
||||||
|
'ModuleGridEngine' => 'override/classes/ModuleGridEngine.php',
|
||||||
'NotificationCore' => 'classes/Notification.php',
|
'NotificationCore' => 'classes/Notification.php',
|
||||||
'Notification' => 'override/classes/Notification.php',
|
'Notification' => 'override/classes/Notification.php',
|
||||||
'ObjectModelCore' => 'classes/ObjectModel.php',
|
'ObjectModelCore' => 'classes/ObjectModel.php',
|
||||||
'ObjectModel' => 'override/classes/ObjectModel.php',
|
'ObjectModel' => 'override/classes/ObjectModel.php',
|
||||||
|
'OrderCore' => 'classes/Order.php',
|
||||||
|
'Order' => 'override/classes/Order.php',
|
||||||
'OrderDetailCore' => 'classes/OrderDetail.php',
|
'OrderDetailCore' => 'classes/OrderDetail.php',
|
||||||
'OrderDetail' => 'override/classes/OrderDetail.php',
|
'OrderDetail' => 'override/classes/OrderDetail.php',
|
||||||
'OrderDiscountCore' => 'classes/OrderDiscount.php',
|
'OrderDiscountCore' => 'classes/OrderDiscount.php',
|
||||||
@@ -178,8 +156,6 @@
|
|||||||
'OrderHistory' => 'override/classes/OrderHistory.php',
|
'OrderHistory' => 'override/classes/OrderHistory.php',
|
||||||
'OrderMessageCore' => 'classes/OrderMessage.php',
|
'OrderMessageCore' => 'classes/OrderMessage.php',
|
||||||
'OrderMessage' => 'override/classes/OrderMessage.php',
|
'OrderMessage' => 'override/classes/OrderMessage.php',
|
||||||
'OrderCore' => 'classes/Order.php',
|
|
||||||
'Order' => 'override/classes/Order.php',
|
|
||||||
'OrderReturnCore' => 'classes/OrderReturn.php',
|
'OrderReturnCore' => 'classes/OrderReturn.php',
|
||||||
'OrderReturn' => 'override/classes/OrderReturn.php',
|
'OrderReturn' => 'override/classes/OrderReturn.php',
|
||||||
'OrderReturnStateCore' => 'classes/OrderReturnState.php',
|
'OrderReturnStateCore' => 'classes/OrderReturnState.php',
|
||||||
@@ -188,6 +164,8 @@
|
|||||||
'OrderSlip' => 'override/classes/OrderSlip.php',
|
'OrderSlip' => 'override/classes/OrderSlip.php',
|
||||||
'OrderStateCore' => 'classes/OrderState.php',
|
'OrderStateCore' => 'classes/OrderState.php',
|
||||||
'OrderState' => 'override/classes/OrderState.php',
|
'OrderState' => 'override/classes/OrderState.php',
|
||||||
|
'PDFCore' => 'classes/PDF.php',
|
||||||
|
'PDF' => 'override/classes/PDF.php',
|
||||||
'PackCore' => 'classes/Pack.php',
|
'PackCore' => 'classes/Pack.php',
|
||||||
'Pack' => 'override/classes/Pack.php',
|
'Pack' => 'override/classes/Pack.php',
|
||||||
'PageCore' => 'classes/Page.php',
|
'PageCore' => 'classes/Page.php',
|
||||||
@@ -196,12 +174,10 @@
|
|||||||
'PaymentCC' => 'override/classes/PaymentCC.php',
|
'PaymentCC' => 'override/classes/PaymentCC.php',
|
||||||
'PaymentModuleCore' => 'classes/PaymentModule.php',
|
'PaymentModuleCore' => 'classes/PaymentModule.php',
|
||||||
'PaymentModule' => 'override/classes/PaymentModule.php',
|
'PaymentModule' => 'override/classes/PaymentModule.php',
|
||||||
'PDFCore' => 'classes/PDF.php',
|
|
||||||
'PDF' => 'override/classes/PDF.php',
|
|
||||||
'ProductDownloadCore' => 'classes/ProductDownload.php',
|
|
||||||
'ProductDownload' => 'override/classes/ProductDownload.php',
|
|
||||||
'ProductCore' => 'classes/Product.php',
|
'ProductCore' => 'classes/Product.php',
|
||||||
'Product' => 'override/classes/Product.php',
|
'Product' => 'override/classes/Product.php',
|
||||||
|
'ProductDownloadCore' => 'classes/ProductDownload.php',
|
||||||
|
'ProductDownload' => 'override/classes/ProductDownload.php',
|
||||||
'ProductSaleCore' => 'classes/ProductSale.php',
|
'ProductSaleCore' => 'classes/ProductSale.php',
|
||||||
'ProductSale' => 'override/classes/ProductSale.php',
|
'ProductSale' => 'override/classes/ProductSale.php',
|
||||||
'ProfileCore' => 'classes/Profile.php',
|
'ProfileCore' => 'classes/Profile.php',
|
||||||
@@ -220,32 +196,20 @@
|
|||||||
'Rijndael' => 'override/classes/Rijndael.php',
|
'Rijndael' => 'override/classes/Rijndael.php',
|
||||||
'SceneCore' => 'classes/Scene.php',
|
'SceneCore' => 'classes/Scene.php',
|
||||||
'Scene' => 'override/classes/Scene.php',
|
'Scene' => 'override/classes/Scene.php',
|
||||||
'SearchEngineCore' => 'classes/SearchEngine.php',
|
|
||||||
'SearchEngine' => 'override/classes/SearchEngine.php',
|
|
||||||
'SearchCore' => 'classes/Search.php',
|
'SearchCore' => 'classes/Search.php',
|
||||||
'Search' => 'override/classes/Search.php',
|
'Search' => 'override/classes/Search.php',
|
||||||
'GroupShopCore' => 'classes/shop/GroupShop.php',
|
'SearchEngineCore' => 'classes/SearchEngine.php',
|
||||||
'GroupShop' => 'override/classes/shop/GroupShop.php',
|
'SearchEngine' => 'override/classes/SearchEngine.php',
|
||||||
'ShopCore' => 'classes/shop/Shop.php',
|
|
||||||
'Shop' => 'override/classes/shop/Shop.php',
|
|
||||||
'ShopUrlCore' => 'classes/shop/ShopUrl.php',
|
|
||||||
'ShopUrl' => 'override/classes/shop/ShopUrl.php',
|
|
||||||
'SpecificPriceCore' => 'classes/SpecificPrice.php',
|
'SpecificPriceCore' => 'classes/SpecificPrice.php',
|
||||||
'SpecificPrice' => 'override/classes/SpecificPrice.php',
|
'SpecificPrice' => 'override/classes/SpecificPrice.php',
|
||||||
'StateCore' => 'classes/State.php',
|
'StateCore' => 'classes/State.php',
|
||||||
'State' => 'override/classes/State.php',
|
'State' => 'override/classes/State.php',
|
||||||
'StockManagerFactoryCore' => 'classes/stock/StockManagerFactory.php',
|
'StockCore' => 'classes/stock/Stock.php',
|
||||||
'StockManagerFactory' => '',
|
|
||||||
'StockManagerInterface' => 'classes/stock/StockManagerInterface.php',
|
|
||||||
'StockManagerModule' => 'classes/stock/StockManagerModule.php',
|
|
||||||
'StockMvtCore' => 'classes/StockMvt.php',
|
|
||||||
'StockMvt' => 'override/classes/StockMvt.php',
|
|
||||||
'StockMvtReasonCore' => 'classes/StockMvtReason.php',
|
|
||||||
'StockMvtReason' => 'override/classes/StockMvtReason.php',
|
|
||||||
'StockCore' => 'classes/Stock.php',
|
|
||||||
'Stock' => 'override/classes/Stock.php',
|
'Stock' => 'override/classes/Stock.php',
|
||||||
'StockWarehouseCore' => 'classes/stock/StockWarehouse.php',
|
'StockMvtCore' => 'classes/stock/StockMvt.php',
|
||||||
'StockWarehouse' => '',
|
'StockMvt' => 'override/classes/StockMvt.php',
|
||||||
|
'StockMvtReasonCore' => 'classes/stock/StockMvtReason.php',
|
||||||
|
'StockMvtReason' => 'override/classes/StockMvtReason.php',
|
||||||
'StoreCore' => 'classes/Store.php',
|
'StoreCore' => 'classes/Store.php',
|
||||||
'Store' => 'override/classes/Store.php',
|
'Store' => 'override/classes/Store.php',
|
||||||
'SubDomainCore' => 'classes/SubDomain.php',
|
'SubDomainCore' => 'classes/SubDomain.php',
|
||||||
@@ -256,21 +220,6 @@
|
|||||||
'Tab' => 'override/classes/Tab.php',
|
'Tab' => 'override/classes/Tab.php',
|
||||||
'TagCore' => 'classes/Tag.php',
|
'TagCore' => 'classes/Tag.php',
|
||||||
'Tag' => 'override/classes/Tag.php',
|
'Tag' => 'override/classes/Tag.php',
|
||||||
'TaxCalculatorCore' => 'classes/tax/TaxCalculator.php',
|
|
||||||
'TaxCalculator' => 'override/classes/tax/TaxCalculator.php',
|
|
||||||
'TaxManagerFactoryCore' => 'classes/tax/TaxManagerFactory.php',
|
|
||||||
'TaxManagerFactory' => 'override/classes/tax/TaxManagerFactory.php',
|
|
||||||
'TaxManagerInterface' => 'classes/tax/TaxManagerInterface.php',
|
|
||||||
'TaxManagerModuleCore' => 'classes/tax/TaxManagerModule.php',
|
|
||||||
'TaxManagerModule' => 'override/classes/tax/TaxManagerModule.php',
|
|
||||||
'TaxCore' => 'classes/tax/Tax.php',
|
|
||||||
'Tax' => 'override/classes/tax/Tax.php',
|
|
||||||
'TaxRuleCore' => 'classes/tax/TaxRule.php',
|
|
||||||
'TaxRule' => 'override/classes/tax/TaxRule.php',
|
|
||||||
'TaxRulesGroupCore' => 'classes/tax/TaxRulesGroup.php',
|
|
||||||
'TaxRulesGroup' => 'override/classes/tax/TaxRulesGroup.php',
|
|
||||||
'TaxRulesTaxManagerCore' => 'classes/tax/TaxRulesTaxManager.php',
|
|
||||||
'TaxRulesTaxManager' => 'override/classes/tax/TaxRulesTaxManager.php',
|
|
||||||
'ThemeCore' => 'classes/Theme.php',
|
'ThemeCore' => 'classes/Theme.php',
|
||||||
'Theme' => 'override/classes/Theme.php',
|
'Theme' => 'override/classes/Theme.php',
|
||||||
'ToolsCore' => 'classes/Tools.php',
|
'ToolsCore' => 'classes/Tools.php',
|
||||||
@@ -281,6 +230,61 @@
|
|||||||
'Upgrader' => 'override/classes/Upgrader.php',
|
'Upgrader' => 'override/classes/Upgrader.php',
|
||||||
'ValidateCore' => 'classes/Validate.php',
|
'ValidateCore' => 'classes/Validate.php',
|
||||||
'Validate' => 'override/classes/Validate.php',
|
'Validate' => 'override/classes/Validate.php',
|
||||||
|
'ZoneCore' => 'classes/Zone.php',
|
||||||
|
'Zone' => 'override/classes/Zone.php',
|
||||||
|
'CacheCore' => 'classes/cache/Cache.php',
|
||||||
|
'Cache' => 'override/classes/cache/Cache.php',
|
||||||
|
'CacheFsCore' => 'classes/cache/CacheFs.php',
|
||||||
|
'CacheFs' => 'override/classes/cache/CacheFs.php',
|
||||||
|
'CacheMemcacheCore' => 'classes/cache/CacheMemcache.php',
|
||||||
|
'CacheMemcache' => 'override/classes/cache/CacheMemcache.php',
|
||||||
|
'DbCore' => 'classes/db/Db.php',
|
||||||
|
'Db' => 'override/classes/db/Db.php',
|
||||||
|
'DbMySQLiCore' => 'classes/db/DbMySQLi.php',
|
||||||
|
'DbMySQLi' => 'override/classes/db/DbMySQLi.php',
|
||||||
|
'DbPDOCore' => 'classes/db/DbPDO.php',
|
||||||
|
'DbPDO' => 'override/classes/db/DbPDO.php',
|
||||||
|
'DbQueryCore' => 'classes/db/DbQuery.php',
|
||||||
|
'DbQuery' => 'override/classes/db/DbQuery.php',
|
||||||
|
'MySQLCore' => 'classes/db/MySQL.php',
|
||||||
|
'MySQL' => 'override/classes/db/MySQL.php',
|
||||||
|
'PrestashopDatabaseExceptionCore' => 'classes/exception/PrestashopDatabaseException.php',
|
||||||
|
'PrestashopDatabaseException' => 'override/classes/exception/PrestashopDatabaseException.php',
|
||||||
|
'PrestashopExceptionCore' => 'classes/exception/PrestashopException.php',
|
||||||
|
'PrestashopException' => 'override/classes/exception/PrestashopException.php',
|
||||||
|
'PrestashopModuleExceptionCore' => 'classes/exception/PrestashopModuleException.php',
|
||||||
|
'PrestashopModuleException' => 'override/classes/exception/PrestashopModuleException.php',
|
||||||
|
'PrestashopPaymentExceptionCore' => 'classes/exception/PrestashopPaymentException.php',
|
||||||
|
'PrestashopPaymentException' => 'override/classes/exception/PrestashopPaymentException.php',
|
||||||
|
'GroupShopCore' => 'classes/shop/GroupShop.php',
|
||||||
|
'GroupShop' => 'override/classes/shop/GroupShop.php',
|
||||||
|
'ShopCore' => 'classes/shop/Shop.php',
|
||||||
|
'Shop' => 'override/classes/shop/Shop.php',
|
||||||
|
'ShopUrlCore' => 'classes/shop/ShopUrl.php',
|
||||||
|
'ShopUrl' => 'override/classes/shop/ShopUrl.php',
|
||||||
|
'StockManagerCore' => 'classes/stock/StockManager.php',
|
||||||
|
'StockManager' => '',
|
||||||
|
'StockManagerFactoryCore' => 'classes/stock/StockManagerFactory.php',
|
||||||
|
'StockManagerFactory' => '',
|
||||||
|
'StockManagerInterface' => 'classes/stock/StockManagerInterface.php',
|
||||||
|
'StockManagerModule' => 'classes/stock/StockManagerModule.php',
|
||||||
|
'StockWarehouseCore' => 'classes/stock/StockWarehouse.php',
|
||||||
|
'StockWarehouse' => '',
|
||||||
|
'TaxCore' => 'classes/tax/Tax.php',
|
||||||
|
'Tax' => 'override/classes/tax/Tax.php',
|
||||||
|
'TaxCalculatorCore' => 'classes/tax/TaxCalculator.php',
|
||||||
|
'TaxCalculator' => 'override/classes/tax/TaxCalculator.php',
|
||||||
|
'TaxManagerFactoryCore' => 'classes/tax/TaxManagerFactory.php',
|
||||||
|
'TaxManagerFactory' => 'override/classes/tax/TaxManagerFactory.php',
|
||||||
|
'TaxManagerInterface' => 'classes/tax/TaxManagerInterface.php',
|
||||||
|
'TaxManagerModuleCore' => 'classes/tax/TaxManagerModule.php',
|
||||||
|
'TaxManagerModule' => 'override/classes/tax/TaxManagerModule.php',
|
||||||
|
'TaxRuleCore' => 'classes/tax/TaxRule.php',
|
||||||
|
'TaxRule' => 'override/classes/tax/TaxRule.php',
|
||||||
|
'TaxRulesGroupCore' => 'classes/tax/TaxRulesGroup.php',
|
||||||
|
'TaxRulesGroup' => 'override/classes/tax/TaxRulesGroup.php',
|
||||||
|
'TaxRulesTaxManagerCore' => 'classes/tax/TaxRulesTaxManager.php',
|
||||||
|
'TaxRulesTaxManager' => 'override/classes/tax/TaxRulesTaxManager.php',
|
||||||
'WebserviceExceptionCore' => 'classes/webservice/WebserviceException.php',
|
'WebserviceExceptionCore' => 'classes/webservice/WebserviceException.php',
|
||||||
'WebserviceException' => 'override/classes/webservice/WebserviceException.php',
|
'WebserviceException' => 'override/classes/webservice/WebserviceException.php',
|
||||||
'WebserviceKeyCore' => 'classes/webservice/WebserviceKey.php',
|
'WebserviceKeyCore' => 'classes/webservice/WebserviceKey.php',
|
||||||
@@ -297,8 +301,6 @@
|
|||||||
'WebserviceSpecificManagementInterface' => 'classes/webservice/WebserviceSpecificManagementInterface.php',
|
'WebserviceSpecificManagementInterface' => 'classes/webservice/WebserviceSpecificManagementInterface.php',
|
||||||
'WebserviceSpecificManagementSearchCore' => 'classes/webservice/WebserviceSpecificManagementSearch.php',
|
'WebserviceSpecificManagementSearchCore' => 'classes/webservice/WebserviceSpecificManagementSearch.php',
|
||||||
'WebserviceSpecificManagementSearch' => 'override/classes/webservice/WebserviceSpecificManagementSearch.php',
|
'WebserviceSpecificManagementSearch' => 'override/classes/webservice/WebserviceSpecificManagementSearch.php',
|
||||||
'ZoneCore' => 'classes/Zone.php',
|
|
||||||
'Zone' => 'override/classes/Zone.php',
|
|
||||||
'FB' => 'override/classes/fb.php',
|
'FB' => 'override/classes/fb.php',
|
||||||
'AdminAddressesControllerCore' => 'controllers/admin/AdminAddressesController.php',
|
'AdminAddressesControllerCore' => 'controllers/admin/AdminAddressesController.php',
|
||||||
'AdminAddressesController' => '',
|
'AdminAddressesController' => '',
|
||||||
|
|||||||
@@ -1277,7 +1277,7 @@ class AdminControllerCore extends Controller
|
|||||||
ORDER BY '.(($orderBy == $this->identifier) ? 'a.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).
|
ORDER BY '.(($orderBy == $this->identifier) ? 'a.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).
|
||||||
($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').'
|
($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').'
|
||||||
LIMIT '.(int)$start.','.(int)$limit;
|
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.'`');
|
$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]);
|
$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)
|
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].')');
|
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'];
|
$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;
|
$irow = 0;
|
||||||
foreach ($table_fields as $field)
|
foreach ($table_fields as $field)
|
||||||
{
|
{
|
||||||
@@ -900,9 +900,9 @@ abstract class AdminTabCore
|
|||||||
|
|
||||||
$assos = self::getAssoShop($this->table, $id_object);
|
$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)
|
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]].')');
|
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).
|
ORDER BY '.(($orderBy == $this->identifier) ? 'a.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).
|
||||||
($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').'
|
($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').'
|
||||||
LIMIT '.(int)$start.','.(int)$limit;
|
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.'`');
|
$this->_listTotal = Db::getInstance()->getValue('SELECT FOUND_ROWS() AS `'._DB_PREFIX_.$this->table.'`');
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2341,7 +2341,7 @@ abstract class AdminTabCore
|
|||||||
$assos = array();
|
$assos = array();
|
||||||
$sql = 'SELECT id_'.$type.', `'.pSQL($this->identifier).'`
|
$sql = 'SELECT id_'.$type.', `'.pSQL($this->identifier).'`
|
||||||
FROM `'._DB_PREFIX_.pSQL($this->table).'_'.$type.'`';
|
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];
|
$assos[$row['id_'.$type]][] = $row[$this->identifier];
|
||||||
|
|
||||||
$html = <<<EOF
|
$html = <<<EOF
|
||||||
|
|||||||
+1
-1
@@ -98,7 +98,7 @@ class AliasCore extends ObjectModel
|
|||||||
if (!self::isFeatureActive())
|
if (!self::isFeatureActive())
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
$aliases = Db::getInstance()->ExecuteS('
|
$aliases = Db::getInstance()->executeS('
|
||||||
SELECT a.alias
|
SELECT a.alias
|
||||||
FROM `'._DB_PREFIX_.'alias` a
|
FROM `'._DB_PREFIX_.'alias` a
|
||||||
WHERE `search` = \''.pSQL($this->search).'\'');
|
WHERE `search` = \''.pSQL($this->search).'\'');
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class AttachmentCore extends ObjectModel
|
|||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
@unlink(_PS_DOWNLOAD_DIR_.$this->file);
|
@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();
|
return parent::delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ class AttachmentCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getAttachments($id_lang, $id_product, $include = true)
|
public static function getAttachments($id_lang, $id_product, $include = true)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM '._DB_PREFIX_.'attachment a
|
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).')
|
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)
|
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))
|
if (is_array($array))
|
||||||
{
|
{
|
||||||
$ids = array();
|
$ids = array();
|
||||||
foreach ($array as $id_attachment)
|
foreach ($array as $id_attachment)
|
||||||
$ids[] = '('.(int)($id_product).','.(int)($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');
|
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 && Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'product_attachment (id_product, id_attachment) VALUES '.implode(',',$ids)));
|
||||||
}
|
}
|
||||||
return $result1;
|
return $result1;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-10
@@ -84,16 +84,16 @@ class AttributeCore extends ObjectModel
|
|||||||
|
|
||||||
public function delete()
|
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;
|
return false;
|
||||||
$combinationIds = array();
|
$combinationIds = array();
|
||||||
if (Db::getInstance()->numRows())
|
if (Db::getInstance()->numRows())
|
||||||
{
|
{
|
||||||
foreach ($result AS $row)
|
foreach ($result AS $row)
|
||||||
$combinationIds[] = (int)$row['id_product_attribute'];
|
$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;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ class AttributeCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!Combination::isFeatureActive())
|
if (!Combination::isFeatureActive())
|
||||||
return array();
|
return array();
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT ag.*, agl.*, a.`id_attribute`, al.`name`, agl.`name` AS `attribute_group`
|
SELECT ag.*, agl.*, a.`id_attribute`, al.`name`, agl.`name` AS `attribute_group`
|
||||||
FROM `'._DB_PREFIX_.'attribute_group` ag
|
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.')
|
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.')
|
SELECT `id_attribute_group` FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute` = '.(int)$this->id.')
|
||||||
AND group_type = \'color\''))
|
AND group_type = \'color\''))
|
||||||
return false;
|
return false;
|
||||||
return Db::getInstance()->NumRows();
|
return Db::getInstance()->numRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -251,7 +251,7 @@ class AttributeCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function updatePosition($way, $position)
|
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`
|
SELECT a.`id_attribute`, a.`position`, a.`id_attribute_group`
|
||||||
FROM `'._DB_PREFIX_.'attribute` a
|
FROM `'._DB_PREFIX_.'attribute` a
|
||||||
WHERE a.`id_attribute_group` = '.(int)Tools::getValue('id_attribute_group', 1).'
|
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
|
// < and > statements rather than BETWEEN operator
|
||||||
// since BETWEEN is treated differently according to databases
|
// since BETWEEN is treated differently according to databases
|
||||||
return (Db::getInstance()->Execute('
|
return (Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'attribute`
|
UPDATE `'._DB_PREFIX_.'attribute`
|
||||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||||
WHERE `position`
|
WHERE `position`
|
||||||
@@ -276,7 +276,7 @@ class AttributeCore extends ObjectModel
|
|||||||
? '> '.(int)$movedAttribute['position'].' AND `position` <= '.(int)$position
|
? '> '.(int)$movedAttribute['position'].' AND `position` <= '.(int)$position
|
||||||
: '< '.(int)$movedAttribute['position'].' AND `position` >= '.(int)$position).'
|
: '< '.(int)$movedAttribute['position'].' AND `position` >= '.(int)$position).'
|
||||||
AND `id_attribute_group`='.(int)$movedAttribute['id_attribute_group'])
|
AND `id_attribute_group`='.(int)$movedAttribute['id_attribute_group'])
|
||||||
AND Db::getInstance()->Execute('
|
AND Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'attribute`
|
UPDATE `'._DB_PREFIX_.'attribute`
|
||||||
SET `position` = '.(int)$position.'
|
SET `position` = '.(int)$position.'
|
||||||
WHERE `id_attribute` = '.(int)$movedAttribute['id_attribute'].'
|
WHERE `id_attribute` = '.(int)$movedAttribute['id_attribute'].'
|
||||||
@@ -305,11 +305,11 @@ class AttributeCore extends ObjectModel
|
|||||||
AND `id_attribute` != '.(int)$this->id;
|
AND `id_attribute` != '.(int)$this->id;
|
||||||
$sql .= '
|
$sql .= '
|
||||||
ORDER BY `position`';
|
ORDER BY `position`';
|
||||||
$result = Db::getInstance()->ExecuteS($sql);
|
$result = Db::getInstance()->executeS($sql);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($result as $value)
|
foreach ($result as $value)
|
||||||
$return = Db::getInstance()->Execute('
|
$return = Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'attribute`
|
UPDATE `'._DB_PREFIX_.'attribute`
|
||||||
SET `position` = '.(int)$i++.'
|
SET `position` = '.(int)$i++.'
|
||||||
WHERE `id_attribute_group` = '.(int)$id_attribute_group.'
|
WHERE `id_attribute_group` = '.(int)$id_attribute_group.'
|
||||||
|
|||||||
+14
-14
@@ -96,12 +96,12 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
|
|
||||||
public static function cleanDeadCombinations()
|
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();
|
$toRemove = array();
|
||||||
foreach ($attributeCombinations AS $attributeCombination)
|
foreach ($attributeCombinations AS $attributeCombination)
|
||||||
if ((int)($attributeCombination['id_attribute']) == 0)
|
if ((int)($attributeCombination['id_attribute']) == 0)
|
||||||
$toRemove[] = (int)($attributeCombination['id_product_attribute']);
|
$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 false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -109,20 +109,20 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
/* Select children in order to find linked combinations */
|
/* 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)
|
if ($attributeIds === false)
|
||||||
return false;
|
return false;
|
||||||
/* Removing attributes to the found combinations */
|
/* Removing attributes to the found combinations */
|
||||||
$toRemove = array();
|
$toRemove = array();
|
||||||
foreach ($attributeIds AS $attribute)
|
foreach ($attributeIds AS $attribute)
|
||||||
$toRemove[] = (int)($attribute['id_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;
|
return false;
|
||||||
/* Remove combinations if they do not possess attributes anymore */
|
/* Remove combinations if they do not possess attributes anymore */
|
||||||
if (!self::cleanDeadCombinations())
|
if (!self::cleanDeadCombinations())
|
||||||
return false;
|
return false;
|
||||||
/* Also delete related attributes */
|
/* 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 false;
|
||||||
$return = parent::delete();
|
$return = parent::delete();
|
||||||
if($return)
|
if($return)
|
||||||
@@ -141,7 +141,7 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!Combination::isFeatureActive())
|
if (!Combination::isFeatureActive())
|
||||||
return array();
|
return array();
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'attribute` a
|
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).')
|
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())
|
if (!Combination::isFeatureActive())
|
||||||
return array();
|
return array();
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'attribute_group` ag
|
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).')
|
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();
|
$ids = array();
|
||||||
foreach ($values as $value)
|
foreach ($values as $value)
|
||||||
$ids[] = intval($value['id']);
|
$ids[] = intval($value['id']);
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'attribute`
|
DELETE FROM `'._DB_PREFIX_.'attribute`
|
||||||
WHERE `id_attribute_group` = '.(int)$this->id.'
|
WHERE `id_attribute_group` = '.(int)$this->id.'
|
||||||
AND `id_attribute` NOT IN ('.implode(',', $ids).')'
|
AND `id_attribute` NOT IN ('.implode(',', $ids).')'
|
||||||
@@ -196,7 +196,7 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
$ok = true;
|
$ok = true;
|
||||||
foreach ($values as $value)
|
foreach ($values as $value)
|
||||||
{
|
{
|
||||||
$result = Db::getInstance()->Execute('
|
$result = Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'attribute`
|
UPDATE `'._DB_PREFIX_.'attribute`
|
||||||
SET `id_attribute_group` = '.(int)$this->id.'
|
SET `id_attribute_group` = '.(int)$this->id.'
|
||||||
WHERE `id_attribute` = '.(int)$value['id']
|
WHERE `id_attribute` = '.(int)$value['id']
|
||||||
@@ -221,7 +221,7 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function updatePosition($way, $position)
|
public function updatePosition($way, $position)
|
||||||
{
|
{
|
||||||
if (!$res = Db::getInstance()->ExecuteS('
|
if (!$res = Db::getInstance()->executeS('
|
||||||
SELECT ag.`position`, ag.`id_attribute_group`
|
SELECT ag.`position`, ag.`id_attribute_group`
|
||||||
FROM `'._DB_PREFIX_.'attribute_group` ag
|
FROM `'._DB_PREFIX_.'attribute_group` ag
|
||||||
WHERE ag.`id_attribute_group` = '.(int)Tools::getValue('id_attribute_group', 1).'
|
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
|
// < and > statements rather than BETWEEN operator
|
||||||
// since BETWEEN is treated differently according to databases
|
// since BETWEEN is treated differently according to databases
|
||||||
return (Db::getInstance()->Execute('
|
return (Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'attribute_group`
|
UPDATE `'._DB_PREFIX_.'attribute_group`
|
||||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||||
WHERE `position`
|
WHERE `position`
|
||||||
'.($way
|
'.($way
|
||||||
? '> '.(int)$movedGroupAttribute['position'].' AND `position` <= '.(int)$position
|
? '> '.(int)$movedGroupAttribute['position'].' AND `position` <= '.(int)$position
|
||||||
: '< '.(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`
|
UPDATE `'._DB_PREFIX_.'attribute_group`
|
||||||
SET `position` = '.(int)$position.'
|
SET `position` = '.(int)$position.'
|
||||||
WHERE `id_attribute_group`='.(int)$movedGroupAttribute['id_attribute_group']));
|
WHERE `id_attribute_group`='.(int)$movedGroupAttribute['id_attribute_group']));
|
||||||
@@ -265,11 +265,11 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
SELECT `id_attribute_group`
|
SELECT `id_attribute_group`
|
||||||
FROM `'._DB_PREFIX_.'attribute_group`
|
FROM `'._DB_PREFIX_.'attribute_group`
|
||||||
ORDER BY `position`';
|
ORDER BY `position`';
|
||||||
$result = Db::getInstance()->ExecuteS($sql);
|
$result = Db::getInstance()->executeS($sql);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($result as $value)
|
foreach ($result as $value)
|
||||||
$return = Db::getInstance()->Execute('
|
$return = Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'attribute_group`
|
UPDATE `'._DB_PREFIX_.'attribute_group`
|
||||||
SET `position` = '.(int)$i++.'
|
SET `position` = '.(int)$i++.'
|
||||||
WHERE `id_attribute_group` = '.(int)$value['id_attribute_group']);
|
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");
|
fwrite($fp, "\n".'SET NAMES \'utf8\';'."\n\n");
|
||||||
|
|
||||||
// Find all tables
|
// Find all tables
|
||||||
$tables = Db::getInstance()->ExecuteS('SHOW TABLES');
|
$tables = Db::getInstance()->executeS('SHOW TABLES');
|
||||||
$found = 0;
|
$found = 0;
|
||||||
foreach ($tables AS $table)
|
foreach ($tables AS $table)
|
||||||
{
|
{
|
||||||
@@ -224,7 +224,7 @@ class BackupCore
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Export the table schema
|
// 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']))
|
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))
|
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();
|
$sizeof = DB::getInstance()->NumRows();
|
||||||
$lines = explode("\n", $schema[0]['Create Table']);
|
$lines = explode("\n", $schema[0]['Create Table']);
|
||||||
|
|
||||||
|
|||||||
+9
-9
@@ -91,7 +91,7 @@ class CMSCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!$link)
|
if (!$link)
|
||||||
$link = Context::getContext()->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
|
SELECT c.id_cms, cl.link_rewrite, cl.meta_title
|
||||||
FROM '._DB_PREFIX_.'cms c
|
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).')
|
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))
|
if (empty($id_lang))
|
||||||
$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
|
$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
|
SELECT c.id_cms, l.meta_title
|
||||||
FROM '._DB_PREFIX_.'cms c
|
FROM '._DB_PREFIX_.'cms c
|
||||||
JOIN '._DB_PREFIX_.'cms_lang l ON (c.id_cms = l.id_cms)
|
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)
|
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`
|
SELECT cp.`id_cms`, cp.`position`, cp.`id_cms_category`
|
||||||
FROM `'._DB_PREFIX_.'cms` cp
|
FROM `'._DB_PREFIX_.'cms` cp
|
||||||
WHERE cp.`id_cms_category` = '.(int)$this->id_cms_category.'
|
WHERE cp.`id_cms_category` = '.(int)$this->id_cms_category.'
|
||||||
@@ -143,7 +143,7 @@ class CMSCore extends ObjectModel
|
|||||||
|
|
||||||
// < and > statements rather than BETWEEN operator
|
// < and > statements rather than BETWEEN operator
|
||||||
// since BETWEEN is treated differently according to databases
|
// since BETWEEN is treated differently according to databases
|
||||||
return (Db::getInstance()->Execute('
|
return (Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'cms`
|
UPDATE `'._DB_PREFIX_.'cms`
|
||||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||||
WHERE `position`
|
WHERE `position`
|
||||||
@@ -151,7 +151,7 @@ class CMSCore extends ObjectModel
|
|||||||
? '> '.(int)($movedCms['position']).' AND `position` <= '.(int)($position)
|
? '> '.(int)($movedCms['position']).' AND `position` <= '.(int)($position)
|
||||||
: '< '.(int)($movedCms['position']).' AND `position` >= '.(int)($position)).'
|
: '< '.(int)($movedCms['position']).' AND `position` >= '.(int)($position)).'
|
||||||
AND `id_cms_category`='.(int)($movedCms['id_cms_category']))
|
AND `id_cms_category`='.(int)($movedCms['id_cms_category']))
|
||||||
&& Db::getInstance()->Execute('
|
&& Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'cms`
|
UPDATE `'._DB_PREFIX_.'cms`
|
||||||
SET `position` = '.(int)($position).'
|
SET `position` = '.(int)($position).'
|
||||||
WHERE `id_cms` = '.(int)($movedCms['id_cms']).'
|
WHERE `id_cms` = '.(int)($movedCms['id_cms']).'
|
||||||
@@ -160,7 +160,7 @@ class CMSCore extends ObjectModel
|
|||||||
|
|
||||||
public static function cleanPositions($id_category)
|
public static function cleanPositions($id_category)
|
||||||
{
|
{
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT `id_cms`
|
SELECT `id_cms`
|
||||||
FROM `'._DB_PREFIX_.'cms`
|
FROM `'._DB_PREFIX_.'cms`
|
||||||
WHERE `id_cms_category` = '.(int)($id_category).'
|
WHERE `id_cms_category` = '.(int)($id_category).'
|
||||||
@@ -171,7 +171,7 @@ class CMSCore extends ObjectModel
|
|||||||
SET `position` = '.(int)$i.'
|
SET `position` = '.(int)$i.'
|
||||||
WHERE `id_cms_category` = '.(int)$id_category.'
|
WHERE `id_cms_category` = '.(int)$id_category.'
|
||||||
AND `id_cms` = '.(int)$result[$i]['id_cms'];
|
AND `id_cms` = '.(int)$result[$i]['id_cms'];
|
||||||
Db::getInstance()->Execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ class CMSCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getCMSPages($id_lang = null, $id_cms_category = null, $active = true)
|
public static function getCMSPages($id_lang = null, $id_cms_category = null, $active = true)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'cms` c
|
FROM `'._DB_PREFIX_.'cms` c
|
||||||
JOIN `'._DB_PREFIX_.'cms_lang` l ON (c.id_cms = l.id_cms)'.
|
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`
|
LEFT JOIN `'._DB_PREFIX_.'lang` AS l ON c.`id_lang` = l.`id_lang`
|
||||||
WHERE c.`id_cms` = '.(int)$id_cms.'
|
WHERE c.`id_cms` = '.(int)$id_cms.'
|
||||||
AND l.`active` = 1';
|
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
|
FROM `'._DB_PREFIX_.'cms_category` c
|
||||||
WHERE c.`id_parent` = '.(int)$current.
|
WHERE c.`id_parent` = '.(int)$current.
|
||||||
($active ? ' AND c.`active` = 1' : '');
|
($active ? ' AND c.`active` = 1' : '');
|
||||||
$result = Db::getInstance()->ExecuteS($sql);
|
$result = Db::getInstance()->executeS($sql);
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
$category['children'][] = self::getRecurseCategory($id_lang, $row['id_cms_category'], $active, $links);
|
$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.'
|
WHERE `id_cms_category` = '.(int)$current.'
|
||||||
AND cl.`id_lang` = '.$id_lang.($active ? ' AND c.`active` = 1' : '').'
|
AND cl.`id_lang` = '.$id_lang.($active ? ' AND c.`active` = 1' : '').'
|
||||||
ORDER BY c.`position`';
|
ORDER BY c.`position`';
|
||||||
$category['cms'] = Db::getInstance()->ExecuteS($sql);
|
$category['cms'] = Db::getInstance()->executeS($sql);
|
||||||
if ($links == 1)
|
if ($links == 1)
|
||||||
{
|
{
|
||||||
$category['link'] = $link->getCMSCategoryLink($current, $category['link_rewrite']);
|
$category['link'] = $link->getCMSCategoryLink($current, $category['link_rewrite']);
|
||||||
@@ -243,7 +243,7 @@ class CMSCategoryCore extends ObjectModel
|
|||||||
if (!is_array($toDelete) OR !$id_cms_category)
|
if (!is_array($toDelete) OR !$id_cms_category)
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT `id_cms_category`
|
SELECT `id_cms_category`
|
||||||
FROM `'._DB_PREFIX_.'cms_category`
|
FROM `'._DB_PREFIX_.'cms_category`
|
||||||
WHERE `id_parent` = '.(int)($id_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 */
|
/* Delete CMS Category and its child from database */
|
||||||
$list = sizeof($toDelete) > 1 ? implode(',', $toDelete) : (int)($this->id);
|
$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` 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_lang` WHERE `id_cms_category` IN ('.$list.')');
|
||||||
|
|
||||||
self::cleanPositions($this->id_parent);
|
self::cleanPositions($this->id_parent);
|
||||||
|
|
||||||
/* Delete pages which are in categories to delete */
|
/* Delete pages which are in categories to delete */
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT `id_cms`
|
SELECT `id_cms`
|
||||||
FROM `'._DB_PREFIX_.'cms`
|
FROM `'._DB_PREFIX_.'cms`
|
||||||
WHERE `id_cms_category` IN ('.$list.')');
|
WHERE `id_cms_category` IN ('.$list.')');
|
||||||
@@ -327,7 +327,7 @@ class CMSCategoryCore extends ObjectModel
|
|||||||
if (!Validate::isBool($active))
|
if (!Validate::isBool($active))
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'cms_category` c
|
FROM `'._DB_PREFIX_.'cms_category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON c.`id_cms_category` = cl.`id_cms_category`
|
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)
|
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`
|
SELECT c.`id_cms_category`, cl.`name`
|
||||||
FROM `'._DB_PREFIX_.'cms_category` c
|
FROM `'._DB_PREFIX_.'cms_category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category`)
|
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))
|
if (!Validate::isBool($active))
|
||||||
die(Tools::displayError());
|
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
|
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
|
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).')
|
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))
|
if (!Validate::isBool($active))
|
||||||
die(Tools::displayError());
|
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`
|
SELECT c.`id_cms_category`, cl.`name`, cl.`link_rewrite`
|
||||||
FROM `'._DB_PREFIX_.'cms_category` c
|
FROM `'._DB_PREFIX_.'cms_category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON c.`id_cms_category` = cl.`id_cms_category`
|
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`)
|
LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category`)
|
||||||
WHERE `name` LIKE \''.pSQL($query).'\'');
|
WHERE `name` LIKE \''.pSQL($query).'\'');
|
||||||
else
|
else
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT c.*, cl.*
|
SELECT c.*, cl.*
|
||||||
FROM `'._DB_PREFIX_.'cms_category` c
|
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).')
|
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.')
|
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
|
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];
|
$categories[] = $result[0];
|
||||||
if(!$result OR $result[0]['id_parent'] == 1)
|
if(!$result OR $result[0]['id_parent'] == 1)
|
||||||
@@ -568,7 +568,7 @@ class CMSCategoryCore extends ObjectModel
|
|||||||
|
|
||||||
public function updatePosition($way, $position)
|
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`
|
SELECT cp.`id_cms_category`, cp.`position`, cp.`id_parent`
|
||||||
FROM `'._DB_PREFIX_.'cms_category` cp
|
FROM `'._DB_PREFIX_.'cms_category` cp
|
||||||
WHERE cp.`id_parent` = '.(int)$this->id_parent.'
|
WHERE cp.`id_parent` = '.(int)$this->id_parent.'
|
||||||
@@ -583,7 +583,7 @@ class CMSCategoryCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
// < and > statements rather than BETWEEN operator
|
// < and > statements rather than BETWEEN operator
|
||||||
// since BETWEEN is treated differently according to databases
|
// since BETWEEN is treated differently according to databases
|
||||||
return (Db::getInstance()->Execute('
|
return (Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'cms_category`
|
UPDATE `'._DB_PREFIX_.'cms_category`
|
||||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||||
WHERE `position`
|
WHERE `position`
|
||||||
@@ -591,7 +591,7 @@ class CMSCategoryCore extends ObjectModel
|
|||||||
? '> '.(int)($movedCategory['position']).' AND `position` <= '.(int)($position)
|
? '> '.(int)($movedCategory['position']).' AND `position` <= '.(int)($position)
|
||||||
: '< '.(int)($movedCategory['position']).' AND `position` >= '.(int)($position)).'
|
: '< '.(int)($movedCategory['position']).' AND `position` >= '.(int)($position)).'
|
||||||
AND `id_parent`='.(int)($movedCategory['id_parent']))
|
AND `id_parent`='.(int)($movedCategory['id_parent']))
|
||||||
AND Db::getInstance()->Execute('
|
AND Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'cms_category`
|
UPDATE `'._DB_PREFIX_.'cms_category`
|
||||||
SET `position` = '.(int)($position).'
|
SET `position` = '.(int)($position).'
|
||||||
WHERE `id_parent` = '.(int)($movedCategory['id_parent']).'
|
WHERE `id_parent` = '.(int)($movedCategory['id_parent']).'
|
||||||
@@ -600,7 +600,7 @@ class CMSCategoryCore extends ObjectModel
|
|||||||
|
|
||||||
public static function cleanPositions($id_category_parent)
|
public static function cleanPositions($id_category_parent)
|
||||||
{
|
{
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT `id_cms_category`
|
SELECT `id_cms_category`
|
||||||
FROM `'._DB_PREFIX_.'cms_category`
|
FROM `'._DB_PREFIX_.'cms_category`
|
||||||
WHERE `id_parent` = '.(int)($id_category_parent).'
|
WHERE `id_parent` = '.(int)($id_category_parent).'
|
||||||
@@ -612,7 +612,7 @@ class CMSCategoryCore extends ObjectModel
|
|||||||
SET `position` = '.(int)($i).'
|
SET `position` = '.(int)($i).'
|
||||||
WHERE `id_parent` = '.(int)($id_category_parent).'
|
WHERE `id_parent` = '.(int)($id_category_parent).'
|
||||||
AND `id_cms_category` = '.(int)($result[$i]['id_cms_category']);
|
AND `id_cms_category` = '.(int)($result[$i]['id_cms_category']);
|
||||||
Db::getInstance()->Execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -629,7 +629,7 @@ class CMSCategoryCore extends ObjectModel
|
|||||||
LEFT JOIN `'._DB_PREFIX_.'lang` AS l ON c.`id_lang` = l.`id_lang`
|
LEFT JOIN `'._DB_PREFIX_.'lang` AS l ON c.`id_lang` = l.`id_lang`
|
||||||
WHERE c.`id_cms_category` = '.(int)$id_category.'
|
WHERE c.`id_cms_category` = '.(int)$id_category.'
|
||||||
AND l.`active` = 1';
|
AND l.`active` = 1';
|
||||||
$arr_return = Db::getInstance()->ExecuteS($sql);
|
$arr_return = Db::getInstance()->executeS($sql);
|
||||||
return $arr_return;
|
return $arr_return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-21
@@ -153,7 +153,7 @@ class CarrierCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!parent::add($autodate, $nullValues) || !Validate::isLoadedObject($this))
|
if (!parent::add($autodate, $nullValues) || !Validate::isLoadedObject($this))
|
||||||
return false;
|
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;
|
return false;
|
||||||
if (!$numRows = Db::getInstance()->NumRows())
|
if (!$numRows = Db::getInstance()->NumRows())
|
||||||
return false;
|
return false;
|
||||||
@@ -161,7 +161,7 @@ class CarrierCore extends ObjectModel
|
|||||||
Configuration::updateValue('PS_CARRIER_DEFAULT', (int)($this->id));
|
Configuration::updateValue('PS_CARRIER_DEFAULT', (int)($this->id));
|
||||||
|
|
||||||
// Register reference
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ class CarrierCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function setConfiguration($id_old)
|
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.'
|
AND d.`id_carrier` = '.(int)$this->id.'
|
||||||
'.Carrier::sqlDeliveryRangeShop('range_weight', $shop).'
|
'.Carrier::sqlDeliveryRangeShop('range_weight', $shop).'
|
||||||
ORDER BY w.`delimiter2` DESC LIMIT 1';
|
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']))
|
if (!isset($result[0]['price']))
|
||||||
return false;
|
return false;
|
||||||
return $result[0]['price'];
|
return $result[0]['price'];
|
||||||
@@ -315,7 +315,7 @@ class CarrierCore extends ObjectModel
|
|||||||
AND d.`id_carrier` = '.(int)$this->id.'
|
AND d.`id_carrier` = '.(int)$this->id.'
|
||||||
'.Carrier::sqlDeliveryRangeShop('range_price', $shop).'
|
'.Carrier::sqlDeliveryRangeShop('range_price', $shop).'
|
||||||
ORDER BY r.`delimiter2` DESC LIMIT 1';
|
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']))
|
if (!isset($result[0]['price']))
|
||||||
return false;
|
return false;
|
||||||
return $result[0]['price'];
|
return $result[0]['price'];
|
||||||
@@ -338,7 +338,7 @@ class CarrierCore extends ObjectModel
|
|||||||
AND d.id_'.$rangeTable.' != 0
|
AND d.id_'.$rangeTable.' != 0
|
||||||
'.Carrier::sqlDeliveryRangeShop($rangeTable, $shop).'
|
'.Carrier::sqlDeliveryRangeShop($rangeTable, $shop).'
|
||||||
ORDER BY r.delimiter1';
|
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.')) ' : '').'
|
$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`';
|
GROUP BY c.`id_carrier`';
|
||||||
|
|
||||||
$carriers = Db::getInstance()->ExecuteS($sql);
|
$carriers = Db::getInstance()->executeS($sql);
|
||||||
|
|
||||||
if (is_array($carriers) && count($carriers))
|
if (is_array($carriers) && count($carriers))
|
||||||
{
|
{
|
||||||
@@ -418,12 +418,12 @@ class CarrierCore extends ObjectModel
|
|||||||
if (!Validate::isBool($activeCountries) || !Validate::isBool($activeCarriers))
|
if (!Validate::isBool($activeCountries) || !Validate::isBool($activeCarriers))
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
$states = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$states = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT s.*
|
SELECT s.*
|
||||||
FROM `'._DB_PREFIX_.'state` s
|
FROM `'._DB_PREFIX_.'state` s
|
||||||
ORDER BY s.`name` ASC');
|
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
|
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)
|
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 ?
|
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)
|
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`
|
SELECT c.`id_carrier`
|
||||||
FROM `'._DB_PREFIX_.'carrier` c
|
FROM `'._DB_PREFIX_.'carrier` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'carrier_zone` cz ON (cz.`id_carrier` = c.`id_carrier`)
|
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()
|
public function getZones()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'carrier_zone` cz
|
FROM `'._DB_PREFIX_.'carrier_zone` cz
|
||||||
LEFT JOIN `'._DB_PREFIX_.'zone` z ON cz.`id_zone` = z.`id_zone`
|
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)
|
public function getZone($id_zone)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'carrier_zone`
|
FROM `'._DB_PREFIX_.'carrier_zone`
|
||||||
WHERE `id_carrier` = '.(int)($this->id).'
|
WHERE `id_carrier` = '.(int)($this->id).'
|
||||||
@@ -583,7 +583,7 @@ class CarrierCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function addZone($id_zone)
|
public function addZone($id_zone)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'carrier_zone` (`id_carrier` , `id_zone`)
|
INSERT INTO `'._DB_PREFIX_.'carrier_zone` (`id_carrier` , `id_zone`)
|
||||||
VALUES ('.(int)($this->id).', '.(int)($id_zone).')');
|
VALUES ('.(int)($this->id).', '.(int)($id_zone).')');
|
||||||
}
|
}
|
||||||
@@ -593,7 +593,7 @@ class CarrierCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function deleteZone($id_zone)
|
public function deleteZone($id_zone)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'carrier_zone`
|
DELETE FROM `'._DB_PREFIX_.'carrier_zone`
|
||||||
WHERE `id_carrier` = '.(int)($this->id).'
|
WHERE `id_carrier` = '.(int)($this->id).'
|
||||||
AND `id_zone` = '.(int)($id_zone).' LIMIT 1');
|
AND `id_zone` = '.(int)($id_zone).' LIMIT 1');
|
||||||
@@ -667,7 +667,7 @@ class CarrierCore extends ObjectModel
|
|||||||
$sql = rtrim($sql, ', ').'), ';
|
$sql = rtrim($sql, ', ').'), ';
|
||||||
}
|
}
|
||||||
$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.'`
|
$sql = 'SELECT id_'.$range.' id_range, delimiter1, delimiter2 FROM `'._DB_PREFIX_.$range.'`
|
||||||
WHERE id_carrier = '.(int)$oldId;
|
WHERE id_carrier = '.(int)$oldId;
|
||||||
$res = Db::getInstance()->ExecuteS($sql);
|
$res = Db::getInstance()->executeS($sql);
|
||||||
foreach ($res as $val)
|
foreach ($res as $val)
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO `'._DB_PREFIX_.$range.'` (`id_carrier`, `delimiter1`, `delimiter2`)
|
$sql = 'INSERT INTO `'._DB_PREFIX_.$range.'` (`id_carrier`, `delimiter1`, `delimiter2`)
|
||||||
VALUES ('.$this->id.','.(float)$val['delimiter1'].','.(float)$val['delimiter2'].')';
|
VALUES ('.$this->id.','.(float)$val['delimiter1'].','.(float)$val['delimiter2'].')';
|
||||||
Db::getInstance()->Execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
$rangeID = (int)Db::getInstance()->Insert_ID();
|
$rangeID = (int)Db::getInstance()->Insert_ID();
|
||||||
|
|
||||||
$rangePriceID = ($range == 'range_price') ? $rangeID : 'NULL';
|
$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
|
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'];
|
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
|
// 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);
|
WHERE id_carrier = '.(int)$oldId);
|
||||||
foreach ($res as $val)
|
foreach ($res as $val)
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'carrier_zone` (`id_carrier`, `id_zone`)
|
INSERT INTO `'._DB_PREFIX_.'carrier_zone` (`id_carrier`, `id_zone`)
|
||||||
VALUES ('.$this->id.','.(int)$val['id_zone'].')');
|
VALUES ('.$this->id.','.(int)$val['id_zone'].')');
|
||||||
|
|
||||||
@@ -724,7 +724,7 @@ class CarrierCore extends ObjectModel
|
|||||||
|
|
||||||
// Copy reference
|
// Copy reference
|
||||||
$id_reference = Db::getInstance()->getValue('SELECT `id_reference` FROM `'._DB_PREFIX_.$this->table.'` WHERE id_carrier = '.$oldId);
|
$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.'
|
SET `id_reference` = '.$id_reference.'
|
||||||
WHERE `id_carrier` = '.$this->id);
|
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
|
if ($this->OrderExists()) //NOT delete a cart which is associated with an order
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$uploadedFiles = Db::getInstance()->ExecuteS('
|
$uploadedFiles = Db::getInstance()->executeS('
|
||||||
SELECT cd.`value`
|
SELECT cd.`value`
|
||||||
FROM `'._DB_PREFIX_.'customized_data` cd
|
FROM `'._DB_PREFIX_.'customized_data` cd
|
||||||
INNER JOIN `'._DB_PREFIX_.'customization` c ON (cd.`id_customization`= c.`id_customization`)
|
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']);
|
unlink(_PS_UPLOAD_DIR_.$mustUnlink['value']);
|
||||||
}
|
}
|
||||||
|
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'customized_data`
|
DELETE FROM `'._DB_PREFIX_.'customized_data`
|
||||||
WHERE `id_customization` IN (
|
WHERE `id_customization` IN (
|
||||||
SELECT `id_customization`
|
SELECT `id_customization`
|
||||||
@@ -208,12 +208,12 @@ class CartCore extends ObjectModel
|
|||||||
WHERE `id_cart`='.(int)$this->id.'
|
WHERE `id_cart`='.(int)$this->id.'
|
||||||
)');
|
)');
|
||||||
|
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'customization`
|
DELETE FROM `'._DB_PREFIX_.'customization`
|
||||||
WHERE `id_cart` = '.(int)$this->id);
|
WHERE `id_cart` = '.(int)$this->id);
|
||||||
|
|
||||||
if (!Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cart_discount` 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)))
|
OR !Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'cart_product` WHERE `id_cart` = '.(int)($this->id)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return parent::delete();
|
return parent::delete();
|
||||||
@@ -272,7 +272,7 @@ class CartCore extends ObjectModel
|
|||||||
return self::$_discountsLite[$this->id];
|
return self::$_discountsLite[$this->id];
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT d.*, `id_cart`
|
SELECT d.*, `id_cart`
|
||||||
FROM `'._DB_PREFIX_.'cart_discount` c
|
FROM `'._DB_PREFIX_.'cart_discount` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'discount` d ON c.`id_discount` = d.`id_discount`
|
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');
|
$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
|
// Reset the cache before the following return, or else an empty cart will add dozens of queries
|
||||||
$productsIds = array();
|
$productsIds = array();
|
||||||
@@ -521,7 +521,7 @@ class CartCore extends ObjectModel
|
|||||||
if (!count($paImplode))
|
if (!count($paImplode))
|
||||||
return;
|
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
|
SELECT pac.`id_product_attribute`, agl.`public_name` AS public_group_name, al.`name` AS attribute_name
|
||||||
FROM `'._DB_PREFIX_.'product_attribute_combination` pac
|
FROM `'._DB_PREFIX_.'product_attribute_combination` pac
|
||||||
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
|
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
|
||||||
@@ -661,7 +661,7 @@ class CartCore extends ObjectModel
|
|||||||
elseif ($newQty < $minimalQuantity)
|
elseif ($newQty < $minimalQuantity)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'cart_product`
|
UPDATE `'._DB_PREFIX_.'cart_product`
|
||||||
SET `quantity` = `quantity` '.$qty.', `date_add` = NOW()
|
SET `quantity` = `quantity` '.$qty.', `date_add` = NOW()
|
||||||
WHERE `id_product` = '.(int)$id_product.
|
WHERE `id_product` = '.(int)$id_product.
|
||||||
@@ -720,7 +720,7 @@ class CartCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if ($field['quantity'] == 0)
|
if ($field['quantity'] == 0)
|
||||||
{
|
{
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'customization`
|
UPDATE `'._DB_PREFIX_.'customization`
|
||||||
SET `quantity` = '.(int)($quantity).',
|
SET `quantity` = '.(int)($quantity).',
|
||||||
`id_product_attribute` = '.(int)$id_product_attribute.',
|
`id_product_attribute` = '.(int)$id_product_attribute.',
|
||||||
@@ -740,8 +740,8 @@ class CartCore extends ObjectModel
|
|||||||
if ($result AND Db::getInstance()->NumRows())
|
if ($result AND Db::getInstance()->NumRows())
|
||||||
{
|
{
|
||||||
if ($operator == 'down' AND (int)($result['quantity']) - (int)($quantity) < 1)
|
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('DELETE FROM `'._DB_PREFIX_.'customization` WHERE `id_customization` = '.(int)$id_customization);
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'customization`
|
UPDATE `'._DB_PREFIX_.'customization`
|
||||||
SET `quantity` = `quantity` '.($operator == 'up' ? '+ ' : '- ').(int)($quantity).'
|
SET `quantity` = `quantity` '.($operator == 'up' ? '+ ' : '- ').(int)($quantity).'
|
||||||
WHERE `id_customization` = '.(int)($id_customization));
|
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)
|
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
|
SELECT cu.`id_customization`, cd.`index`, cd.`value`, cd.`type` FROM `'._DB_PREFIX_.'customization` cu
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customized_data` cd
|
LEFT JOIN `'._DB_PREFIX_.'customized_data` cd
|
||||||
ON cu.`id_customization` = cd.`id_customization`
|
ON cu.`id_customization` = cd.`id_customization`
|
||||||
@@ -781,7 +781,7 @@ class CartCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if ($customization['type'] == $type && $customization['index'] == $index)
|
if ($customization['type'] == $type && $customization['index'] == $index)
|
||||||
{
|
{
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'customized_data`
|
DELETE FROM `'._DB_PREFIX_.'customized_data`
|
||||||
WHERE id_customization = '.(int)$customization['id_customization'].'
|
WHERE id_customization = '.(int)$customization['id_customization'].'
|
||||||
AND type = '.(int)$customization['type'].'
|
AND type = '.(int)$customization['type'].'
|
||||||
@@ -798,13 +798,13 @@ class CartCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
else
|
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();
|
$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).'\')';
|
$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 false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -831,7 +831,7 @@ class CartCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function deleteDiscount($id_discount)
|
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 the product still possesses customization it does not have to be deleted */
|
||||||
if (Db::getInstance()->NumRows() AND (int)($result['quantity']))
|
if (Db::getInstance()->NumRows() AND (int)($result['quantity']))
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'cart_product`
|
UPDATE `'._DB_PREFIX_.'cart_product`
|
||||||
SET `quantity` = '.(int)($result['quantity']).'
|
SET `quantity` = '.(int)($result['quantity']).'
|
||||||
WHERE `id_cart` = '.(int)($this->id).'
|
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) : ''));
|
($id_product_attribute != NULL ? ' AND `id_product_attribute` = '.(int)($id_product_attribute) : ''));
|
||||||
|
|
||||||
/* Product deletion */
|
/* 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
|
// refresh cache of self::_products
|
||||||
$this->_products = $this->getProducts(true);
|
$this->_products = $this->getProducts(true);
|
||||||
@@ -924,7 +924,7 @@ class CartCore extends ObjectModel
|
|||||||
WHERE `id_customization` = '.(int)($id_customization));
|
WHERE `id_customization` = '.(int)($id_customization));
|
||||||
|
|
||||||
if($result)
|
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']).'
|
SET `quantity` = `quantity` - '.(int)($customization['quantity']).'
|
||||||
WHERE `id_cart` = '.(int)($this->id).'
|
WHERE `id_cart` = '.(int)($this->id).'
|
||||||
AND `id_product` = '.(int)($id_product).((int)($id_product_attribute) ? '
|
AND `id_product` = '.(int)($id_product).((int)($id_product_attribute) ? '
|
||||||
@@ -933,7 +933,7 @@ class CartCore extends ObjectModel
|
|||||||
if (!$result)
|
if (!$result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return Db::getInstance()->Execute('DELETE
|
return Db::getInstance()->execute('DELETE
|
||||||
FROM `'._DB_PREFIX_.'customization`
|
FROM `'._DB_PREFIX_.'customization`
|
||||||
WHERE `id_customization` = '.(int)($id_customization));
|
WHERE `id_customization` = '.(int)($id_customization));
|
||||||
}
|
}
|
||||||
@@ -1533,13 +1533,13 @@ class CartCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!ProductDownload::isFeatureActive())
|
if (!ProductDownload::isFeatureActive())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!isset(self::$_isVirtualCart[$this->id]))
|
if (!isset(self::$_isVirtualCart[$this->id]))
|
||||||
{
|
{
|
||||||
$products = $this->getProducts();
|
$products = $this->getProducts();
|
||||||
if (!sizeof($products))
|
if (!sizeof($products))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$is_virtual = 1;
|
$is_virtual = 1;
|
||||||
foreach ($products AS $product)
|
foreach ($products AS $product)
|
||||||
{
|
{
|
||||||
@@ -1548,10 +1548,10 @@ class CartCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
self::$_isVirtualCart[$this->id] = (int) $is_virtual;
|
self::$_isVirtualCart[$this->id] = (int) $is_virtual;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$_isVirtualCart[$this->id];
|
return self::$_isVirtualCart[$this->id];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCartByOrderId($id_order)
|
public static function getCartByOrderId($id_order)
|
||||||
{
|
{
|
||||||
if ($id_cart = self::getCartIdByOrderId($id_order))
|
if ($id_cart = self::getCartIdByOrderId($id_order))
|
||||||
@@ -1634,7 +1634,7 @@ class CartCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!Customization::isFeatureActive())
|
if (!Customization::isFeatureActive())
|
||||||
return array();
|
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
|
SELECT cu.id_customization, cd.index, cd.value, cd.type, cu.in_cart, cu.quantity
|
||||||
FROM `'._DB_PREFIX_.'customization` cu
|
FROM `'._DB_PREFIX_.'customization` cu
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customized_data` cd ON (cu.`id_customization` = cd.`id_customization`)
|
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)
|
public static function getCustomerCarts($id_customer)
|
||||||
{
|
{
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM '._DB_PREFIX_.'cart c
|
FROM '._DB_PREFIX_.'cart c
|
||||||
WHERE c.`id_customer` = '.(int)($id_customer).'
|
WHERE c.`id_customer` = '.(int)($id_customer).'
|
||||||
@@ -1676,13 +1676,13 @@ class CartCore extends ObjectModel
|
|||||||
if (!Validate::isLoadedObject($cart))
|
if (!Validate::isLoadedObject($cart))
|
||||||
return false;
|
return false;
|
||||||
$success = true;
|
$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)
|
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));
|
$success &= $cart->updateQty($product['quantity'], (int)$product['id_product'], (int)$product['id_product_attribute'], NULL, 'up', new Shop($cart->id_shop));
|
||||||
|
|
||||||
// Customized products
|
// Customized products
|
||||||
$customs = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$customs = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM '._DB_PREFIX_.'customization c
|
FROM '._DB_PREFIX_.'customization c
|
||||||
LEFT JOIN '._DB_PREFIX_.'customized_data cd ON cd.id_customization = c.id_customization
|
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();
|
$custom_ids = array();
|
||||||
foreach($customsById as $customizationId => $val)
|
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)
|
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'].')');
|
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();
|
$custom_ids[$customizationId] = Db::getInstance(_PS_USE_SQL_SLAVE_)->Insert_ID();
|
||||||
@@ -1720,7 +1720,7 @@ class CartCore extends ObjectModel
|
|||||||
$first = false;
|
$first = false;
|
||||||
$sql_custom_data .= '('.(int)$custom_ids[$custom['id_customization']].', '.(int)$custom['type'].', '.(int)$custom['index'].', \''.pSQL($custom['value']).'\')';
|
$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);
|
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 ';
|
$query = 'INSERT INTO `'._DB_PREFIX_.'cart_product`(`id_cart`, `id_product`, `id_product_attribute`, `quantity`, `date_add`) VALUES ';
|
||||||
foreach ($values as $value)
|
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()),';
|
$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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteAssociations()
|
public function deleteAssociations()
|
||||||
{
|
{
|
||||||
return (Db::getInstance()->Execute('
|
return (Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'cart_product`
|
DELETE FROM `'._DB_PREFIX_.'cart_product`
|
||||||
WHERE `id_cart` = '.(int)($this->id)) !== false);
|
WHERE `id_cart` = '.(int)($this->id)) !== false);
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-35
@@ -269,7 +269,7 @@ class CategoryCore extends ObjectModel
|
|||||||
if (!is_array($toDelete) OR !$id_category)
|
if (!is_array($toDelete) OR !$id_category)
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT `id_category`
|
SELECT `id_category`
|
||||||
FROM `'._DB_PREFIX_.'category`
|
FROM `'._DB_PREFIX_.'category`
|
||||||
WHERE `id_parent` = '.(int)($id_category));
|
WHERE `id_parent` = '.(int)($id_category));
|
||||||
@@ -293,10 +293,10 @@ class CategoryCore extends ObjectModel
|
|||||||
|
|
||||||
/* Delete category and its child from database */
|
/* Delete category and its child from database */
|
||||||
$list = sizeof($toDelete) > 1 ? implode(',', array_map('intval',$toDelete)) : (int)($this->id);
|
$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` 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_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_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_group` WHERE `id_category` IN ('.$list.')');
|
||||||
|
|
||||||
self::cleanPositions($this->id_parent);
|
self::cleanPositions($this->id_parent);
|
||||||
|
|
||||||
@@ -309,7 +309,7 @@ class CategoryCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Delete products which were not in others categories */
|
/* Delete products which were not in others categories */
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT `id_product`
|
SELECT `id_product`
|
||||||
FROM `'._DB_PREFIX_.'product`
|
FROM `'._DB_PREFIX_.'product`
|
||||||
WHERE `id_product` NOT IN (SELECT `id_product` FROM `'._DB_PREFIX_.'category_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 */
|
/* Set category default to 1 where categorie no more exists */
|
||||||
$result = Db::getInstance()->Execute('
|
$result = Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'product`
|
UPDATE `'._DB_PREFIX_.'product`
|
||||||
SET `id_category_default` = 1
|
SET `id_category_default` = 1
|
||||||
WHERE `id_category_default`
|
WHERE `id_category_default`
|
||||||
@@ -379,7 +379,7 @@ class CategoryCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function regenerateEntireNtree()
|
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();
|
$categoriesArray = array();
|
||||||
foreach ($categories AS $category)
|
foreach ($categories AS $category)
|
||||||
$categoriesArray[(int)$category['id_parent']]['subcategories'][(int)$category['id_category']] = 1;
|
$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);
|
self::_subTree($categories, (int)$id_subcategory, $n);
|
||||||
$right = (int)$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)
|
public function recalculateLevelDepth($id_category)
|
||||||
{
|
{
|
||||||
/* Gets all children */
|
/* 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
|
SELECT id_category, id_parent, level_depth
|
||||||
FROM '._DB_PREFIX_.'category
|
FROM '._DB_PREFIX_.'category
|
||||||
WHERE id_parent = '.(int)$id_category);
|
WHERE id_parent = '.(int)$id_category);
|
||||||
@@ -418,7 +418,7 @@ class CategoryCore extends ObjectModel
|
|||||||
/* Updates level_depth for all children */
|
/* Updates level_depth for all children */
|
||||||
foreach ($categories as $sub_category)
|
foreach ($categories as $sub_category)
|
||||||
{
|
{
|
||||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->Execute('
|
Db::getInstance()->execute('
|
||||||
UPDATE '._DB_PREFIX_.'category
|
UPDATE '._DB_PREFIX_.'category
|
||||||
SET level_depth = '.(int)($level['level_depth'] + 1).'
|
SET level_depth = '.(int)($level['level_depth'] + 1).'
|
||||||
WHERE id_category = '.(int)$sub_category['id_category']);
|
WHERE id_category = '.(int)$sub_category['id_category']);
|
||||||
@@ -438,7 +438,7 @@ class CategoryCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!Validate::isBool($active))
|
if (!Validate::isBool($active))
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').'
|
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)
|
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`
|
SELECT c.`id_category`, cl.`name`
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').')
|
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();
|
$groups = FrontController::getCurrentCustomerGroups();
|
||||||
$sqlGroups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
$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
|
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
|
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').')
|
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).'
|
$sql .= ' ORDER BY '.(isset($orderByPrefix) ? $orderByPrefix.'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||||
LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n);
|
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')
|
if ($orderBy == 'orderprice')
|
||||||
Tools::orderbyPrice($result, $orderWay);
|
Tools::orderbyPrice($result, $orderWay);
|
||||||
|
|
||||||
@@ -642,7 +642,7 @@ class CategoryCore extends ObjectModel
|
|||||||
if (!Validate::isBool($active))
|
if (!Validate::isBool($active))
|
||||||
die(Tools::displayError());
|
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`
|
SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').'
|
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()
|
public function getAllChildren()
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'category`
|
FROM `'._DB_PREFIX_.'category`
|
||||||
WHERE '. $this->nleft . ' < nleft AND nright < '. $this->nright);
|
WHERE '. $this->nleft . ' < nleft AND nright < '. $this->nright);
|
||||||
@@ -695,7 +695,7 @@ class CategoryCore extends ObjectModel
|
|||||||
WHERE `id_lang` = '.(int)($id_lang).'
|
WHERE `id_lang` = '.(int)($id_lang).'
|
||||||
AND c.`id_parent` = '.(int)($id_parent).'
|
AND c.`id_parent` = '.(int)($id_parent).'
|
||||||
ORDER BY `position` ASC';
|
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`
|
$sql = 'SELECT `id_category`
|
||||||
FROM `'._DB_PREFIX_.'category_product`
|
FROM `'._DB_PREFIX_.'category_product`
|
||||||
WHERE `id_product` = '.(int)$id_old;
|
WHERE `id_product` = '.(int)$id_old;
|
||||||
$result = Db::getInstance()->ExecuteS($sql);
|
$result = Db::getInstance()->executeS($sql);
|
||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
if ($result)
|
if ($result)
|
||||||
foreach ($result AS $i)
|
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)')).')';
|
$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;
|
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').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').')
|
||||||
WHERE `name` LIKE \''.pSQL($query).'\'');
|
WHERE `name` LIKE \''.pSQL($query).'\'');
|
||||||
else
|
else
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT c.*, cl.*
|
SELECT c.*, cl.*
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
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').')
|
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;
|
$idCurrent = $this->id;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT c.*, cl.*
|
SELECT c.*, cl.*
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
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').')
|
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()
|
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)
|
public function addGroups($groups)
|
||||||
@@ -887,7 +887,7 @@ class CategoryCore extends ObjectModel
|
|||||||
public function getGroups()
|
public function getGroups()
|
||||||
{
|
{
|
||||||
$groups = array();
|
$groups = array();
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT cg.`id_group`
|
SELECT cg.`id_group`
|
||||||
FROM '._DB_PREFIX_.'category_group cg
|
FROM '._DB_PREFIX_.'category_group cg
|
||||||
WHERE cg.`id_category` = '.(int)($this->id));
|
WHERE cg.`id_category` = '.(int)($this->id));
|
||||||
@@ -948,7 +948,7 @@ class CategoryCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!(int)($id_group))
|
if (!(int)($id_group))
|
||||||
return false;
|
return false;
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'category_group`
|
INSERT INTO `'._DB_PREFIX_.'category_group`
|
||||||
VALUES (1, '.(int)($id_group).')
|
VALUES (1, '.(int)($id_group).')
|
||||||
');
|
');
|
||||||
@@ -956,7 +956,7 @@ class CategoryCore extends ObjectModel
|
|||||||
|
|
||||||
public function updatePosition($way, $position)
|
public function updatePosition($way, $position)
|
||||||
{
|
{
|
||||||
if (!$res = Db::getInstance()->ExecuteS('
|
if (!$res = Db::getInstance()->executeS('
|
||||||
SELECT cp.`id_category`, cp.`position`, cp.`id_parent`
|
SELECT cp.`id_category`, cp.`position`, cp.`id_parent`
|
||||||
FROM `'._DB_PREFIX_.'category` cp
|
FROM `'._DB_PREFIX_.'category` cp
|
||||||
WHERE cp.`id_parent` = '.(int)$this->id_parent.'
|
WHERE cp.`id_parent` = '.(int)$this->id_parent.'
|
||||||
@@ -972,7 +972,7 @@ class CategoryCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
// < and > statements rather than BETWEEN operator
|
// < and > statements rather than BETWEEN operator
|
||||||
// since BETWEEN is treated differently according to databases
|
// since BETWEEN is treated differently according to databases
|
||||||
$result = (Db::getInstance()->Execute('
|
$result = (Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'category`
|
UPDATE `'._DB_PREFIX_.'category`
|
||||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||||
WHERE `position`
|
WHERE `position`
|
||||||
@@ -980,7 +980,7 @@ class CategoryCore extends ObjectModel
|
|||||||
? '> '.(int)($movedCategory['position']).' AND `position` <= '.(int)($position)
|
? '> '.(int)($movedCategory['position']).' AND `position` <= '.(int)($position)
|
||||||
: '< '.(int)($movedCategory['position']).' AND `position` >= '.(int)($position)).'
|
: '< '.(int)($movedCategory['position']).' AND `position` >= '.(int)($position)).'
|
||||||
AND `id_parent`='.(int)($movedCategory['id_parent']))
|
AND `id_parent`='.(int)($movedCategory['id_parent']))
|
||||||
AND Db::getInstance()->Execute('
|
AND Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'category`
|
UPDATE `'._DB_PREFIX_.'category`
|
||||||
SET `position` = '.(int)($position).'
|
SET `position` = '.(int)($position).'
|
||||||
WHERE `id_parent` = '.(int)($movedCategory['id_parent']).'
|
WHERE `id_parent` = '.(int)($movedCategory['id_parent']).'
|
||||||
@@ -1001,7 +1001,7 @@ class CategoryCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$return = true;
|
$return = true;
|
||||||
|
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT `id_category`
|
SELECT `id_category`
|
||||||
FROM `'._DB_PREFIX_.'category`
|
FROM `'._DB_PREFIX_.'category`
|
||||||
WHERE `id_parent` = '.(int)($id_category_parent).'
|
WHERE `id_parent` = '.(int)($id_category_parent).'
|
||||||
@@ -1013,7 +1013,7 @@ class CategoryCore extends ObjectModel
|
|||||||
SET `position` = '.(int)($i).'
|
SET `position` = '.(int)($i).'
|
||||||
WHERE `id_parent` = '.(int)($id_category_parent).'
|
WHERE `id_parent` = '.(int)($id_category_parent).'
|
||||||
AND `id_category` = '.(int)($result[$i]['id_category']);
|
AND `id_category` = '.(int)($result[$i]['id_category']);
|
||||||
$return &= Db::getInstance()->Execute($sql);
|
$return &= Db::getInstance()->execute($sql);
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
@@ -1031,7 +1031,7 @@ class CategoryCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getUrlRewriteInformations($id_category)
|
public static function getUrlRewriteInformations($id_category)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT l.`id_lang`, c.`link_rewrite`
|
SELECT l.`id_lang`, c.`link_rewrite`
|
||||||
FROM `'._DB_PREFIX_.'category_lang` AS c
|
FROM `'._DB_PREFIX_.'category_lang` AS c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'lang` AS l ON c.`id_lang` = l.`id_lang`
|
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()
|
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
|
SELECT c.`id_category` as id
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
WHERE c.`id_parent` = '.(int)($this->id).'
|
WHERE c.`id_parent` = '.(int)($this->id).'
|
||||||
@@ -1087,7 +1087,7 @@ class CategoryCore extends ObjectModel
|
|||||||
|
|
||||||
public function getProductsWs()
|
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
|
SELECT cp.`id_product` as id
|
||||||
FROM `'._DB_PREFIX_.'category_product` cp
|
FROM `'._DB_PREFIX_.'category_product` cp
|
||||||
WHERE cp.`id_category` = '.(int)($this->id).'
|
WHERE cp.`id_category` = '.(int)($this->id).'
|
||||||
@@ -1112,7 +1112,7 @@ class CategoryCore extends ObjectModel
|
|||||||
|
|
||||||
public function getWsNbProductsRecursive()
|
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`
|
SELECT count(distinct(id_product)) as nb_product_recursive FROM `'._DB_PREFIX_.'category_product`
|
||||||
WHERE id_category IN (SELECT id_category
|
WHERE id_category IN (SELECT id_category
|
||||||
FROM `'._DB_PREFIX_.'category`
|
FROM `'._DB_PREFIX_.'category`
|
||||||
@@ -1138,7 +1138,7 @@ class CategoryCore extends ObjectModel
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
$categories = array();
|
$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`
|
SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, cl.`id_lang`
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').')
|
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()
|
public function deleteAssociations()
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||||
WHERE `id_product_attribute` = '.(int)($this->id)) === false
|
WHERE `id_product_attribute` = '.(int)($this->id)) === false
|
||||||
)
|
)
|
||||||
@@ -140,7 +140,7 @@ class CombinationCore extends ObjectModel
|
|||||||
$sqlValues = array();
|
$sqlValues = array();
|
||||||
foreach ($values as $value)
|
foreach ($values as $value)
|
||||||
$sqlValues[] = '('.(int)$value['id'].', '.(int)$this->id.')';
|
$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`)
|
INSERT INTO `'._DB_PREFIX_.'product_attribute_combination` (`id_attribute`, `id_product_attribute`)
|
||||||
VALUES '.implode(',', $sqlValues)
|
VALUES '.implode(',', $sqlValues)
|
||||||
);
|
);
|
||||||
@@ -157,7 +157,7 @@ class CombinationCore extends ObjectModel
|
|||||||
|
|
||||||
public function getWsImages()
|
public function getWsImages()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT `id_image` as id
|
SELECT `id_image` as id
|
||||||
FROM `'._DB_PREFIX_.'product_attribute_image`
|
FROM `'._DB_PREFIX_.'product_attribute_image`
|
||||||
WHERE `id_product_attribute` = '.(int)($this->id).'
|
WHERE `id_product_attribute` = '.(int)($this->id).'
|
||||||
@@ -166,14 +166,14 @@ class CombinationCore extends ObjectModel
|
|||||||
|
|
||||||
public function setWsImages($values)
|
public function setWsImages($values)
|
||||||
{
|
{
|
||||||
if (Db::getInstance()->Execute('
|
if (Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'product_attribute_image`
|
DELETE FROM `'._DB_PREFIX_.'product_attribute_image`
|
||||||
WHERE `id_product_attribute` = '.(int)($this->id)) === false)
|
WHERE `id_product_attribute` = '.(int)($this->id)) === false)
|
||||||
return false;
|
return false;
|
||||||
$sqlValues = array();
|
$sqlValues = array();
|
||||||
foreach ($values as $value)
|
foreach ($values as $value)
|
||||||
$sqlValues[] = '('.(int)$this->id.', '.(int)$value['id'].')';
|
$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`)
|
INSERT INTO `'._DB_PREFIX_.'product_attribute_image` (`id_product_attribute`, `id_image`)
|
||||||
VALUES '.implode(',', $sqlValues)
|
VALUES '.implode(',', $sqlValues)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class CompareProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getGuestCompareProducts($id_guest)
|
public static function getGuestCompareProducts($id_guest)
|
||||||
{
|
{
|
||||||
$results = Db::getInstance()->ExecuteS('
|
$results = Db::getInstance()->executeS('
|
||||||
SELECT DISTINCT `id_product`
|
SELECT DISTINCT `id_product`
|
||||||
FROM `'._DB_PREFIX_.'compare_product`
|
FROM `'._DB_PREFIX_.'compare_product`
|
||||||
WHERE `id_guest` = '.(int)($id_guest));
|
WHERE `id_guest` = '.(int)($id_guest));
|
||||||
@@ -84,7 +84,7 @@ class CompareProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function addGuestCompareProduct($id_guest, $id_product)
|
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`)
|
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())
|
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)
|
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)
|
public static function getCustomerCompareProducts($id_customer)
|
||||||
{
|
{
|
||||||
$results = Db::getInstance()->ExecuteS('
|
$results = Db::getInstance()->executeS('
|
||||||
SELECT DISTINCT `id_product`
|
SELECT DISTINCT `id_product`
|
||||||
FROM `'._DB_PREFIX_.'compare_product`
|
FROM `'._DB_PREFIX_.'compare_product`
|
||||||
WHERE `id_customer` = '.(int)($id_customer));
|
WHERE `id_customer` = '.(int)($id_customer));
|
||||||
@@ -145,7 +145,7 @@ class CompareProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function addCustomerCompareProduct($id_customer, $id_product)
|
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`)
|
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())');
|
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)
|
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)
|
if ($interval != null)
|
||||||
{
|
{
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'compare_product`
|
DELETE FROM `'._DB_PREFIX_.'compare_product`
|
||||||
WHERE date_upd < DATE_SUB(NOW(), INTERVAL '.pSQL($interval).')');
|
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
|
$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
|
FROM `'._DB_PREFIX_.'configuration` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'configuration_lang` cl ON (c.id_configuration = cl.id_configuration)';
|
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;
|
return;
|
||||||
|
|
||||||
foreach ($results as $row)
|
foreach ($results as $row)
|
||||||
@@ -307,7 +307,7 @@ class ConfigurationCore extends ObjectModel
|
|||||||
WHERE c.name = \''.pSQL($key).'\''
|
WHERE c.name = \''.pSQL($key).'\''
|
||||||
.Configuration::sqlRestriction($shopGroupID, $shopID)
|
.Configuration::sqlRestriction($shopGroupID, $shopID)
|
||||||
.')';
|
.')';
|
||||||
$result &= Db::getInstance()->Execute($sql);
|
$result &= Db::getInstance()->execute($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If key does not exists, create it
|
// If key does not exists, create it
|
||||||
@@ -361,11 +361,11 @@ class ConfigurationCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'configuration`
|
FROM `'._DB_PREFIX_.'configuration`
|
||||||
WHERE `name` = \''.pSQL($key).'\'
|
WHERE `name` = \''.pSQL($key).'\'
|
||||||
)';
|
)';
|
||||||
$result = Db::getInstance()->Execute($sql);
|
$result = Db::getInstance()->execute($sql);
|
||||||
|
|
||||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'configuration`
|
$sql = 'DELETE FROM `'._DB_PREFIX_.'configuration`
|
||||||
WHERE `name` = \''.pSQL($key).'\'';
|
WHERE `name` = \''.pSQL($key).'\'';
|
||||||
$result2 = Db::getInstance()->Execute($sql);
|
$result2 = Db::getInstance()->execute($sql);
|
||||||
return ($result && $result2);
|
return ($result && $result2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,11 +383,11 @@ class ConfigurationCore extends ObjectModel
|
|||||||
$id = Configuration::getIdByName($key, $shopGroupID, $shopID);
|
$id = Configuration::getIdByName($key, $shopGroupID, $shopID);
|
||||||
$sql = 'DELETE FROM '._DB_PREFIX_.'configuration
|
$sql = 'DELETE FROM '._DB_PREFIX_.'configuration
|
||||||
WHERE id_configuration = '.$id;
|
WHERE id_configuration = '.$id;
|
||||||
Db::getInstance()->Execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
|
|
||||||
$sql = 'DELETE FROM '._DB_PREFIX_.'configuration_lang
|
$sql = 'DELETE FROM '._DB_PREFIX_.'configuration_lang
|
||||||
WHERE id_configuration = '.$id;
|
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_sort != '' ? $sql_sort : '').'
|
||||||
'.($sql_limit != '' ? $sql_limit : '').'
|
'.($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
|
// Limited to 5 minutes because more than 5 minutes is considered as an error
|
||||||
if ($time > 300000)
|
if ($time > 300000)
|
||||||
$time = 300000;
|
$time = 300000;
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'connections_page`
|
UPDATE `'._DB_PREFIX_.'connections_page`
|
||||||
SET `time_end` = `time_start` + INTERVAL '.(int)($time / 1000).' SECOND
|
SET `time_end` = `time_start` + INTERVAL '.(int)($time / 1000).' SECOND
|
||||||
WHERE `id_connections` = '.(int)($id_connections).'
|
WHERE `id_connections` = '.(int)($id_connections).'
|
||||||
@@ -177,7 +177,7 @@ class ConnectionCore extends ObjectModel
|
|||||||
if ($interval != null)
|
if ($interval != null)
|
||||||
{
|
{
|
||||||
// Records of connections details older than the beginning of the specified interval are deleted
|
// 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`
|
DELETE FROM `'._DB_PREFIX_.'connections_page`
|
||||||
WHERE time_start < LAST_DAY(DATE_SUB(NOW(), INTERVAL '.$interval.'))');
|
WHERE time_start < LAST_DAY(DATE_SUB(NOW(), INTERVAL '.$interval.'))');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class ConnectionsSourceCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getOrderSources($id_order)
|
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
|
SELECT cos.http_referer, cos.request_uri, cos.keywords, cos.date_add
|
||||||
FROM '._DB_PREFIX_.'orders o
|
FROM '._DB_PREFIX_.'orders o
|
||||||
INNER JOIN '._DB_PREFIX_.'guest g ON g.id_customer = o.id_customer
|
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`)
|
LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (c.`id_contact` = cl.`id_contact`)
|
||||||
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
||||||
ORDER BY `name` ASC';
|
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)
|
if (!$shop)
|
||||||
$shop = Context::getContext()->shop;
|
$shop = Context::getContext()->shop;
|
||||||
|
|
||||||
$states = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$states = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT s.*
|
SELECT s.*
|
||||||
FROM `'._DB_PREFIX_.'state` s
|
FROM `'._DB_PREFIX_.'state` s
|
||||||
ORDER BY s.`name` ASC');
|
ORDER BY s.`name` ASC');
|
||||||
@@ -140,7 +140,7 @@ class CountryCore extends ObjectModel
|
|||||||
.($active ? ' AND c.active = 1' : '')
|
.($active ? ' AND c.active = 1' : '')
|
||||||
.(!is_null($containStates) ? ' AND c.`contains_states` = '.(int)($containStates) : '').'
|
.(!is_null($containStates) ? ' AND c.`contains_states` = '.(int)($containStates) : '').'
|
||||||
ORDER BY cl.name ASC';
|
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();
|
$countries = array();
|
||||||
foreach ($result AS &$country)
|
foreach ($result AS &$country)
|
||||||
$countries[$country['id_country']] = $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`)
|
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.')
|
WHERE (c.`id_zone` = '.(int)$id_zone.' OR s.`id_zone` = '.(int)$id_zone.')
|
||||||
AND `id_lang` = '.(int)$id_lang;
|
AND `id_lang` = '.(int)$id_lang;
|
||||||
return Db::getInstance()->ExecuteS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isNeedDni()
|
public function isNeedDni()
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ class CurrencyCore extends ObjectModel
|
|||||||
WHERE `deleted` = 0'
|
WHERE `deleted` = 0'
|
||||||
.($active == 1 ? ' AND c.`active` = 1' : '').'
|
.($active == 1 ? ' AND c.`active` = 1' : '').'
|
||||||
ORDER BY `name` ASC';
|
ORDER BY `name` ASC';
|
||||||
$tab = Db::getInstance()->ExecuteS($sql);
|
$tab = Db::getInstance()->executeS($sql);
|
||||||
if ($object)
|
if ($object)
|
||||||
foreach ($tab as $key => $currency)
|
foreach ($tab as $key => $currency)
|
||||||
$tab[$key] = Currency::getCurrencyInstance($currency['id_currency']);
|
$tab[$key] = Currency::getCurrencyInstance($currency['id_currency']);
|
||||||
@@ -222,7 +222,7 @@ class CurrencyCore extends ObjectModel
|
|||||||
AND c.`active` = 1
|
AND c.`active` = 1
|
||||||
AND mc.id_shop = '.(int)$id_shop.'
|
AND mc.id_shop = '.(int)$id_shop.'
|
||||||
ORDER BY c.`name` ASC';
|
ORDER BY c.`name` ASC';
|
||||||
return Db::getInstance()->ExecuteS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function checkPaymentCurrencies($id_module, $id_shop = null)
|
static public function checkPaymentCurrencies($id_module, $id_shop = null)
|
||||||
@@ -234,7 +234,7 @@ class CurrencyCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'module_currency`
|
FROM `'._DB_PREFIX_.'module_currency`
|
||||||
WHERE `id_module` = '.(int)$id_module.'
|
WHERE `id_module` = '.(int)$id_module.'
|
||||||
AND `id_shop` = '.(int)$id_shop;
|
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)
|
public static function getCurrency($id_currency)
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ class CustomerCore extends ObjectModel
|
|||||||
$obj = new Address((int)($address['id_address']));
|
$obj = new Address((int)($address['id_address']));
|
||||||
$obj->delete();
|
$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));
|
Discount::deleteByIdCustomer((int)($this->id));
|
||||||
return parent::delete();
|
return parent::delete();
|
||||||
}
|
}
|
||||||
@@ -217,7 +217,7 @@ class CustomerCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'customer`
|
FROM `'._DB_PREFIX_.'customer`
|
||||||
WHERE 1 '.$shop->sqlRestriction(Shop::SHARE_CUSTOMER).'
|
WHERE 1 '.$shop->sqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||||
ORDER BY `id_customer` ASC';
|
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_.'country_lang` cl ON (c.`id_country` = cl.`id_country`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'state` s ON (s.`id_state` = a.`id_state`)
|
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';
|
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 `lastname` LIKE \'%'.pSQL($query).'%\'
|
||||||
OR `firstname` LIKE \'%'.pSQL($query).'%\'
|
OR `firstname` LIKE \'%'.pSQL($query).'%\'
|
||||||
)'.$shop->sqlRestriction(Shop::SHARE_CUSTOMER);
|
)'.$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()
|
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
|
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
|
FROM `'._DB_PREFIX_.'guest` g
|
||||||
LEFT JOIN `'._DB_PREFIX_.'connections` c ON c.id_guest = g.id_guest
|
LEFT JOIN `'._DB_PREFIX_.'connections` c ON c.id_guest = g.id_guest
|
||||||
@@ -468,7 +468,7 @@ class CustomerCore extends ObjectModel
|
|||||||
|
|
||||||
public function cleanGroups()
|
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)
|
public function addGroups($groups)
|
||||||
@@ -488,7 +488,7 @@ class CustomerCore extends ObjectModel
|
|||||||
if (!isset(self::$_customer_groups[$id_customer]))
|
if (!isset(self::$_customer_groups[$id_customer]))
|
||||||
{
|
{
|
||||||
self::$_customer_groups[$id_customer] = array();
|
self::$_customer_groups[$id_customer] = array();
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT cg.`id_group`
|
SELECT cg.`id_group`
|
||||||
FROM '._DB_PREFIX_.'customer_group cg
|
FROM '._DB_PREFIX_.'customer_group cg
|
||||||
WHERE cg.`id_customer` = '.(int)$id_customer);
|
WHERE cg.`id_customer` = '.(int)$id_customer);
|
||||||
@@ -510,7 +510,7 @@ class CustomerCore extends ObjectModel
|
|||||||
|
|
||||||
public function getBoughtProducts()
|
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
|
SELECT * FROM `'._DB_PREFIX_.'orders` o
|
||||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
|
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));
|
WHERE o.valid = 1 AND o.`id_customer` = '.(int)($this->id));
|
||||||
@@ -543,7 +543,7 @@ class CustomerCore extends ObjectModel
|
|||||||
parent::toggleStatus();
|
parent::toggleStatus();
|
||||||
|
|
||||||
/* Change status to active/inactive */
|
/* Change status to active/inactive */
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
UPDATE `'.pSQL(_DB_PREFIX_.$this->table).'`
|
UPDATE `'.pSQL(_DB_PREFIX_.$this->table).'`
|
||||||
SET `date_upd` = NOW()
|
SET `date_upd` = NOW()
|
||||||
WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class CustomerMessageCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getMessagesByOrderId($id_order, $private = true)
|
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
|
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
|
FROM `'._DB_PREFIX_.'customer_message` cm
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customer_thread` ct ON ct.`id_customer_thread` = cm.`id_customer_thread`
|
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))
|
if (!Validate::isUnsignedId($this->id))
|
||||||
return false;
|
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());
|
return (parent::delete());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCustomerMessages($id_customer)
|
public static function getCustomerMessages($id_customer)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT * FROM '._DB_PREFIX_.'customer_thread ct
|
SELECT * FROM '._DB_PREFIX_.'customer_thread ct
|
||||||
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON ct.id_customer_thread = cm.id_customer_thread
|
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON ct.id_customer_thread = cm.id_customer_thread
|
||||||
WHERE id_customer = '.(int)($id_customer));
|
WHERE id_customer = '.(int)($id_customer));
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class CustomizationCore
|
|||||||
{
|
{
|
||||||
public static function getReturnedCustomizations($id_order)
|
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`
|
SELECT ore.`id_order_return`, ord.`id_order_detail`, ord.`id_customization`, ord.`product_quantity`
|
||||||
FROM `'._DB_PREFIX_.'order_return` ore
|
FROM `'._DB_PREFIX_.'order_return` ore
|
||||||
INNER JOIN `'._DB_PREFIX_.'order_return_detail` ord ON (ord.`id_order_return` = ore.`id_order_return`)
|
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)
|
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;
|
return false;
|
||||||
$customizations = array();
|
$customizations = array();
|
||||||
foreach ($result AS $row)
|
foreach ($result AS $row)
|
||||||
@@ -87,7 +87,7 @@ class CustomizationCore
|
|||||||
|
|
||||||
if (!empty($in_values))
|
if (!empty($in_values))
|
||||||
{
|
{
|
||||||
$results = Db::getInstance()->ExecuteS(
|
$results = Db::getInstance()->executeS(
|
||||||
'SELECT `id_customization`, `id_product`, `quantity`, `quantity_refunded`, `quantity_returned`
|
'SELECT `id_customization`, `id_product`, `quantity`, `quantity_refunded`, `quantity_returned`
|
||||||
FROM `'._DB_PREFIX_.'customization`
|
FROM `'._DB_PREFIX_.'customization`
|
||||||
WHERE `id_customization` IN ('.$in_values.')');
|
WHERE `id_customization` IN ('.$in_values.')');
|
||||||
@@ -103,7 +103,7 @@ class CustomizationCore
|
|||||||
{
|
{
|
||||||
$quantity = array();
|
$quantity = array();
|
||||||
|
|
||||||
$results = Db::getInstance()->ExecuteS('
|
$results = Db::getInstance()->executeS('
|
||||||
SELECT `id_product`, `id_product_attribute`, SUM(`quantity`) AS quantity
|
SELECT `id_product`, `id_product_attribute`, SUM(`quantity`) AS quantity
|
||||||
FROM `'._DB_PREFIX_.'customization`
|
FROM `'._DB_PREFIX_.'customization`
|
||||||
WHERE `id_cart` = '.(int)$id_cart.'
|
WHERE `id_cart` = '.(int)$id_cart.'
|
||||||
|
|||||||
+18
-18
@@ -187,8 +187,8 @@ class DiscountCore extends ObjectModel
|
|||||||
// Refresh cache of feature detachable
|
// Refresh cache of feature detachable
|
||||||
Configuration::updateGlobalValue('PS_DISCOUNT_FEATURE_ACTIVE', self::isCurrentlyUsed($this->table, true));
|
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)) &&
|
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)));
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'discount_category WHERE id_discount = '.(int)($this->id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTranslationsFieldsChild()
|
public function getTranslationsFieldsChild()
|
||||||
@@ -205,7 +205,7 @@ class DiscountCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getDiscountTypes($id_lang)
|
public static function getDiscountTypes($id_lang)
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM '._DB_PREFIX_.'discount_type dt
|
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).')');
|
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)
|
if ($hasStock)
|
||||||
$sql .= ' AND d.`quantity` != 0';
|
$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)
|
foreach ($res as &$discount)
|
||||||
if ($discount['quantity_per_user'])
|
if ($discount['quantity_per_user'])
|
||||||
@@ -390,7 +390,7 @@ class DiscountCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getCategories($id_discount)
|
public static function getCategories($id_discount)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT `id_category`
|
SELECT `id_category`
|
||||||
FROM `'._DB_PREFIX_.'discount_category`
|
FROM `'._DB_PREFIX_.'discount_category`
|
||||||
WHERE `id_discount` = '.(int)($id_discount));
|
WHERE `id_discount` = '.(int)($id_discount));
|
||||||
@@ -404,24 +404,24 @@ class DiscountCore extends ObjectModel
|
|||||||
if ($categories === null)
|
if ($categories === null)
|
||||||
{
|
{
|
||||||
// Compatibility for modules which create discount without setting categories (ex. fidelity, sponsorship)
|
// 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();
|
$categories = array();
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
$categories[] = $row['id_category'];
|
$categories[] = $row['id_category'];
|
||||||
}
|
}
|
||||||
elseif (!is_array($categories) OR !sizeof($categories))
|
elseif (!is_array($categories) OR !sizeof($categories))
|
||||||
return false;
|
return false;
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'discount_category`
|
DELETE FROM `'._DB_PREFIX_.'discount_category`
|
||||||
WHERE `id_discount`='.(int)$this->id);
|
WHERE `id_discount`='.(int)$this->id);
|
||||||
foreach($categories AS $category)
|
foreach($categories AS $category)
|
||||||
{
|
{
|
||||||
Db::getInstance()->ExecuteS('
|
Db::getInstance()->executeS('
|
||||||
SELECT `id_discount`
|
SELECT `id_discount`
|
||||||
FROM `'._DB_PREFIX_.'discount_category`
|
FROM `'._DB_PREFIX_.'discount_category`
|
||||||
WHERE `id_discount`='.(int)($this->id).' AND `id_category`='.(int)($category));
|
WHERE `id_discount`='.(int)($this->id).' AND `id_category`='.(int)($category));
|
||||||
if (Db::getInstance()->NumRows() == 0)
|
if (Db::getInstance()->NumRows() == 0)
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'discount_category` (`id_discount`, `id_category`)
|
INSERT INTO `'._DB_PREFIX_.'discount_category` (`id_discount`, `id_category`)
|
||||||
VALUES('.(int)($this->id).','.(int)($category).')');
|
VALUES('.(int)($this->id).','.(int)($category).')');
|
||||||
}
|
}
|
||||||
@@ -545,29 +545,29 @@ class DiscountCore extends ObjectModel
|
|||||||
|
|
||||||
$sql .= ')'; // close parenthesis openned above
|
$sql .= ')'; // close parenthesis openned above
|
||||||
|
|
||||||
return Db::getInstance()->ExecuteS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteByIdCustomer($id_customer)
|
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)
|
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` 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_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_lang` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteByIdGroup($id_group)
|
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)
|
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` 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_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_lang` WHERE `id_discount` = '.(int)($discount['id_discount']));
|
||||||
}
|
}
|
||||||
return true;
|
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').')
|
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.'
|
WHERE id_lang = '.(int)$context->language->id.'
|
||||||
ORDER BY LENGTH(ml.url_rewrite) DESC';
|
ORDER BY LENGTH(ml.url_rewrite) DESC';
|
||||||
if ($results = Db::getInstance()->ExecuteS($sql))
|
if ($results = Db::getInstance()->executeS($sql))
|
||||||
foreach ($results as $row)
|
foreach ($results as $row)
|
||||||
{
|
{
|
||||||
if ($row['url_rewrite'])
|
if ($row['url_rewrite'])
|
||||||
|
|||||||
+10
-10
@@ -86,7 +86,7 @@ class FeatureCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getFeatures($id_lang)
|
public static function getFeatures($id_lang)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'feature` f
|
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).')
|
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()
|
public function delete()
|
||||||
{
|
{
|
||||||
/* Also delete related attributes */
|
/* 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_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` WHERE `id_feature` = '.(int)($this->id));
|
||||||
/* Also delete related products */
|
/* 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();
|
$return = parent::delete();
|
||||||
if($return)
|
if($return)
|
||||||
@@ -215,7 +215,7 @@ class FeatureCore extends ObjectModel
|
|||||||
if (empty($ids))
|
if (empty($ids))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT * , COUNT(*) as nb
|
SELECT * , COUNT(*) as nb
|
||||||
FROM `'._DB_PREFIX_.'feature` f
|
FROM `'._DB_PREFIX_.'feature` f
|
||||||
LEFT JOIN `'._DB_PREFIX_.'feature_product` fp ON f.`id_feature` = fp.`id_feature`
|
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)
|
public function updatePosition($way, $position)
|
||||||
{
|
{
|
||||||
if (!$res = Db::getInstance()->ExecuteS('
|
if (!$res = Db::getInstance()->executeS('
|
||||||
SELECT `position`, `id_feature`
|
SELECT `position`, `id_feature`
|
||||||
FROM `'._DB_PREFIX_.'feature`
|
FROM `'._DB_PREFIX_.'feature`
|
||||||
WHERE `id_feature` = '.(int)Tools::getValue('id_feature', 1).'
|
WHERE `id_feature` = '.(int)Tools::getValue('id_feature', 1).'
|
||||||
@@ -261,14 +261,14 @@ class FeatureCore extends ObjectModel
|
|||||||
|
|
||||||
// < and > statements rather than BETWEEN operator
|
// < and > statements rather than BETWEEN operator
|
||||||
// since BETWEEN is treated differently according to databases
|
// since BETWEEN is treated differently according to databases
|
||||||
return (Db::getInstance()->Execute('
|
return (Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'feature`
|
UPDATE `'._DB_PREFIX_.'feature`
|
||||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||||
WHERE `position`
|
WHERE `position`
|
||||||
'.($way
|
'.($way
|
||||||
? '> '.(int)$movedFeature['position'].' AND `position` <= '.(int)$position
|
? '> '.(int)$movedFeature['position'].' AND `position` <= '.(int)$position
|
||||||
: '< '.(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`
|
UPDATE `'._DB_PREFIX_.'feature`
|
||||||
SET `position` = '.(int)$position.'
|
SET `position` = '.(int)$position.'
|
||||||
WHERE `id_feature`='.(int)$movedFeature['id_feature']));
|
WHERE `id_feature`='.(int)$movedFeature['id_feature']));
|
||||||
@@ -288,11 +288,11 @@ class FeatureCore extends ObjectModel
|
|||||||
SELECT `id_feature`
|
SELECT `id_feature`
|
||||||
FROM `'._DB_PREFIX_.'feature`
|
FROM `'._DB_PREFIX_.'feature`
|
||||||
ORDER BY `position`';
|
ORDER BY `position`';
|
||||||
$result = Db::getInstance()->ExecuteS($sql);
|
$result = Db::getInstance()->executeS($sql);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($result as $value)
|
foreach ($result as $value)
|
||||||
$return = Db::getInstance()->Execute('
|
$return = Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'feature`
|
UPDATE `'._DB_PREFIX_.'feature`
|
||||||
SET `position` = '.(int)$i++.'
|
SET `position` = '.(int)$i++.'
|
||||||
WHERE `id_feature` = '.(int)$value['id_feature']);
|
WHERE `id_feature` = '.(int)$value['id_feature']);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class FeatureValueCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getFeatureValues($id_feature)
|
public static function getFeatureValues($id_feature)
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'feature_value`
|
FROM `'._DB_PREFIX_.'feature_value`
|
||||||
WHERE `id_feature` = '.(int)$id_feature);
|
WHERE `id_feature` = '.(int)$id_feature);
|
||||||
@@ -99,7 +99,7 @@ class FeatureValueCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getFeatureValuesWithLang($id_lang, $id_feature)
|
public static function getFeatureValuesWithLang($id_lang, $id_feature)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'feature_value` v
|
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.')
|
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)
|
public static function getFeatureValueLang($id_feature_value)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'feature_value_lang`
|
FROM `'._DB_PREFIX_.'feature_value_lang`
|
||||||
WHERE `id_feature_value` = '.(int)$id_feature_value.'
|
WHERE `id_feature_value` = '.(int)$id_feature_value.'
|
||||||
@@ -140,7 +140,7 @@ class FeatureValueCore extends ObjectModel
|
|||||||
|
|
||||||
public static function addFeatureValueImport($id_feature, $name)
|
public static function addFeatureValueImport($id_feature, $name)
|
||||||
{
|
{
|
||||||
$rq = Db::getInstance()->ExecuteS('
|
$rq = Db::getInstance()->executeS('
|
||||||
SELECT fv.`id_feature_value`
|
SELECT fv.`id_feature_value`
|
||||||
FROM '._DB_PREFIX_.'feature_value fv
|
FROM '._DB_PREFIX_.'feature_value fv
|
||||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value`)
|
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()
|
public function delete()
|
||||||
{
|
{
|
||||||
/* Also delete related products */
|
/* 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();
|
$return = parent::delete();
|
||||||
|
|
||||||
if ($return)
|
if ($return)
|
||||||
|
|||||||
@@ -641,7 +641,7 @@ class FrontControllerCore extends Controller
|
|||||||
if (!is_array(self::$currentCustomerGroups))
|
if (!is_array(self::$currentCustomerGroups))
|
||||||
{
|
{
|
||||||
self::$currentCustomerGroups = array();
|
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)
|
foreach ($result as $row)
|
||||||
self::$currentCustomerGroups[] = $row['id_group'];
|
self::$currentCustomerGroups[] = $row['id_group'];
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -80,7 +80,7 @@ class GenderCore extends ObjectModel
|
|||||||
$sql = 'SELECT g.*, gl.*
|
$sql = 'SELECT g.*, gl.*
|
||||||
FROM '._DB_PREFIX_.'gender g
|
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;
|
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);
|
return ObjectModel::hydrateCollection('Gender', $results, $id_lang);
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-12
@@ -84,7 +84,7 @@ class GroupCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getGroups($id_lang)
|
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`
|
SELECT g.`id_group`, g.`reduction`, g.`price_display_method`, gl.`name`
|
||||||
FROM `'._DB_PREFIX_.'group` g
|
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).')
|
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`)
|
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (cg.`id_customer` = c.`id_customer`)
|
||||||
WHERE cg.`id_group` = '.(int)$this->id.'
|
WHERE cg.`id_group` = '.(int)$this->id.'
|
||||||
AND c.`deleted` != 1');
|
AND c.`deleted` != 1');
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT cg.`id_customer`, c.*
|
SELECT cg.`id_customer`, c.*
|
||||||
FROM `'._DB_PREFIX_.'customer_group` cg
|
FROM `'._DB_PREFIX_.'customer_group` cg
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (cg.`id_customer` = c.`id_customer`)
|
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (cg.`id_customer` = c.`id_customer`)
|
||||||
@@ -166,10 +166,10 @@ class GroupCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
if (parent::delete())
|
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_.'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_.'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_.'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_.'product_group_reduction_cache` WHERE `id_group` = '.(int)$this->id);
|
||||||
$this->truncateRestrictionsModules($this->id);
|
$this->truncateRestrictionsModules($this->id);
|
||||||
Discount::deleteByIdGroup((int)$this->id);
|
Discount::deleteByIdGroup((int)$this->id);
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ class GroupCore extends ObjectModel
|
|||||||
Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', self::isCurrentlyUsed());
|
Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', self::isCurrentlyUsed());
|
||||||
|
|
||||||
// Add default group (id 1) to customers without groups
|
// 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
|
SELECT c.id_customer, 1 FROM `'._DB_PREFIX_.'customer` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customer_group` cg
|
LEFT JOIN `'._DB_PREFIX_.'customer_group` cg
|
||||||
ON cg.id_customer = c.id_customer
|
ON cg.id_customer = c.id_customer
|
||||||
@@ -185,7 +185,7 @@ class GroupCore extends ObjectModel
|
|||||||
|
|
||||||
// Set to the customer the default group
|
// Set to the customer the default group
|
||||||
// Select the minimal id from customer_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 =
|
SET id_default_group =
|
||||||
IFNULL((
|
IFNULL((
|
||||||
SELECT min(id_group) FROM `'._DB_PREFIX_.'customer_group`
|
SELECT min(id_group) FROM `'._DB_PREFIX_.'customer_group`
|
||||||
@@ -234,7 +234,7 @@ class GroupCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function truncateModulesRestrictions($id_group)
|
public static function truncateModulesRestrictions($id_group)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'group_module_restriction`
|
DELETE FROM `'._DB_PREFIX_.'group_module_restriction`
|
||||||
WHERE `id_group` = '.(int)$id_group);
|
WHERE `id_group` = '.(int)$id_group);
|
||||||
}
|
}
|
||||||
@@ -246,7 +246,7 @@ class GroupCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function truncateRestrictionsByModule($id_module)
|
public static function truncateRestrictionsByModule($id_module)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'group_module_restriction`
|
DELETE FROM `'._DB_PREFIX_.'group_module_restriction`
|
||||||
WHERE `id_module` = '.(int)$id_module);
|
WHERE `id_module` = '.(int)$id_module);
|
||||||
}
|
}
|
||||||
@@ -268,7 +268,7 @@ class GroupCore extends ObjectModel
|
|||||||
$sql .= '("'.(int)$id_group.'", "'.(int)Module::getModuleIdByName($mod).'", "'.(int)$authorized.'"),';
|
$sql .= '("'.(int)$id_group.'", "'.(int)Module::getModuleIdByName($mod).'", "'.(int)$authorized.'"),';
|
||||||
// removing last comma to avoid SQL error
|
// removing last comma to avoid SQL error
|
||||||
$sql = substr($sql, 0, strlen($sql) - 1);
|
$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"),';
|
$sql .= '("'.(int)$g['id_group'].'", "'.(int)$id_module.'", "1"),';
|
||||||
// removing last comma to avoid SQL error
|
// removing last comma to avoid SQL error
|
||||||
$sql = substr($sql, 0, strlen($sql) - 1);
|
$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()
|
public function delete()
|
||||||
{
|
{
|
||||||
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT p.`id_product`
|
SELECT p.`id_product`
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
WHERE p.`id_category_default` = '.(int)($this->id_category)
|
WHERE p.`id_category_default` = '.(int)($this->id_category)
|
||||||
@@ -69,7 +69,7 @@ class GroupReductionCore extends ObjectModel
|
|||||||
while ($row = Db::getInstance()->nextRow($resource))
|
while ($row = Db::getInstance()->nextRow($resource))
|
||||||
{
|
{
|
||||||
$query = 'DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_product` = '.(int)($row['id_product']);
|
$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 false;
|
||||||
}
|
}
|
||||||
return (parent::delete());
|
return (parent::delete());
|
||||||
@@ -77,12 +77,12 @@ class GroupReductionCore extends ObjectModel
|
|||||||
|
|
||||||
protected function _clearCache()
|
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()
|
protected function _setCache()
|
||||||
{
|
{
|
||||||
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT p.`id_product`
|
SELECT p.`id_product`
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
WHERE p.`id_category_default` = '.(int)($this->id_category)
|
WHERE p.`id_category_default` = '.(int)($this->id_category)
|
||||||
@@ -97,13 +97,13 @@ class GroupReductionCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($updated)
|
if ($updated)
|
||||||
return (Db::getInstance()->Execute(rtrim($query, ', ')));
|
return (Db::getInstance()->execute(rtrim($query, ', ')));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _updateCache()
|
protected function _updateCache()
|
||||||
{
|
{
|
||||||
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT p.`id_product`
|
SELECT p.`id_product`
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
WHERE p.`id_category_default` = '.(int)($this->id_category)
|
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`
|
$query = 'UPDATE `'._DB_PREFIX_.'product_group_reduction_cache`
|
||||||
SET `reduction` = '.(float)($this->reduction).'
|
SET `reduction` = '.(float)($this->reduction).'
|
||||||
WHERE `id_product` = '.(int)($row['id_product']).' AND `id_group` = '.(int)($this->id_group);
|
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 false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -122,7 +122,7 @@ class GroupReductionCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getGroupReductions($id_group, $id_lang)
|
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
|
SELECT gr.`id_group_reduction`, gr.`id_group`, gr.`id_category`, gr.`reduction`, cl.`name` AS category_name
|
||||||
FROM `'._DB_PREFIX_.'group_reduction` gr
|
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').')
|
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).'
|
SET `reduction` = '.(float)($reduction).'
|
||||||
WHERE `id_product` = '.(int)($id_product).' AND `id_group` = '.(int)($id_group);
|
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)
|
public static function deleteProductReduction($id_product)
|
||||||
{
|
{
|
||||||
$query = 'DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_product` = '.(int)($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 false;
|
||||||
return true;
|
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 = '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']).')';
|
$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)
|
public static function deleteCategory($id_category)
|
||||||
{
|
{
|
||||||
$query = 'DELETE FROM `'._DB_PREFIX_.'group_reduction` WHERE `id_category` = '.(int)($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 false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -179,7 +179,7 @@ class GuestCore extends ObjectModel
|
|||||||
public function mergeWithCustomer($id_guest, $id_customer)
|
public function mergeWithCustomer($id_guest, $id_customer)
|
||||||
{
|
{
|
||||||
// Since the guests are merged, the guest id in the connections table must be changed too
|
// 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
|
UPDATE `'._DB_PREFIX_.'connections` c
|
||||||
SET c.`id_guest` = '.(int)($id_guest).'
|
SET c.`id_guest` = '.(int)($id_guest).'
|
||||||
WHERE c.`id_guest` = '.(int)($this->id));
|
WHERE c.`id_guest` = '.(int)($this->id));
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class HelpAccessCore
|
|||||||
|
|
||||||
public static function trackClick($label, $version)
|
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).'\')
|
INSERT INTO `'._DB_PREFIX_.'help_access` (`label`, `version`) VALUES (\''.pSQL($label).'\',\''.pSQL($version).'\')
|
||||||
ON DUPLICATE KEY UPDATE `version` = \''.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)
|
static public function getHooks($position = false)
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'hook` h
|
FROM `'._DB_PREFIX_.'hook` h
|
||||||
'.($position ? 'WHERE h.`position` = 1' : ''));
|
'.($position ? 'WHERE h.`position` = 1' : ''));
|
||||||
|
|||||||
+11
-11
@@ -102,7 +102,7 @@ class ImageCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// update positions
|
// update positions
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'image`
|
FROM `'._DB_PREFIX_.'image`
|
||||||
WHERE `id_product` = '.(int)$this->id_product.'
|
WHERE `id_product` = '.(int)$this->id_product.'
|
||||||
@@ -127,7 +127,7 @@ class ImageCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getImages($id_lang, $id_product)
|
public static function getImages($id_lang, $id_product)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'image` i
|
FROM `'._DB_PREFIX_.'image` i
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`)
|
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()
|
public static function getAllImages()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT `id_image`, `id_product`
|
SELECT `id_image`, `id_product`
|
||||||
FROM `'._DB_PREFIX_.'image`
|
FROM `'._DB_PREFIX_.'image`
|
||||||
ORDER BY `id_image` ASC');
|
ORDER BY `id_image` ASC');
|
||||||
@@ -191,7 +191,7 @@ class ImageCore extends ObjectModel
|
|||||||
|
|
||||||
if (file_exists(_PS_TMP_IMG_DIR_.'product_'.$id_product.'.jpg'))
|
if (file_exists(_PS_TMP_IMG_DIR_.'product_'.$id_product.'.jpg'))
|
||||||
unlink(_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`
|
UPDATE `'._DB_PREFIX_.'image`
|
||||||
SET `cover` = 0
|
SET `cover` = 0
|
||||||
WHERE `id_product` = '.(int)($id_product));
|
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)
|
public static function duplicateProductImages($id_product_old, $id_product_new, $combinationImages)
|
||||||
{
|
{
|
||||||
$imagesTypes = ImageType::getImagesTypes('products');
|
$imagesTypes = ImageType::getImagesTypes('products');
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT `id_image`
|
SELECT `id_image`
|
||||||
FROM `'._DB_PREFIX_.'image`
|
FROM `'._DB_PREFIX_.'image`
|
||||||
WHERE `id_product` = '.(int)($id_product_old));
|
WHERE `id_product` = '.(int)($id_product_old));
|
||||||
@@ -298,18 +298,18 @@ class ImageCore extends ObjectModel
|
|||||||
// temporary position
|
// temporary position
|
||||||
$high_position = Image::getHighestPosition($this->id_product) + 1;
|
$high_position = Image::getHighestPosition($this->id_product) + 1;
|
||||||
|
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'image`
|
UPDATE `'._DB_PREFIX_.'image`
|
||||||
SET `position` = '.(int)($high_position).'
|
SET `position` = '.(int)($high_position).'
|
||||||
WHERE `id_product` = '.(int)($this->id_product).'
|
WHERE `id_product` = '.(int)($this->id_product).'
|
||||||
AND `position` = '.($direction ? $position - 1 : $position + 1));
|
AND `position` = '.($direction ? $position - 1 : $position + 1));
|
||||||
|
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'image`
|
UPDATE `'._DB_PREFIX_.'image`
|
||||||
SET `position` = `position`'.($direction ? '-1' : '+1').'
|
SET `position` = `position`'.($direction ? '-1' : '+1').'
|
||||||
WHERE `id_image` = '.(int)($this->id));
|
WHERE `id_image` = '.(int)($this->id));
|
||||||
|
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'image`
|
UPDATE `'._DB_PREFIX_.'image`
|
||||||
SET `position` = '.$this->position.'
|
SET `position` = '.$this->position.'
|
||||||
WHERE `id_product` = '.(int)($this->id_product).'
|
WHERE `id_product` = '.(int)($this->id_product).'
|
||||||
@@ -330,7 +330,7 @@ class ImageCore extends ObjectModel
|
|||||||
|
|
||||||
// < and > statements rather than BETWEEN operator
|
// < and > statements rather than BETWEEN operator
|
||||||
// since BETWEEN is treated differently according to databases
|
// since BETWEEN is treated differently according to databases
|
||||||
$result = (Db::getInstance()->Execute('
|
$result = (Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'image`
|
UPDATE `'._DB_PREFIX_.'image`
|
||||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||||
WHERE `position`
|
WHERE `position`
|
||||||
@@ -338,7 +338,7 @@ class ImageCore extends ObjectModel
|
|||||||
? '> '.(int)($this->position).' AND `position` <= '.(int)($position)
|
? '> '.(int)($this->position).' AND `position` <= '.(int)($position)
|
||||||
: '< '.(int)($this->position).' AND `position` >= '.(int)($position)).'
|
: '< '.(int)($this->position).' AND `position` >= '.(int)($position)).'
|
||||||
AND `id_product`='.(int)($this->id_product))
|
AND `id_product`='.(int)($this->id_product))
|
||||||
&& Db::getInstance()->Execute('
|
&& Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'image`
|
UPDATE `'._DB_PREFIX_.'image`
|
||||||
SET `position` = '.(int)($position).'
|
SET `position` = '.(int)($position).'
|
||||||
WHERE `id_image` = '.(int)($this->id_image)));
|
WHERE `id_image` = '.(int)($this->id_image)));
|
||||||
@@ -367,7 +367,7 @@ class ImageCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function deleteProductAttributeImage()
|
public function deleteProductAttributeImage()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
DELETE
|
DELETE
|
||||||
FROM `'._DB_PREFIX_.'product_attribute_image`
|
FROM `'._DB_PREFIX_.'product_attribute_image`
|
||||||
WHERE `id_image` = '.(int)($this->id)
|
WHERE `id_image` = '.(int)($this->id)
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class ImageTypeCore extends ObjectModel
|
|||||||
$where = '';
|
$where = '';
|
||||||
|
|
||||||
$query = 'SELECT * FROM `'._DB_PREFIX_.'image_type`'.$where.'ORDER BY `name` ASC';
|
$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];
|
return self::$images_types_cache[$type];
|
||||||
@@ -128,7 +128,7 @@ class ImageTypeCore extends ObjectModel
|
|||||||
if (!Validate::isImageTypeName($typeName))
|
if (!Validate::isImageTypeName($typeName))
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
Db::getInstance()->ExecuteS('
|
Db::getInstance()->executeS('
|
||||||
SELECT `id_image_type`
|
SELECT `id_image_type`
|
||||||
FROM `'._DB_PREFIX_.'image_type`
|
FROM `'._DB_PREFIX_.'image_type`
|
||||||
WHERE `name` = \''.pSQL($typeName).'\'');
|
WHERE `name` = \''.pSQL($typeName).'\'');
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ abstract class ImportModuleCore extends Module
|
|||||||
public function getValue($query)
|
public function getValue($query)
|
||||||
{
|
{
|
||||||
$this->initDatabaseConnection();
|
$this->initDatabaseConnection();
|
||||||
$result = $this->ExecuteS($query);
|
$result = $this->executeS($query);
|
||||||
if (!sizeof($result))
|
if (!sizeof($result))
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
|
|||||||
+15
-15
@@ -346,7 +346,7 @@ class LanguageCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function loadUpdateSQL()
|
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();
|
$langTables = array();
|
||||||
|
|
||||||
foreach($tables as $table)
|
foreach($tables as $table)
|
||||||
@@ -354,12 +354,12 @@ class LanguageCore extends ObjectModel
|
|||||||
if ($t != _DB_PREFIX_.'configuration_lang')
|
if ($t != _DB_PREFIX_.'configuration_lang')
|
||||||
$langTables[] = $t;
|
$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;
|
$return = true;
|
||||||
foreach($langTables as $name)
|
foreach($langTables as $name)
|
||||||
{
|
{
|
||||||
$fields = '';
|
$fields = '';
|
||||||
$columns = Db::getInstance()->ExecuteS('SHOW COLUMNS FROM `'.$name.'`');
|
$columns = Db::getInstance()->executeS('SHOW COLUMNS FROM `'.$name.'`');
|
||||||
foreach($columns as $column)
|
foreach($columns as $column)
|
||||||
$fields .= $column['Field'].', ';
|
$fields .= $column['Field'].', ';
|
||||||
$fields = rtrim($fields, ', ');
|
$fields = rtrim($fields, ', ');
|
||||||
@@ -374,7 +374,7 @@ class LanguageCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
$sql = rtrim($sql, ', ');
|
$sql = rtrim($sql, ', ');
|
||||||
$sql .= ' FROM `'._DB_PREFIX_.'lang` CROSS JOIN `'.str_replace('_lang', '', $name).'`) ;';
|
$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;
|
return $return;
|
||||||
}
|
}
|
||||||
@@ -404,17 +404,17 @@ class LanguageCore extends ObjectModel
|
|||||||
$this->iso_code = self::getIsoById($this->id);
|
$this->iso_code = self::getIsoById($this->id);
|
||||||
|
|
||||||
// Database translations deletion
|
// 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)
|
foreach ($result AS $row)
|
||||||
if (preg_match('/_lang/', $row['Tables_in_'._DB_NAME_]))
|
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;
|
return false;
|
||||||
|
|
||||||
// Delete tags
|
// 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
|
// 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
|
// Files deletion
|
||||||
foreach (self::getFilesList($this->iso_code, _THEME_NAME_, false, false, false, true, true) as $key => $file)
|
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)
|
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)
|
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)
|
foreach ($result AS $row)
|
||||||
if (preg_match('/_lang/', $row['Tables_in_'._DB_NAME_]) AND $row['Tables_in_'._DB_NAME_] != _DB_PREFIX_.'lang')
|
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))
|
if (!sizeof($result2))
|
||||||
continue;
|
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 ';
|
$query = 'INSERT INTO `'.$row['Tables_in_'._DB_NAME_].'` VALUES ';
|
||||||
foreach ($result2 AS $row2)
|
foreach ($result2 AS $row2)
|
||||||
{
|
{
|
||||||
@@ -590,7 +590,7 @@ class LanguageCore extends ObjectModel
|
|||||||
$query = rtrim($query, ',').'),';
|
$query = rtrim($query, ',').'),';
|
||||||
}
|
}
|
||||||
$query = rtrim($query, ',');
|
$query = rtrim($query, ',');
|
||||||
Db::getInstance()->Execute($query);
|
Db::getInstance()->execute($query);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -605,7 +605,7 @@ class LanguageCore extends ObjectModel
|
|||||||
$sql = 'SELECT l.*, ls.`id_shop`
|
$sql = 'SELECT l.*, ls.`id_shop`
|
||||||
FROM `'._DB_PREFIX_.'lang` l
|
FROM `'._DB_PREFIX_.'lang` l
|
||||||
LEFT JOIN `'._DB_PREFIX_.'lang_shop` ls ON (l.id_lang = ls.id_lang)';
|
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)
|
foreach ($result AS $row)
|
||||||
{
|
{
|
||||||
if (!isset(self::$_LANGUAGES[(int)$row['id_lang']]))
|
if (!isset(self::$_LANGUAGES[(int)$row['id_lang']]))
|
||||||
@@ -702,7 +702,7 @@ class LanguageCore extends ObjectModel
|
|||||||
if (self::$_cache_language_installation === null)
|
if (self::$_cache_language_installation === null)
|
||||||
{
|
{
|
||||||
self::$_cache_language_installation = array();
|
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)
|
foreach ($result as $row)
|
||||||
self::$_cache_language_installation[$row['iso_code']] = $row['id_lang'];
|
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).')
|
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' : '');
|
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) : '');
|
$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)
|
if ($manufacturers === false)
|
||||||
return false;
|
return false;
|
||||||
if ($getNbProducts)
|
if ($getNbProducts)
|
||||||
@@ -190,7 +190,7 @@ class ManufacturerCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
foreach ($manufacturers as $key => $manufacturer)
|
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
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` as m ON (m.`id_manufacturer`= p.`id_manufacturer`)
|
LEFT JOIN `'._DB_PREFIX_.'manufacturer` as m ON (m.`id_manufacturer`= p.`id_manufacturer`)
|
||||||
WHERE m.`id_manufacturer` = '.(int)($manufacturer['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' : '').'
|
($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
|
||||||
WHERE cg.`id_group` '.$sqlGroups.'
|
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));
|
return (int)(sizeof($result));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,7 +303,7 @@ class ManufacturerCore extends ObjectModel
|
|||||||
ORDER BY '.(($orderBy == 'id_product') ? 'p.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
ORDER BY '.(($orderBy == 'id_product') ? 'p.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||||
LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n;
|
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)
|
if (!$result)
|
||||||
return false;
|
return false;
|
||||||
if ($orderBy == 'price')
|
if ($orderBy == 'price')
|
||||||
@@ -317,7 +317,7 @@ class ManufacturerCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'product` p
|
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').')
|
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;
|
WHERE p.`id_manufacturer` = '.(int)$this->id;
|
||||||
return Db::getInstance()->ExecuteS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Specify if a manufacturer already in base
|
* Specify if a manufacturer already in base
|
||||||
@@ -337,7 +337,7 @@ class ManufacturerCore extends ObjectModel
|
|||||||
|
|
||||||
public function getAddresses($id_lang)
|
public function getAddresses($id_lang)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT a.*, cl.name AS `country`, s.name AS `state`
|
SELECT a.*, cl.name AS `country`, s.name AS `state`
|
||||||
FROM `'._DB_PREFIX_.'address` AS a
|
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).')
|
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()
|
public function getWsAddresses()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT a.id_address as id
|
SELECT a.id_address as id
|
||||||
FROM `'._DB_PREFIX_.'address` AS a
|
FROM `'._DB_PREFIX_.'address` AS a
|
||||||
WHERE `id_manufacturer` = '.(int)($this->id).'
|
WHERE `id_manufacturer` = '.(int)($this->id).'
|
||||||
@@ -360,14 +360,14 @@ class ManufacturerCore extends ObjectModel
|
|||||||
$ids = array();
|
$ids = array();
|
||||||
foreach ($id_addresses as $id)
|
foreach ($id_addresses as $id)
|
||||||
$ids[] = (int)$id['id'];
|
$ids[] = (int)$id['id'];
|
||||||
$result1 = (Db::getInstance()->Execute('
|
$result1 = (Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'address`
|
UPDATE `'._DB_PREFIX_.'address`
|
||||||
SET id_manufacturer = 0
|
SET id_manufacturer = 0
|
||||||
WHERE id_manufacturer = '.(int)$this->id.'
|
WHERE id_manufacturer = '.(int)$this->id.'
|
||||||
AND deleted = 0') !== false);
|
AND deleted = 0') !== false);
|
||||||
$result2 = true;
|
$result2 = true;
|
||||||
if (count($ids))
|
if (count($ids))
|
||||||
$result2 = (Db::getInstance()->Execute('
|
$result2 = (Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'address`
|
UPDATE `'._DB_PREFIX_.'address`
|
||||||
SET id_customer = 0, id_supplier = 0, id_manufacturer = '.(int)$this->id.'
|
SET id_customer = 0, id_supplier = 0, id_manufacturer = '.(int)$this->id.'
|
||||||
WHERE id_address IN('.implode(',', $ids).')
|
WHERE id_address IN('.implode(',', $ids).')
|
||||||
|
|||||||
+3
-3
@@ -106,7 +106,7 @@ class MessageCore extends ObjectModel
|
|||||||
if (!$context)
|
if (!$context)
|
||||||
$context = Context::getContext();
|
$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
|
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
|
FROM `'._DB_PREFIX_.'message` m
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON m.`id_customer` = c.`id_customer`
|
LEFT JOIN `'._DB_PREFIX_.'customer` c ON m.`id_customer` = c.`id_customer`
|
||||||
@@ -133,7 +133,7 @@ class MessageCore extends ObjectModel
|
|||||||
if (!$context)
|
if (!$context)
|
||||||
$context = Context::getContext();
|
$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
|
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
|
FROM `'._DB_PREFIX_.'message` m
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON m.`id_customer` = c.`id_customer`
|
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))
|
if (!Validate::isUnsignedId($id_message) OR !Validate::isUnsignedId($id_employee))
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
$result = Db::getInstance()->Execute('
|
$result = Db::getInstance()->execute('
|
||||||
INSERT INTO '._DB_PREFIX_.'message_readed (id_message , id_employee , date_add) VALUES
|
INSERT INTO '._DB_PREFIX_.'message_readed (id_message , id_employee , date_add) VALUES
|
||||||
('.(int)($id_message).', '.(int)($id_employee).', NOW());
|
('.(int)($id_message).', '.(int)($id_employee).', NOW());
|
||||||
');
|
');
|
||||||
|
|||||||
+2
-2
@@ -89,7 +89,7 @@ class MetaCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getMetas()
|
public static function getMetas()
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM '._DB_PREFIX_.'meta
|
FROM '._DB_PREFIX_.'meta
|
||||||
ORDER BY page ASC');
|
ORDER BY page ASC');
|
||||||
@@ -106,7 +106,7 @@ class MetaCore extends ObjectModel
|
|||||||
WHERE ml.`id_lang` = '.(int)$id_lang
|
WHERE ml.`id_lang` = '.(int)$id_lang
|
||||||
.$shop->sqlLang('ml').
|
.$shop->sqlLang('ml').
|
||||||
'ORDER BY page ASC';
|
'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
|
) as total
|
||||||
FROM '._DB_PREFIX_.'module m';
|
FROM '._DB_PREFIX_.'module m';
|
||||||
self::$modulesCache = array();
|
self::$modulesCache = array();
|
||||||
$result = Db::getInstance()->ExecuteS($sql);
|
$result = Db::getInstance()->executeS($sql);
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
{
|
{
|
||||||
self::$modulesCache[$row['name']] = $row;
|
self::$modulesCache[$row['name']] = $row;
|
||||||
@@ -167,14 +167,14 @@ abstract class ModuleCore
|
|||||||
$this->enable(true);
|
$this->enable(true);
|
||||||
|
|
||||||
// Permissions management
|
// Permissions management
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'module_access` (`id_profile`, `id_module`, `view`, `configure`) (
|
INSERT INTO `'._DB_PREFIX_.'module_access` (`id_profile`, `id_module`, `view`, `configure`) (
|
||||||
SELECT id_profile, '.(int)$this->id.', 1, 1
|
SELECT id_profile, '.(int)$this->id.', 1, 1
|
||||||
FROM '._DB_PREFIX_.'access a
|
FROM '._DB_PREFIX_.'access a
|
||||||
WHERE id_tab = (SELECT `id_tab` FROM '._DB_PREFIX_.'tab WHERE class_name = \'AdminModules\' LIMIT 1)
|
WHERE id_tab = (SELECT `id_tab` FROM '._DB_PREFIX_.'tab WHERE class_name = \'AdminModules\' LIMIT 1)
|
||||||
AND a.`view` = 1
|
AND a.`view` = 1
|
||||||
)');
|
)');
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'module_access` (`id_profile`, `id_module`, `view`, `configure`) (
|
INSERT INTO `'._DB_PREFIX_.'module_access` (`id_profile`, `id_module`, `view`, `configure`) (
|
||||||
SELECT id_profile, '.(int)$this->id.', 1, 0
|
SELECT id_profile, '.(int)$this->id.', 1, 0
|
||||||
FROM '._DB_PREFIX_.'access a
|
FROM '._DB_PREFIX_.'access a
|
||||||
@@ -200,23 +200,23 @@ abstract class ModuleCore
|
|||||||
$sql = 'SELECT id_hook
|
$sql = 'SELECT id_hook
|
||||||
FROM '._DB_PREFIX_.'hook_module hm
|
FROM '._DB_PREFIX_.'hook_module hm
|
||||||
WHERE id_module = '.(int)$this->id;
|
WHERE id_module = '.(int)$this->id;
|
||||||
$result = Db::getInstance()->ExecuteS($sql);
|
$result = Db::getInstance()->executeS($sql);
|
||||||
foreach ($result AS $row)
|
foreach ($result AS $row)
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'hook_module`
|
$sql = 'DELETE FROM `'._DB_PREFIX_.'hook_module`
|
||||||
WHERE `id_module` = '.(int)$this->id.'
|
WHERE `id_module` = '.(int)$this->id.'
|
||||||
AND `id_hook` = '.(int)$row['id_hook'];
|
AND `id_hook` = '.(int)$row['id_hook'];
|
||||||
Db::getInstance()->Execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
$this->cleanPositions($row['id_hook']);
|
$this->cleanPositions($row['id_hook']);
|
||||||
}
|
}
|
||||||
$this->disable(true);
|
$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
|
// Remove restrictions for client groups
|
||||||
Group::truncateRestrictionsByModule($this->id);
|
Group::truncateRestrictionsByModule($this->id);
|
||||||
|
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'module`
|
DELETE FROM `'._DB_PREFIX_.'module`
|
||||||
WHERE `id_module` = '.(int)$this->id);
|
WHERE `id_module` = '.(int)$this->id);
|
||||||
}
|
}
|
||||||
@@ -414,7 +414,7 @@ abstract class ModuleCore
|
|||||||
WHERE `id_module` = '.(int)$this->id.'
|
WHERE `id_module` = '.(int)$this->id.'
|
||||||
AND `id_hook` = '.(int)$hook_id
|
AND `id_hook` = '.(int)$hook_id
|
||||||
.(($shopList) ? ' AND id_shop IN('.implode(', ', $shopList).')' : '');
|
.(($shopList) ? ' AND id_shop IN('.implode(', ', $shopList).')' : '');
|
||||||
$result = Db::getInstance()->Execute($sql);
|
$result = Db::getInstance()->execute($sql);
|
||||||
$this->cleanPositions($hook_id, $shopList);
|
$this->cleanPositions($hook_id, $shopList);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -433,7 +433,7 @@ abstract class ModuleCore
|
|||||||
WHERE `id_module` = '.(int)$this->id.'
|
WHERE `id_module` = '.(int)$this->id.'
|
||||||
AND `id_hook` = '.(int)$hook_id
|
AND `id_hook` = '.(int)$hook_id
|
||||||
.(($shopList) ? ' AND id_shop IN('.implode(', ', $shopList).')' : '');
|
.(($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']).'"';
|
$arrNativeModules[] = '"'.pSQL($module['name']).'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $db->ExecuteS('
|
return $db->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'module` m
|
FROM `'._DB_PREFIX_.'module` m
|
||||||
WHERE name NOT IN ('.implode(',',$arrNativeModules).') ');
|
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`
|
LEFT JOIN `'._DB_PREFIX_.'hook` k ON hm.`id_hook` = k.`id_hook`
|
||||||
WHERE k.`position` = 1
|
WHERE k.`position` = 1
|
||||||
GROUP BY m.id_module';
|
GROUP BY m.id_module';
|
||||||
return Db::getInstance()->ExecuteS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -812,7 +812,7 @@ abstract class ModuleCore
|
|||||||
$sql .= '
|
$sql .= '
|
||||||
GROUP BY hm.id_hook, hm.id_module
|
GROUP BY hm.id_hook, hm.id_module
|
||||||
ORDER BY hm.`position`';
|
ORDER BY hm.`position`';
|
||||||
$result = $db->ExecuteS($sql, false);
|
$result = $db->executeS($sql, false);
|
||||||
self::$_hookModulesCache = array();
|
self::$_hookModulesCache = array();
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
@@ -925,7 +925,7 @@ abstract class ModuleCore
|
|||||||
$sql .= '
|
$sql .= '
|
||||||
GROUP BY hm.id_hook, hm.id_module
|
GROUP BY hm.id_hook, hm.id_module
|
||||||
ORDER BY hm.`position`, m.`name` DESC';
|
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;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -1016,7 +1016,7 @@ abstract class ModuleCore
|
|||||||
WHERE hm.`id_hook` = '.(int)$id_hook.'
|
WHERE hm.`id_hook` = '.(int)$id_hook.'
|
||||||
AND hm.id_shop = '.$shopID.'
|
AND hm.id_shop = '.$shopID.'
|
||||||
ORDER BY hm.`position` '.($way ? 'ASC' : 'DESC');
|
ORDER BY hm.`position` '.($way ? 'ASC' : 'DESC');
|
||||||
if (!$res = Db::getInstance()->ExecuteS($sql))
|
if (!$res = Db::getInstance()->executeS($sql))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
foreach ($res AS $key => $values)
|
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']))).'
|
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_hook`='.(int)$from['id_hook'].'
|
||||||
AND id_shop = '.$shopID;
|
AND id_shop = '.$shopID;
|
||||||
if (!Db::getInstance()->Execute($sql))
|
if (!Db::getInstance()->execute($sql))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$sql = 'UPDATE `'._DB_PREFIX_.'hook_module`
|
$sql = 'UPDATE `'._DB_PREFIX_.'hook_module`
|
||||||
@@ -1046,7 +1046,7 @@ abstract class ModuleCore
|
|||||||
WHERE `'.pSQL($this->identifier).'` = '.(int)($from[$this->identifier]).'
|
WHERE `'.pSQL($this->identifier).'` = '.(int)($from[$this->identifier]).'
|
||||||
AND `id_hook` = '.(int)($to['id_hook']).'
|
AND `id_hook` = '.(int)($to['id_hook']).'
|
||||||
AND id_shop = '.$shopID;
|
AND id_shop = '.$shopID;
|
||||||
if (!Db::getInstance()->Execute($sql))
|
if (!Db::getInstance()->execute($sql))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1064,7 +1064,7 @@ abstract class ModuleCore
|
|||||||
WHERE id_hook = '.(int)$id_hook.'
|
WHERE id_hook = '.(int)$id_hook.'
|
||||||
'.((!is_null($shopList)) ? ' AND id_shop IN('.implode(', ', $shopList).')' : '').'
|
'.((!is_null($shopList)) ? ' AND id_shop IN('.implode(', ', $shopList).')' : '').'
|
||||||
ORDER BY position';
|
ORDER BY position';
|
||||||
$results = Db::getInstance()->ExecuteS($sql);
|
$results = Db::getInstance()->executeS($sql);
|
||||||
$position = array();
|
$position = array();
|
||||||
foreach ($results as $row)
|
foreach ($results as $row)
|
||||||
{
|
{
|
||||||
@@ -1076,7 +1076,7 @@ abstract class ModuleCore
|
|||||||
WHERE id_hook = '.(int)$id_hook.'
|
WHERE id_hook = '.(int)$id_hook.'
|
||||||
AND id_module = '.$row['id_module'].'
|
AND id_module = '.$row['id_module'].'
|
||||||
AND id_shop = '.$row['id_shop'];
|
AND id_shop = '.$row['id_shop'];
|
||||||
Db::getInstance()->Execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
$position[$row['id_shop']]++;
|
$position[$row['id_shop']]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1117,7 +1117,7 @@ abstract class ModuleCore
|
|||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM `'._DB_PREFIX_.'hook_module_exceptions`
|
FROM `'._DB_PREFIX_.'hook_module_exceptions`
|
||||||
WHERE id_shop IN ('.implode(', ', Context::getContext()->shop->getListOfID()).')';
|
WHERE id_shop IN ('.implode(', ', Context::getContext()->shop->getListOfID()).')';
|
||||||
$result = Db::getInstance()->ExecuteS($sql);
|
$result = Db::getInstance()->executeS($sql);
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
{
|
{
|
||||||
if (!$row['file_name'])
|
if (!$row['file_name'])
|
||||||
@@ -1154,7 +1154,7 @@ abstract class ModuleCore
|
|||||||
|
|
||||||
public static function isInstalled($moduleName)
|
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();
|
return (bool)Db::getInstance()->NumRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1293,7 +1293,7 @@ abstract class ModuleCore
|
|||||||
if (!isset($cache_permissions[$employee->id_profile]))
|
if (!isset($cache_permissions[$employee->id_profile]))
|
||||||
{
|
{
|
||||||
$cache_permissions[$employee->id_profile] = array();
|
$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)
|
foreach ($result as $row)
|
||||||
{
|
{
|
||||||
$cache_permissions[$employee->id_profile][$row['id_module']]['view'] = $row['view'];
|
$cache_permissions[$employee->id_profile][$row['id_module']]['view'] = $row['view'];
|
||||||
@@ -1309,7 +1309,7 @@ abstract class ModuleCore
|
|||||||
*/
|
*/
|
||||||
public static function getAuthorizedModules($group_id)
|
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
|
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`)
|
LEFT JOIN `'._DB_PREFIX_.'module` m ON (m.`id_module` = gmr.`id_module`)
|
||||||
WHERE gmr.`id_group` = '.(int) $group_id.'
|
WHERE gmr.`id_group` = '.(int) $group_id.'
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ abstract class ModuleGraphEngineCore extends Module
|
|||||||
|
|
||||||
public static function getGraphEngines()
|
public static function getGraphEngines()
|
||||||
{
|
{
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT m.`name`
|
SELECT m.`name`
|
||||||
FROM `'._DB_PREFIX_.'module` m
|
FROM `'._DB_PREFIX_.'module` m
|
||||||
LEFT JOIN `'._DB_PREFIX_.'hook_module` hm ON hm.`id_module` = m.`id_module`
|
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()
|
public static function getGridEngines()
|
||||||
{
|
{
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT m.`name`
|
SELECT m.`name`
|
||||||
FROM `'._DB_PREFIX_.'module` m
|
FROM `'._DB_PREFIX_.'module` m
|
||||||
LEFT JOIN `'._DB_PREFIX_.'hook_module` hm ON hm.`id_module` = m.`id_module`
|
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';
|
ORDER BY `id_'.pSQL($type).'` DESC LIMIT 5';
|
||||||
|
|
||||||
$json = array();
|
$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']))
|
if (isset($value['id_order']))
|
||||||
{
|
{
|
||||||
@@ -108,7 +108,7 @@ class NotificationCore
|
|||||||
{
|
{
|
||||||
if (in_array($type, $this->types))
|
if (in_array($type, $this->types))
|
||||||
// We update the last item viewed
|
// We update the last item viewed
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'employee`
|
UPDATE `'._DB_PREFIX_.'employee`
|
||||||
SET `id_last_'.pSQL($type).'` = (SELECT MAX(`id_'.$type.'`)
|
SET `id_last_'.pSQL($type).'` = (SELECT MAX(`id_'.$type.'`)
|
||||||
FROM `'._DB_PREFIX_.(($type == 'order') ? pSQL($type).'s' : pSQL($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`
|
$sql = 'SELECT * FROM `'.pSQL(_DB_PREFIX_.$this->table).'_lang`
|
||||||
WHERE `'.$this->identifier.'` = '.(int)$id
|
WHERE `'.$this->identifier.'` = '.(int)$id
|
||||||
.(($this->id_shop) ? ' AND `id_shop` = '.$this->id_shop : '');
|
.(($this->id_shop) ? ' AND `id_shop` = '.$this->id_shop : '');
|
||||||
$result = Db::getInstance()->ExecuteS($sql);
|
$result = Db::getInstance()->executeS($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
foreach ($row AS $key => $value)
|
foreach ($row AS $key => $value)
|
||||||
@@ -342,13 +342,13 @@ abstract class ObjectModelCore
|
|||||||
$this->clearCache();
|
$this->clearCache();
|
||||||
|
|
||||||
/* Database deletion */
|
/* 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)
|
if (!$result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Database deletion for multilingual fields related to the object */
|
/* Database deletion for multilingual fields related to the object */
|
||||||
if (method_exists($this, 'getTranslationsFieldsChild'))
|
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;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,7 +388,7 @@ abstract class ObjectModelCore
|
|||||||
$this->active = (int)(!$this->active);
|
$this->active = (int)(!$this->active);
|
||||||
|
|
||||||
/* Change status to active/inactive */
|
/* Change status to active/inactive */
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
UPDATE `'.pSQL(_DB_PREFIX_.$this->table).'`
|
UPDATE `'.pSQL(_DB_PREFIX_.$this->table).'`
|
||||||
SET `active` = !`active`
|
SET `active` = !`active`
|
||||||
WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id));
|
||||||
@@ -733,12 +733,12 @@ abstract class ObjectModelCore
|
|||||||
'.($sql_sort != '' ? $sql_sort : '').'
|
'.($sql_sort != '' ? $sql_sort : '').'
|
||||||
'.($sql_limit != '' ? $sql_limit : '').'
|
'.($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)
|
public function getFieldsRequiredDatabase($all = false)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT id_required_field, object_name, field_name
|
SELECT id_required_field, object_name, field_name
|
||||||
FROM '._DB_PREFIX_.'required_field
|
FROM '._DB_PREFIX_.'required_field
|
||||||
'.(!$all ? 'WHERE object_name = \''.pSQL(get_class($this)).'\'' : ''));
|
'.(!$all ? 'WHERE object_name = \''.pSQL(get_class($this)).'\'' : ''));
|
||||||
@@ -749,7 +749,7 @@ abstract class ObjectModelCore
|
|||||||
if (!is_array($fields))
|
if (!is_array($fields))
|
||||||
return false;
|
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;
|
return false;
|
||||||
|
|
||||||
foreach ($fields AS $field)
|
foreach ($fields AS $field)
|
||||||
@@ -807,7 +807,7 @@ abstract class ObjectModelCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($sql))
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -841,7 +841,7 @@ abstract class ObjectModelCore
|
|||||||
$sql = 'SELECT id_shop
|
$sql = 'SELECT id_shop
|
||||||
FROM '._DB_PREFIX_.$this->table.'_shop
|
FROM '._DB_PREFIX_.$this->table.'_shop
|
||||||
WHERE '.$this->identifier.' = '.(int)$id;
|
WHERE '.$this->identifier.' = '.(int)$id;
|
||||||
if ($results = Db::getInstance()->ExecuteS($sql))
|
if ($results = Db::getInstance()->executeS($sql))
|
||||||
{
|
{
|
||||||
$ids = array();
|
$ids = array();
|
||||||
foreach ($results as $row)
|
foreach ($results as $row)
|
||||||
|
|||||||
+16
-16
@@ -355,12 +355,12 @@ class OrderCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ($this->hasBeenDelivered())
|
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())
|
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));
|
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)))
|
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;
|
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 false;
|
||||||
return $this->_deleteProduct($orderDetail, (int)($quantity));
|
return $this->_deleteProduct($orderDetail, (int)($quantity));
|
||||||
}
|
}
|
||||||
@@ -380,7 +380,7 @@ class OrderCore extends ObjectModel
|
|||||||
if (!isset(self::$_historyCache[$id_order_state]) OR $no_hidden)
|
if (!isset(self::$_historyCache[$id_order_state]) OR $no_hidden)
|
||||||
{
|
{
|
||||||
$id_lang = $id_lang ? (int)($id_lang) : 'o.`id_lang`';
|
$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
|
SELECT oh.*, e.`firstname` AS employee_firstname, e.`lastname` AS employee_lastname, osl.`name` AS ostate_name
|
||||||
FROM `'._DB_PREFIX_.'orders` o
|
FROM `'._DB_PREFIX_.'orders` o
|
||||||
LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON o.`id_order` = oh.`id_order`
|
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()
|
public function getProductsDetail()
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'order_detail` od
|
FROM `'._DB_PREFIX_.'order_detail` od
|
||||||
WHERE od.`id_order` = '.(int)($this->id));
|
WHERE od.`id_order` = '.(int)($this->id));
|
||||||
@@ -532,7 +532,7 @@ class OrderCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'order_detail` od
|
FROM `'._DB_PREFIX_.'order_detail` od
|
||||||
WHERE od.`id_order` = '.(int)($this->id).'
|
WHERE od.`id_order` = '.(int)($this->id).'
|
||||||
AND `download_hash` <> \'\'';
|
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)
|
public function getDiscounts($details = false)
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'order_discount` od '.
|
FROM `'._DB_PREFIX_.'order_discount` od '.
|
||||||
($details ? 'LEFT JOIN `'._DB_PREFIX_.'discount` d ON (d.`id_discount` = od.`id_discount`)' : '').'
|
($details ? 'LEFT JOIN `'._DB_PREFIX_.'discount` d ON (d.`id_discount` = od.`id_discount`)' : '').'
|
||||||
@@ -647,7 +647,7 @@ class OrderCore extends ObjectModel
|
|||||||
if (!$context)
|
if (!$context)
|
||||||
$context = Context::getContext();
|
$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
|
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
|
FROM `'._DB_PREFIX_.'orders` o
|
||||||
WHERE o.`id_customer` = '.(int)$id_customer.'
|
WHERE o.`id_customer` = '.(int)$id_customer.'
|
||||||
@@ -658,7 +658,7 @@ class OrderCore extends ObjectModel
|
|||||||
|
|
||||||
foreach ($res AS $key => $val)
|
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`
|
SELECT os.`id_order_state`, osl.`name` AS order_state, os.`invoice`
|
||||||
FROM `'._DB_PREFIX_.'order_history` oh
|
FROM `'._DB_PREFIX_.'order_history` oh
|
||||||
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = oh.`id_order_state`)
|
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()
|
'.Context::getContext()->shop->sqlRestriction()
|
||||||
.($type ? ' AND '.pSQL(strval($type)).'_number != 0' : '')
|
.($type ? ' AND '.pSQL(strval($type)).'_number != 0' : '')
|
||||||
.($id_customer ? ' AND id_customer = '.(int)($id_customer) : '');
|
.($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();
|
$orders = array();
|
||||||
foreach ($result AS $order)
|
foreach ($result AS $order)
|
||||||
@@ -708,7 +708,7 @@ class OrderCore extends ObjectModel
|
|||||||
'.Context::getContext()->shop->sqlRestriction(false, 'o').'
|
'.Context::getContext()->shop->sqlRestriction(false, 'o').'
|
||||||
ORDER BY o.`date_add` DESC
|
ORDER BY o.`date_add` DESC
|
||||||
'.((int)$limit ? 'LIMIT 0, '.(int)$limit : '');
|
'.((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)
|
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' : '')
|
.($type ? ' AND '.pSQL(strval($type)).'_number != 0' : '')
|
||||||
.($id_customer ? ' AND id_customer = '.(int)($id_customer) : '').
|
.($id_customer ? ' AND id_customer = '.(int)($id_customer) : '').
|
||||||
' ORDER BY invoice_date ASC';
|
' 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();
|
$orders = array();
|
||||||
foreach ($result AS $order)
|
foreach ($result AS $order)
|
||||||
@@ -741,7 +741,7 @@ class OrderCore extends ObjectModel
|
|||||||
)
|
)
|
||||||
'.Context::getContext()->shop->sqlRestriction(false, 'o').'
|
'.Context::getContext()->shop->sqlRestriction(false, 'o').'
|
||||||
ORDER BY invoice_date ASC';
|
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();
|
$orders = array();
|
||||||
foreach ($result AS $order)
|
foreach ($result AS $order)
|
||||||
@@ -884,7 +884,7 @@ class OrderCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'orders`)
|
FROM `'._DB_PREFIX_.'orders`)
|
||||||
tmp )';
|
tmp )';
|
||||||
// a way to avoid duplicate invoice number
|
// a way to avoid duplicate invoice number
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'orders`
|
UPDATE `'._DB_PREFIX_.'orders`
|
||||||
SET `invoice_number` = '.$number.', `invoice_date` = \''.date('Y-m-d H:i:s').'\'
|
SET `invoice_number` = '.$number.', `invoice_date` = \''.date('Y-m-d H:i:s').'\'
|
||||||
WHERE `id_order` = '.(int)$this->id
|
WHERE `id_order` = '.(int)$this->id
|
||||||
@@ -1030,7 +1030,7 @@ class OrderCore extends ObjectModel
|
|||||||
|
|
||||||
public function deleteAssociations()
|
public function deleteAssociations()
|
||||||
{
|
{
|
||||||
return (Db::getInstance()->Execute('
|
return (Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'order_detail`
|
DELETE FROM `'._DB_PREFIX_.'order_detail`
|
||||||
WHERE `id_order` = '.(int)($this->id)) !== false);
|
WHERE `id_order` = '.(int)($this->id)) !== false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ class OrderDetailCore extends ObjectModel
|
|||||||
SET `download_nb` = `download_nb` + '.(int)($increment).'
|
SET `download_nb` = `download_nb` + '.(int)($increment).'
|
||||||
WHERE `id_order_detail`= '.(int)($id_order_detail).'
|
WHERE `id_order_detail`= '.(int)($id_order_detail).'
|
||||||
LIMIT 1';
|
LIMIT 1';
|
||||||
return Db::getInstance()->Execute($sql);
|
return Db::getInstance()->execute($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -236,7 +236,7 @@ class OrderDetailCore extends ObjectModel
|
|||||||
|
|
||||||
$computation_method = 1;
|
$computation_method = 1;
|
||||||
$taxes = array();
|
$taxes = array();
|
||||||
if ($results = Db::getInstance()->ExecuteS($sql))
|
if ($results = Db::getInstance()->executeS($sql))
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach ($results AS $result)
|
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)
|
$sql = 'INSERT INTO `'._DB_PREFIX_.'order_detail_tax` (id_order_detail, id_tax)
|
||||||
VALUES '.$values;
|
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)
|
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
|
SELECT om.id_order_message, oml.name, oml.message
|
||||||
FROM '._DB_PREFIX_.'order_message om
|
FROM '._DB_PREFIX_.'order_message om
|
||||||
LEFT JOIN '._DB_PREFIX_.'order_message_lang oml ON (oml.id_order_message = om.id_order_message)
|
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)
|
if (!$context)
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
$data = Db::getInstance()->ExecuteS('
|
$data = Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'order_return`
|
FROM `'._DB_PREFIX_.'order_return`
|
||||||
WHERE `id_customer` = '.(int)($customer_id).
|
WHERE `id_customer` = '.(int)($customer_id).
|
||||||
@@ -153,7 +153,7 @@ class OrderReturnCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getOrdersReturnDetail($id_order_return)
|
public static function getOrdersReturnDetail($id_order_return)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'order_return_detail`
|
FROM `'._DB_PREFIX_.'order_return_detail`
|
||||||
WHERE `id_order_return` = '.(int)($id_order_return));
|
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)
|
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)
|
public static function getOrderReturnStates($id_lang)
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'order_return_state` ors
|
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).')
|
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)
|
public static function getOrdersSlip($customer_id, $order_id = false)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'order_slip`
|
FROM `'._DB_PREFIX_.'order_slip`
|
||||||
WHERE `id_customer` = '.(int)($customer_id).
|
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)
|
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 *').
|
($id_order_detail ? 'SELECT SUM(`product_quantity`) AS `total`' : 'SELECT *').
|
||||||
'FROM `'._DB_PREFIX_.'order_slip_detail`'
|
'FROM `'._DB_PREFIX_.'order_slip_detail`'
|
||||||
.($id_order_slip ? ' WHERE `id_order_slip` = '.(int)($id_order_slip) : '')
|
.($id_order_slip ? ' WHERE `id_order_slip` = '.(int)($id_order_slip) : '')
|
||||||
@@ -131,7 +131,7 @@ class OrderSlipCore extends ObjectModel
|
|||||||
|
|
||||||
public function getProducts()
|
public function getProducts()
|
||||||
{
|
{
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *, osd.product_quantity
|
SELECT *, osd.product_quantity
|
||||||
FROM `'._DB_PREFIX_.'order_slip_detail` osd
|
FROM `'._DB_PREFIX_.'order_slip_detail` osd
|
||||||
INNER JOIN `'._DB_PREFIX_.'order_detail` od ON osd.id_order_detail = od.id_order_detail
|
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)
|
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`
|
SELECT `id_order_slip`
|
||||||
FROM `'._DB_PREFIX_.'order_slip`
|
FROM `'._DB_PREFIX_.'order_slip`
|
||||||
WHERE `date_add` BETWEEN \''.pSQL($dateFrom).' 00:00:00\' AND \''.pSQL($dateTo).' 23:59:59\'
|
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)
|
public static function getOrderStates($id_lang)
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'order_state` os
|
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).')
|
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))
|
if (array_key_exists($id_product, self::$cachePackItems))
|
||||||
return self::$cachePackItems[$id_product];
|
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();
|
$arrayResult = array();
|
||||||
foreach ($result AS $row)
|
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` 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.')
|
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;
|
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)
|
if (!$full)
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ class PackCore extends Product
|
|||||||
AND p.`id_product` IN ('.$packs.')';
|
AND p.`id_product` IN ('.$packs.')';
|
||||||
if ($limit)
|
if ($limit)
|
||||||
$sql .= ' LIMIT '.(int)$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)
|
if (!$full)
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
@@ -169,8 +169,8 @@ class PackCore extends Product
|
|||||||
|
|
||||||
public static function deleteItems($id_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') &&
|
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)) &&
|
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'pack` WHERE `id_product_pack` = '.(int)($id_product)) &&
|
||||||
Configuration::updateGlobalValue('PS_PACK_FEATURE_ACTIVE', self::isCurrentlyUsed());
|
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)
|
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') &&
|
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');
|
Configuration::updateGlobalValue('PS_PACK_FEATURE_ACTIVE', '1');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function duplicate($id_product_old, $id_product_new)
|
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).')');
|
(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
|
// 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.'
|
WHERE `id_date_range` = '.(int)$id_date_range.'
|
||||||
AND `id_page` = '.(int)$id_page.'
|
AND `id_page` = '.(int)$id_page.'
|
||||||
AND `id_shop` = ' . $context->shop->getID();
|
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 no one has seen the page in this date range, it is added
|
||||||
if (Db::getInstance()->Affected_Rows() == 0)
|
if (Db::getInstance()->Affected_Rows() == 0)
|
||||||
|
|||||||
@@ -42,14 +42,14 @@ abstract class PaymentModuleCore extends Module
|
|||||||
// Insert currencies availability
|
// Insert currencies availability
|
||||||
if ($this->currencies_mode == 'checkbox')
|
if ($this->currencies_mode == 'checkbox')
|
||||||
{
|
{
|
||||||
if (!Db::getInstance()->Execute('
|
if (!Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'module_currency` (id_module, id_currency)
|
INSERT INTO `'._DB_PREFIX_.'module_currency` (id_module, id_currency)
|
||||||
SELECT '.(int)($this->id).', id_currency FROM `'._DB_PREFIX_.'currency` WHERE deleted = 0'))
|
SELECT '.(int)($this->id).', id_currency FROM `'._DB_PREFIX_.'currency` WHERE deleted = 0'))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
elseif ($this->currencies_mode == 'radio')
|
elseif ($this->currencies_mode == 'radio')
|
||||||
{
|
{
|
||||||
if (!Db::getInstance()->Execute('
|
if (!Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'module_currency` (id_module, id_currency)
|
INSERT INTO `'._DB_PREFIX_.'module_currency` (id_module, id_currency)
|
||||||
VALUES ('.(int)($this->id).', -2)'))
|
VALUES ('.(int)($this->id).', -2)'))
|
||||||
return false;
|
return false;
|
||||||
@@ -58,11 +58,11 @@ abstract class PaymentModuleCore extends Module
|
|||||||
Tools::displayError('No currency mode for payment module');
|
Tools::displayError('No currency mode for payment module');
|
||||||
|
|
||||||
// Insert countries availability
|
// Insert countries availability
|
||||||
$return = Db::getInstance()->Execute('
|
$return = Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'module_country` (id_module, id_country)
|
INSERT INTO `'._DB_PREFIX_.'module_country` (id_module, id_country)
|
||||||
SELECT '.(int)($this->id).', id_country FROM `'._DB_PREFIX_.'country` WHERE active = 1');
|
SELECT '.(int)($this->id).', id_country FROM `'._DB_PREFIX_.'country` WHERE active = 1');
|
||||||
// Insert group availability
|
// Insert group availability
|
||||||
$return &= Db::getInstance()->Execute('
|
$return &= Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'module_group` (id_module, id_group)
|
INSERT INTO `'._DB_PREFIX_.'module_group` (id_module, id_group)
|
||||||
SELECT '.(int)($this->id).', id_group FROM `'._DB_PREFIX_.'group`');
|
SELECT '.(int)($this->id).', id_group FROM `'._DB_PREFIX_.'group`');
|
||||||
|
|
||||||
@@ -71,9 +71,9 @@ abstract class PaymentModuleCore extends Module
|
|||||||
|
|
||||||
public function uninstall()
|
public function uninstall()
|
||||||
{
|
{
|
||||||
if (!Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_country` 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_currency` WHERE id_module = '.(int)($this->id))
|
||||||
OR !Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'module_group` 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 false;
|
||||||
return parent::uninstall();
|
return parent::uninstall();
|
||||||
}
|
}
|
||||||
@@ -563,7 +563,7 @@ abstract class PaymentModuleCore extends Module
|
|||||||
|
|
||||||
if (!empty($values))
|
if (!empty($values))
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'module_currency` (`id_module`, `id_currency`)
|
INSERT INTO `'._DB_PREFIX_.'module_currency` (`id_module`, `id_currency`)
|
||||||
VALUES '.rtrim($values, ',')
|
VALUES '.rtrim($values, ',')
|
||||||
);
|
);
|
||||||
|
|||||||
+122
-122
@@ -458,7 +458,7 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function updatePosition($way, $position)
|
public function updatePosition($way, $position)
|
||||||
{
|
{
|
||||||
if (!$res = Db::getInstance()->ExecuteS('
|
if (!$res = Db::getInstance()->executeS('
|
||||||
SELECT cp.`id_product`, cp.`position`, cp.`id_category`
|
SELECT cp.`id_product`, cp.`position`, cp.`id_category`
|
||||||
FROM `'._DB_PREFIX_.'category_product` cp
|
FROM `'._DB_PREFIX_.'category_product` cp
|
||||||
WHERE cp.`id_category` = '.(int)(Tools::getValue('id_category', 1)).'
|
WHERE cp.`id_category` = '.(int)(Tools::getValue('id_category', 1)).'
|
||||||
@@ -475,7 +475,7 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
// < and > statements rather than BETWEEN operator
|
// < and > statements rather than BETWEEN operator
|
||||||
// since BETWEEN is treated differently according to databases
|
// since BETWEEN is treated differently according to databases
|
||||||
return (Db::getInstance()->Execute('
|
return (Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'category_product`
|
UPDATE `'._DB_PREFIX_.'category_product`
|
||||||
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
SET `position`= `position` '.($way ? '- 1' : '+ 1').'
|
||||||
WHERE `position`
|
WHERE `position`
|
||||||
@@ -483,7 +483,7 @@ class ProductCore extends ObjectModel
|
|||||||
? '> '.(int)($movedProduct['position']).' AND `position` <= '.(int)($position)
|
? '> '.(int)($movedProduct['position']).' AND `position` <= '.(int)($position)
|
||||||
: '< '.(int)($movedProduct['position']).' AND `position` >= '.(int)($position)).'
|
: '< '.(int)($movedProduct['position']).' AND `position` >= '.(int)($position)).'
|
||||||
AND `id_category`='.(int)($movedProduct['id_category']))
|
AND `id_category`='.(int)($movedProduct['id_category']))
|
||||||
AND Db::getInstance()->Execute('
|
AND Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'category_product`
|
UPDATE `'._DB_PREFIX_.'category_product`
|
||||||
SET `position` = '.(int)($position).'
|
SET `position` = '.(int)($position).'
|
||||||
WHERE `id_product` = '.(int)($movedProduct['id_product']).'
|
WHERE `id_product` = '.(int)($movedProduct['id_product']).'
|
||||||
@@ -500,7 +500,7 @@ class ProductCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$return = true;
|
$return = true;
|
||||||
|
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT `id_product`
|
SELECT `id_product`
|
||||||
FROM `'._DB_PREFIX_.'category_product`
|
FROM `'._DB_PREFIX_.'category_product`
|
||||||
WHERE `id_category` = '.(int)($id_category).'
|
WHERE `id_category` = '.(int)($id_category).'
|
||||||
@@ -508,7 +508,7 @@ class ProductCore extends ObjectModel
|
|||||||
$sizeof = count($result);
|
$sizeof = count($result);
|
||||||
|
|
||||||
for ($i = 0; $i < $sizeof; $i++)
|
for ($i = 0; $i < $sizeof; $i++)
|
||||||
$return &= Db::getInstance()->Execute('
|
$return &= Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'category_product`
|
UPDATE `'._DB_PREFIX_.'category_product`
|
||||||
SET `position` = '.(int)($i).'
|
SET `position` = '.(int)($i).'
|
||||||
WHERE `id_category` = '.(int)($id_category).'
|
WHERE `id_category` = '.(int)($id_category).'
|
||||||
@@ -566,7 +566,7 @@ class ProductCore extends ObjectModel
|
|||||||
public static function updateDefaultAttribute($id_product)
|
public static function updateDefaultAttribute($id_product)
|
||||||
{
|
{
|
||||||
$id_product_attribute = self::getDefaultAttribute($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)
|
public function validateFieldsLang($die = true, $errorReturn = false)
|
||||||
@@ -646,7 +646,7 @@ class ProductCore extends ObjectModel
|
|||||||
$currentCategories = $this->getCategories();
|
$currentCategories = $this->getCategories();
|
||||||
|
|
||||||
// for new categ, put product at last position
|
// 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
|
SELECT id_category, MAX(position)+1 newPos
|
||||||
FROM `'._DB_PREFIX_.'category_product`
|
FROM `'._DB_PREFIX_.'category_product`
|
||||||
WHERE `id_category` IN('.implode(',', array_map('intval', $categories)).')
|
WHERE `id_category` IN('.implode(',', array_map('intval', $categories)).')
|
||||||
@@ -664,7 +664,7 @@ class ProductCore extends ObjectModel
|
|||||||
if (!in_array($newIdCateg, $currentCategories))
|
if (!in_array($newIdCateg, $currentCategories))
|
||||||
$productCats[] = '('.$newIdCateg.', '.$this->id.', '.$newCategPos[$newIdCateg].')';
|
$productCats[] = '('.$newIdCateg.', '.$this->id.', '.$newCategPos[$newIdCateg].')';
|
||||||
if (count($productCats))
|
if (count($productCats))
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'category_product` (`id_category`, `id_product`, `position`)
|
INSERT INTO `'._DB_PREFIX_.'category_product` (`id_category`, `id_product`, `position`)
|
||||||
VALUES '.implode(',', $productCats));
|
VALUES '.implode(',', $productCats));
|
||||||
|
|
||||||
@@ -684,7 +684,7 @@ class ProductCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// get max position in each categories
|
// 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`
|
FROM `'._DB_PREFIX_.'category_product`
|
||||||
WHERE `id_category` NOT IN('.implode(',', array_map('intval', $categories)).')
|
WHERE `id_category` NOT IN('.implode(',', array_map('intval', $categories)).')
|
||||||
AND id_product = '.$this->id.'');
|
AND id_product = '.$this->id.'');
|
||||||
@@ -712,8 +712,8 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function deleteCategory($id_category, $cleanPositions = true)
|
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.'');
|
$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.'');
|
$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)
|
if ($cleanPositions === true)
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
$this->cleanPositions((int)$row['id_category']);
|
$this->cleanPositions((int)$row['id_category']);
|
||||||
@@ -728,10 +728,10 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function deleteCategories($cleanPositions = false)
|
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)
|
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)
|
foreach ($result as $row)
|
||||||
$this->cleanPositions((int)($row['id_category']));
|
$this->cleanPositions((int)($row['id_category']));
|
||||||
}
|
}
|
||||||
@@ -745,8 +745,8 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function deleteTags()
|
public function deleteTags()
|
||||||
{
|
{
|
||||||
return (Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_tag` WHERE `id_product` = '.(int)($this->id))
|
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`)'));
|
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()
|
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()
|
public function deleteImages()
|
||||||
{
|
{
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT `id_image`
|
SELECT `id_image`
|
||||||
FROM `'._DB_PREFIX_.'image`
|
FROM `'._DB_PREFIX_.'image`
|
||||||
WHERE `id_product` = '.(int)($this->id));
|
WHERE `id_product` = '.(int)($this->id));
|
||||||
@@ -830,7 +830,7 @@ class ProductCore extends ObjectModel
|
|||||||
($only_active ? ' AND p.`active` = 1' : '').'
|
($only_active ? ' AND p.`active` = 1' : '').'
|
||||||
ORDER BY '.(isset($orderByPrefix) ? pSQL($orderByPrefix).'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).
|
ORDER BY '.(isset($orderByPrefix) ? pSQL($orderByPrefix).'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).
|
||||||
($limit > 0 ? ' LIMIT '.(int)$start.','.(int)$limit : '');
|
($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')
|
if ($orderBy == 'price')
|
||||||
Tools::orderbyPrice($rq, $orderWay);
|
Tools::orderbyPrice($rq, $orderWay);
|
||||||
return ($rq);
|
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').')
|
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).'
|
WHERE pl.`id_lang` = '.(int)($id_lang).'
|
||||||
ORDER BY pl.`name`';
|
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()
|
public function isNew()
|
||||||
{
|
{
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT id_product FROM `'._DB_PREFIX_.'product` p
|
SELECT id_product FROM `'._DB_PREFIX_.'product` p
|
||||||
WHERE 1
|
WHERE 1
|
||||||
AND id_product = '.(int)($this->id).'
|
AND id_product = '.(int)($this->id).'
|
||||||
@@ -866,7 +866,7 @@ class ProductCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!Combination::isFeatureActive())
|
if (!Combination::isFeatureActive())
|
||||||
return false;
|
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
|
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
|
||||||
WHERE pa.`id_product` = '.(int)($this->id));
|
WHERE pa.`id_product` = '.(int)($this->id));
|
||||||
@@ -944,7 +944,7 @@ class ProductCore extends ObjectModel
|
|||||||
foreach ($id_images as $id_image)
|
foreach ($id_images as $id_image)
|
||||||
$query .= '('.(int)($id_product_attribute).', '.(int)($id_image).'), ';
|
$query .= '('.(int)($id_product_attribute).', '.(int)($id_image).'), ';
|
||||||
$query = trim($query, ', ');
|
$query = trim($query, ', ');
|
||||||
if (!Db::getInstance()->Execute($query))
|
if (!Db::getInstance()->execute($query))
|
||||||
return false;
|
return false;
|
||||||
return (int)($id_product_attribute);
|
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)
|
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);
|
$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)
|
if (!$id_product_attribute OR !$result)
|
||||||
return false;
|
return false;
|
||||||
return $id_product_attribute;
|
return $id_product_attribute;
|
||||||
@@ -990,10 +990,10 @@ class ProductCore extends ObjectModel
|
|||||||
$values[] = '('.implode(', ', $v).')';
|
$values[] = '('.implode(', ', $v).')';
|
||||||
$keys[] = implode(', ', $k);
|
$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\'];'),
|
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())
|
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()
|
public function deleteDefaultAttributes()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'product_attribute`
|
UPDATE `'._DB_PREFIX_.'product_attribute`
|
||||||
SET `default_on` = 0
|
SET `default_on` = 0
|
||||||
WHERE `id_product` = '.(int)($this->id));
|
WHERE `id_product` = '.(int)($this->id));
|
||||||
@@ -1011,12 +1011,12 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public function setDefaultAttribute($id_product_attribute)
|
public function setDefaultAttribute($id_product_attribute)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'product_attribute`
|
UPDATE `'._DB_PREFIX_.'product_attribute`
|
||||||
SET `default_on` = 1
|
SET `default_on` = 1
|
||||||
WHERE `id_product` = '.(int)$this->id.'
|
WHERE `id_product` = '.(int)$this->id.'
|
||||||
AND `id_product_attribute` = '.(int)$id_product_attribute) &&
|
AND `id_product_attribute` = '.(int)$id_product_attribute) &&
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'product`
|
UPDATE `'._DB_PREFIX_.'product`
|
||||||
SET `cache_default_attribute` = '.(int)$id_product_attribute.'
|
SET `cache_default_attribute` = '.(int)$id_product_attribute.'
|
||||||
WHERE `id_product` = '.(int)$this->id.' LIMIT 1');
|
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)
|
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`
|
DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||||
WHERE `id_product_attribute` = '.(int)($id_product_attribute));
|
WHERE `id_product_attribute` = '.(int)($id_product_attribute));
|
||||||
|
|
||||||
@@ -1067,7 +1067,7 @@ class ProductCore extends ObjectModel
|
|||||||
$this->setStock($data['quantity'], $id_product_attribute);
|
$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;
|
return false;
|
||||||
if ($quantity)
|
if ($quantity)
|
||||||
Hook::updateProductAttribute($id_product_attribute);
|
Hook::updateProductAttribute($id_product_attribute);
|
||||||
@@ -1078,7 +1078,7 @@ class ProductCore extends ObjectModel
|
|||||||
foreach ($id_images as $id_image)
|
foreach ($id_images as $id_image)
|
||||||
$query .= '('.(int)($id_product_attribute).', '.(int)($id_image).'), ';
|
$query .= '('.(int)($id_product_attribute).', '.(int)($id_image).'), ';
|
||||||
$query = trim($query, ', ');
|
$query = trim($query, ', ');
|
||||||
return Db::getInstance()->Execute($query);
|
return Db::getInstance()->execute($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1086,7 +1086,7 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function updateQuantityProductWithAttributeQuantity()
|
public function updateQuantityProductWithAttributeQuantity()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'product`
|
UPDATE `'._DB_PREFIX_.'product`
|
||||||
SET `quantity` = IFNULL(
|
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));
|
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`
|
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).')');
|
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));
|
$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));
|
$result3 = Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_download` WHERE `id_product` = '.(int)($this->id));
|
||||||
|
|
||||||
return ($result & $result2 & $result3);
|
return ($result & $result2 & $result3);
|
||||||
}
|
}
|
||||||
@@ -1121,7 +1121,7 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function deleteAttributesImpacts()
|
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()
|
public function deleteAttachments()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'product_attachment`
|
DELETE FROM `'._DB_PREFIX_.'product_attachment`
|
||||||
WHERE `id_product` = '.(int)$this->id);
|
WHERE `id_product` = '.(int)$this->id);
|
||||||
}
|
}
|
||||||
@@ -1154,8 +1154,8 @@ class ProductCore extends ObjectModel
|
|||||||
public function deleteCustomization()
|
public function deleteCustomization()
|
||||||
{
|
{
|
||||||
return
|
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` 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_lang`
|
||||||
WHERE `id_customization_field` NOT IN (SELECT id_customization_field FROM `'._DB_PREFIX_.'customization_field`)');
|
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()
|
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()
|
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()
|
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()
|
public function deleteSearchIndexes()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'search_index` WHERE `id_product` = '.(int)($this->id)) &&
|
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_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))
|
if (!Validate::isValuesList($attributesList))
|
||||||
die(Tools::displayError());
|
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;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1234,7 +1234,7 @@ class ProductCore extends ObjectModel
|
|||||||
foreach ($combinations[$nb] as $id_attribute)
|
foreach ($combinations[$nb] as $id_attribute)
|
||||||
$attributesList .= '('.(int)($id_product_attribute).','.(int)($id_attribute).'),';
|
$attributesList .= '('.(int)($id_product_attribute).','.(int)($id_attribute).'),';
|
||||||
$attributesList = rtrim($attributesList, ',');
|
$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`
|
$sql = 'DELETE FROM `'._DB_PREFIX_.'product_attribute`
|
||||||
WHERE `id_product_attribute` = '.$id_product_attribute.'
|
WHERE `id_product_attribute` = '.$id_product_attribute.'
|
||||||
AND `id_product` = '.$this->id;
|
AND `id_product` = '.$this->id;
|
||||||
$result = Db::getInstance()->Execute($sql);
|
$result = Db::getInstance()->execute($sql);
|
||||||
|
|
||||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
$sql = 'DELETE FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||||
WHERE `id_product_attribute` = '.$id_product_attribute;
|
WHERE `id_product_attribute` = '.$id_product_attribute;
|
||||||
$result2 = Db::getInstance()->Execute($sql);
|
$result2 = Db::getInstance()->execute($sql);
|
||||||
|
|
||||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'cart_product`
|
$sql = 'DELETE FROM `'._DB_PREFIX_.'cart_product`
|
||||||
WHERE `id_product_attribute` = '.$id_product_attribute;
|
WHERE `id_product_attribute` = '.$id_product_attribute;
|
||||||
$result3 = Db::getInstance()->Execute($sql);
|
$result3 = Db::getInstance()->execute($sql);
|
||||||
return ($result AND $result2 AND $result3);
|
return ($result AND $result2 AND $result3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1272,7 +1272,7 @@ class ProductCore extends ObjectModel
|
|||||||
public function deleteFeatures()
|
public function deleteFeatures()
|
||||||
{
|
{
|
||||||
// List products features
|
// List products features
|
||||||
$features = Db::getInstance()->ExecuteS('
|
$features = Db::getInstance()->executeS('
|
||||||
SELECT p.*, f.*
|
SELECT p.*, f.*
|
||||||
FROM `'._DB_PREFIX_.'feature_product` as p
|
FROM `'._DB_PREFIX_.'feature_product` as p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'feature_value` as f ON (f.`id_feature_value` = p.`id_feature_value`)
|
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)
|
foreach ($features as $tab)
|
||||||
// Delete product custom features
|
// Delete product custom features
|
||||||
if ($tab['custom']) {
|
if ($tab['custom']) {
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'feature_value`
|
DELETE FROM `'._DB_PREFIX_.'feature_value`
|
||||||
WHERE `id_feature_value` = '.(int)($tab['id_feature_value']));
|
WHERE `id_feature_value` = '.(int)($tab['id_feature_value']));
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'feature_value_lang`
|
DELETE FROM `'._DB_PREFIX_.'feature_value_lang`
|
||||||
WHERE `id_feature_value` = '.(int)($tab['id_feature_value']));
|
WHERE `id_feature_value` = '.(int)($tab['id_feature_value']));
|
||||||
}
|
}
|
||||||
// Delete product features
|
// Delete product features
|
||||||
$result = Db::getInstance()->Execute('
|
$result = Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'feature_product`
|
DELETE FROM `'._DB_PREFIX_.'feature_product`
|
||||||
WHERE `id_product` = '.(int)($this->id));
|
WHERE `id_product` = '.(int)($this->id));
|
||||||
return ($result);
|
return ($result);
|
||||||
@@ -1314,19 +1314,19 @@ class ProductCore extends ObjectModel
|
|||||||
'.Product::sqlStock('pa', 'pa').'
|
'.Product::sqlStock('pa', 'pa').'
|
||||||
WHERE pa.`id_product` = '.(int)$this->id.'
|
WHERE pa.`id_product` = '.(int)$this->id.'
|
||||||
ORDER BY pa.`id_product_attribute`';
|
ORDER BY pa.`id_product_attribute`';
|
||||||
return Db::getInstance()->ExecuteS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCombinationImages($id_lang)
|
public function getCombinationImages($id_lang)
|
||||||
{
|
{
|
||||||
if (!Combination::isFeatureActive())
|
if (!Combination::isFeatureActive())
|
||||||
return false;
|
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;
|
return false;
|
||||||
$ids = array();
|
$ids = array();
|
||||||
foreach ($productAttributes as $productAttribute)
|
foreach ($productAttributes as $productAttribute)
|
||||||
$ids[] = (int)($productAttribute['id_product_attribute']);
|
$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`
|
SELECT pai.`id_image`, pai.`id_product_attribute`, il.`legend`
|
||||||
FROM `'._DB_PREFIX_.'product_attribute_image` pai
|
FROM `'._DB_PREFIX_.'product_attribute_image` pai
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (il.`id_image` = pai.`id_image`)
|
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)');
|
$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')
|
if ($orderBy == 'price')
|
||||||
Tools::orderbyPrice($result, $orderWay);
|
Tools::orderbyPrice($result, $orderWay);
|
||||||
@@ -1582,7 +1582,7 @@ class ProductCore extends ObjectModel
|
|||||||
)
|
)
|
||||||
ORDER BY '.(isset($orderByPrefix) ? pSQL($orderByPrefix).'.' : '').'`'.pSQL($orderBy).'`'.' '.pSQL($orderWay).'
|
ORDER BY '.(isset($orderByPrefix) ? pSQL($orderByPrefix).'.' : '').'`'.pSQL($orderBy).'`'.' '.pSQL($orderWay).'
|
||||||
LIMIT '.(int)($pageNumber * $nbProducts).', '.(int)($nbProducts);
|
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')
|
if ($orderBy == 'price')
|
||||||
Tools::orderbyPrice($result, $orderWay);
|
Tools::orderbyPrice($result, $orderWay);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
@@ -1599,7 +1599,7 @@ class ProductCore extends ObjectModel
|
|||||||
public static function getProductCategories($id_product = '')
|
public static function getProductCategories($id_product = '')
|
||||||
{
|
{
|
||||||
$ret = array();
|
$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`
|
SELECT `id_category` FROM `'._DB_PREFIX_.'category_product`
|
||||||
WHERE `id_product` = '.(int)$id_product))
|
WHERE `id_product` = '.(int)$id_product))
|
||||||
foreach ($row as $val)
|
foreach ($row as $val)
|
||||||
@@ -1610,7 +1610,7 @@ class ProductCore extends ObjectModel
|
|||||||
public static function getProductCategoriesFull($id_product = '', $id_lang)
|
public static function getProductCategoriesFull($id_product = '', $id_lang)
|
||||||
{
|
{
|
||||||
$ret = array();
|
$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
|
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').')
|
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.'
|
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.')
|
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.'
|
WHERE i.`id_product` = '.(int)$this->id.'
|
||||||
ORDER BY `position`';
|
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.'
|
SET quantity = quantity + '.(int)$quantity.'
|
||||||
WHERE id_product = '.$this->id.'
|
WHERE id_product = '.$this->id.'
|
||||||
AND id_product_attribute = '.$id_product_attribute;
|
AND id_product_attribute = '.$id_product_attribute;
|
||||||
Db::getInstance()->Execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE '._DB_PREFIX_.'product
|
$sql = 'UPDATE '._DB_PREFIX_.'product
|
||||||
SET quantity = quantity + '.(int)$quantity.'
|
SET quantity = quantity + '.(int)$quantity.'
|
||||||
WHERE id_product='.$this->id;
|
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
|
$sql = 'UPDATE '._DB_PREFIX_.'stock
|
||||||
SET quantity = '.(($update) ? 'quantity + '.$quantity : $quantity).'
|
SET quantity = '.(($update) ? 'quantity + '.$quantity : $quantity).'
|
||||||
WHERE id_stock = '.$id_stock;
|
WHERE id_stock = '.$id_stock;
|
||||||
Db::getInstance()->Execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Db::getInstance()->autoExecute(_DB_PREFIX_.'stock', array(
|
Db::getInstance()->autoExecute(_DB_PREFIX_.'stock', array(
|
||||||
@@ -2152,7 +2152,7 @@ class ProductCore extends ObjectModel
|
|||||||
$sql = 'UPDATE '._DB_PREFIX_.'stock
|
$sql = 'UPDATE '._DB_PREFIX_.'stock
|
||||||
SET quantity = '.(($update) ? 'quantity + '.$quantity : $quantity).'
|
SET quantity = '.(($update) ? 'quantity + '.$quantity : $quantity).'
|
||||||
WHERE id_stock = '.$id_stock;
|
WHERE id_stock = '.$id_stock;
|
||||||
Db::getInstance()->Execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Db::getInstance()->autoExecute(_DB_PREFIX_.'stock', array(
|
Db::getInstance()->autoExecute(_DB_PREFIX_.'stock', array(
|
||||||
@@ -2291,7 +2291,7 @@ class ProductCore extends ObjectModel
|
|||||||
if (!$mini)
|
if (!$mini)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Db::getInstance()->Execute('
|
if (!Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'product_attribute`
|
UPDATE `'._DB_PREFIX_.'product_attribute`
|
||||||
SET `default_on` = 1
|
SET `default_on` = 1
|
||||||
WHERE `id_product_attribute` = '.(int)($mini['id_attr'])))
|
WHERE `id_product_attribute` = '.(int)($mini['id_attr'])))
|
||||||
@@ -2323,7 +2323,7 @@ class ProductCore extends ObjectModel
|
|||||||
AND al.`id_lang` = '.(int)($id_lang).'
|
AND al.`id_lang` = '.(int)($id_lang).'
|
||||||
AND agl.`id_lang` = '.(int)($id_lang).'
|
AND agl.`id_lang` = '.(int)($id_lang).'
|
||||||
ORDER BY ag.`position` ASC, a.`position` ASC';
|
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()
|
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()
|
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').'
|
'.$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').')
|
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;
|
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`)
|
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||||
WHERE `id_product_1` = '.(int)($this->id).
|
WHERE `id_product_1` = '.(int)($this->id).
|
||||||
($active ? ' AND p.`active` = 1' : '');
|
($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 false;
|
||||||
|
|
||||||
return $this->getProductsProperties($id_lang, $result);
|
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)
|
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`)
|
INSERT INTO `'._DB_PREFIX_.'feature_product` (`id_feature`, `id_product`, `id_feature_value`)
|
||||||
VALUES ('.(int)($id_feature).', '.(int)($id_product).', '.(int)($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)
|
ON DUPLICATE KEY UPDATE `id_feature_value` = '.(int)($id_feature_value)
|
||||||
@@ -2464,7 +2464,7 @@ class ProductCore extends ObjectModel
|
|||||||
if (!Feature::isFeatureActive())
|
if (!Feature::isFeatureActive())
|
||||||
return array();
|
return array();
|
||||||
if (!array_key_exists($id_product, self::$_cacheFeatures))
|
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
|
SELECT id_feature, id_product, id_feature_value
|
||||||
FROM `'._DB_PREFIX_.'feature_product`
|
FROM `'._DB_PREFIX_.'feature_product`
|
||||||
WHERE `id_product` = '.(int)$id_product);
|
WHERE `id_product` = '.(int)$id_product);
|
||||||
@@ -2483,7 +2483,7 @@ class ProductCore extends ObjectModel
|
|||||||
if (!count($productImplode))
|
if (!count($productImplode))
|
||||||
return;
|
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
|
SELECT id_feature, id_product, id_feature_value
|
||||||
FROM `'._DB_PREFIX_.'feature_product`
|
FROM `'._DB_PREFIX_.'feature_product`
|
||||||
WHERE `id_product` IN ('.implode($productImplode, ',').')');
|
WHERE `id_product` IN ('.implode($productImplode, ',').')');
|
||||||
@@ -2507,7 +2507,7 @@ class ProductCore extends ObjectModel
|
|||||||
if (!count($productImplode))
|
if (!count($productImplode))
|
||||||
return;
|
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
|
SELECT id_product, name, value, pf.id_feature
|
||||||
FROM '._DB_PREFIX_.'feature_product pf
|
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.')
|
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);
|
$sql->where($where);
|
||||||
Product::sqlStock('p', 'pa', false, $context->shop, $sql);
|
Product::sqlStock('p', 'pa', false, $context->shop, $sql);
|
||||||
|
|
||||||
$result = Db::getInstance()->ExecuteS($sql);
|
$result = Db::getInstance()->executeS($sql);
|
||||||
|
|
||||||
if (!$result)
|
if (!$result)
|
||||||
return false;
|
return false;
|
||||||
@@ -2579,14 +2579,14 @@ class ProductCore extends ObjectModel
|
|||||||
$return = true;
|
$return = true;
|
||||||
$combinationImages = array();
|
$combinationImages = array();
|
||||||
|
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'product_attribute`
|
FROM `'._DB_PREFIX_.'product_attribute`
|
||||||
WHERE `id_product` = '.(int)($id_product_old));
|
WHERE `id_product` = '.(int)($id_product_old));
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
{
|
{
|
||||||
$id_product_attribute_old = (int)($row['id_product_attribute']);
|
$id_product_attribute_old = (int)($row['id_product_attribute']);
|
||||||
$result2 = Db::getInstance()->ExecuteS('
|
$result2 = Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'product_attribute_combination`
|
FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||||
WHERE `id_product_attribute` = '.$id_product_attribute_old);
|
WHERE `id_product_attribute` = '.$id_product_attribute_old);
|
||||||
@@ -2618,7 +2618,7 @@ class ProductCore extends ObjectModel
|
|||||||
public static function _getAttributeImageAssociations($id_product_attribute)
|
public static function _getAttributeImageAssociations($id_product_attribute)
|
||||||
{
|
{
|
||||||
$combinationImages = array();
|
$combinationImages = array();
|
||||||
$data = Db::getInstance()->ExecuteS('
|
$data = Db::getInstance()->executeS('
|
||||||
SELECT `id_image`
|
SELECT `id_image`
|
||||||
FROM `'._DB_PREFIX_.'product_attribute_image`
|
FROM `'._DB_PREFIX_.'product_attribute_image`
|
||||||
WHERE `id_product_attribute` = '.(int)($id_product_attribute));
|
WHERE `id_product_attribute` = '.(int)($id_product_attribute));
|
||||||
@@ -2631,7 +2631,7 @@ class ProductCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$return = true;
|
$return = true;
|
||||||
|
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'accessory`
|
FROM `'._DB_PREFIX_.'accessory`
|
||||||
WHERE `id_product_1` = '.(int)($id_product_old));
|
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)
|
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())
|
if (!Db::getInstance()->NumRows())
|
||||||
return true;
|
return true;
|
||||||
$query = 'INSERT INTO `'._DB_PREFIX_.'product_tag` (`id_product`, `id_tag`) VALUES';
|
$query = 'INSERT INTO `'._DB_PREFIX_.'product_tag` (`id_product`, `id_tag`) VALUES';
|
||||||
foreach ($tags as $tag)
|
foreach ($tags as $tag)
|
||||||
$query .= ' ('.(int)($id_product_new).', '.(int)($tag['id_tag']).'),';
|
$query .= ' ('.(int)($id_product_new).', '.(int)($tag['id_tag']).'),';
|
||||||
$query = rtrim($query, ',');
|
$query = rtrim($query, ',');
|
||||||
return Db::getInstance()->Execute($query);
|
return Db::getInstance()->execute($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function duplicateDownload($id_product_old, $id_product_new)
|
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`
|
$sql = 'SELECT `display_filename`, `filename`, `date_add`, `date_expiration`, `nb_days_accessible`, `nb_downloadable`, `active`, `is_shareable`
|
||||||
FROM `'._DB_PREFIX_.'product_download`
|
FROM `'._DB_PREFIX_.'product_download`
|
||||||
WHERE `id_product` = '.(int)$id_product_old;
|
WHERE `id_product` = '.(int)$id_product_old;
|
||||||
$resource = Db::getInstance()->Execute($sql);
|
$resource = Db::getInstance()->execute($sql);
|
||||||
|
|
||||||
if (!Db::getInstance()->NumRows())
|
if (!Db::getInstance()->NumRows())
|
||||||
return true;
|
return true;
|
||||||
@@ -2670,7 +2670,7 @@ class ProductCore extends ObjectModel
|
|||||||
while ($row = Db::getInstance()->nextRow($resource))
|
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 .= ' ('.(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, ',');
|
$query = rtrim($query, ',');
|
||||||
return Db::getInstance()->Execute($query);
|
return Db::getInstance()->execute($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2683,7 +2683,7 @@ class ProductCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$return = true;
|
$return = true;
|
||||||
|
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'feature_product`
|
FROM `'._DB_PREFIX_.'feature_product`
|
||||||
WHERE `id_product` = '.(int)($id_product_old));
|
WHERE `id_product` = '.(int)($id_product_old));
|
||||||
@@ -2728,7 +2728,7 @@ class ProductCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
$customizations = array();
|
$customizations = array();
|
||||||
if (($customizations['fields'] = Db::getInstance()->ExecuteS('
|
if (($customizations['fields'] = Db::getInstance()->executeS('
|
||||||
SELECT `id_customization_field`, `type`, `required`
|
SELECT `id_customization_field`, `type`, `required`
|
||||||
FROM `'._DB_PREFIX_.'customization_field`
|
FROM `'._DB_PREFIX_.'customization_field`
|
||||||
WHERE `id_product` = '.(int)($productId).'
|
WHERE `id_product` = '.(int)($productId).'
|
||||||
@@ -2739,7 +2739,7 @@ class ProductCore extends ObjectModel
|
|||||||
$customizationFieldIds = array();
|
$customizationFieldIds = array();
|
||||||
foreach ($customizations['fields'] as $customizationField)
|
foreach ($customizations['fields'] as $customizationField)
|
||||||
$customizationFieldIds[] = (int)($customizationField['id_customization_field']);
|
$customizationFieldIds[] = (int)($customizationField['id_customization_field']);
|
||||||
if (($customizationLabels = Db::getInstance()->ExecuteS('
|
if (($customizationLabels = Db::getInstance()->executeS('
|
||||||
SELECT `id_customization_field`, `id_lang`, `name`
|
SELECT `id_customization_field`, `id_lang`, `name`
|
||||||
FROM `'._DB_PREFIX_.'customization_field_lang`
|
FROM `'._DB_PREFIX_.'customization_field_lang`
|
||||||
WHERE `id_customization_field` IN ('.implode(', ', $customizationFieldIds).')
|
WHERE `id_customization_field` IN ('.implode(', ', $customizationFieldIds).')
|
||||||
@@ -2781,7 +2781,7 @@ class ProductCore extends ObjectModel
|
|||||||
foreach ($customizations['labels'][$oldCustomizationFieldId] as $customizationLabel)
|
foreach ($customizations['labels'][$oldCustomizationFieldId] as $customizationLabel)
|
||||||
$query .= '('.(int)($customizationFieldId).', '.(int)($customizationLabel['id_lang']).', \''.pSQL($customizationLabel['name']).'\'), ';
|
$query .= '('.(int)($customizationFieldId).', '.(int)($customizationLabel['id_lang']).', \''.pSQL($customizationLabel['name']).'\'), ';
|
||||||
$query = rtrim($query, ', ');
|
$query = rtrim($query, ', ');
|
||||||
if (!Db::getInstance()->Execute($query))
|
if (!Db::getInstance()->execute($query))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2905,7 +2905,7 @@ class ProductCore extends ObjectModel
|
|||||||
return array();
|
return array();
|
||||||
if (!array_key_exists($id_product.'-'.$id_lang, self::$_frontFeaturesCache))
|
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
|
SELECT name, value, pf.id_feature
|
||||||
FROM '._DB_PREFIX_.'feature_product pf
|
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.')
|
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)
|
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 *
|
SELECT *
|
||||||
FROM '._DB_PREFIX_.'product_attachment pa
|
FROM '._DB_PREFIX_.'product_attachment pa
|
||||||
LEFT JOIN '._DB_PREFIX_.'attachment a ON a.id_attachment = pa.id_attachment
|
LEFT JOIN '._DB_PREFIX_.'attachment a ON a.id_attachment = pa.id_attachment
|
||||||
@@ -2952,7 +2952,7 @@ class ProductCore extends ObjectModel
|
|||||||
if (!$id_lang)
|
if (!$id_lang)
|
||||||
$id_lang = Context::getContext()->language->id;
|
$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`
|
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
|
FROM `'._DB_PREFIX_.'customized_data` cd
|
||||||
NATURAL JOIN `'._DB_PREFIX_.'customization` c
|
NATURAL JOIN `'._DB_PREFIX_.'customization` c
|
||||||
@@ -2964,7 +2964,7 @@ class ProductCore extends ObjectModel
|
|||||||
$customizedDatas = array();
|
$customizedDatas = array();
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
$customizedDatas[(int)($row['id_product'])][(int)($row['id_product_attribute'])][(int)($row['id_customization'])]['datas'][(int)($row['type'])][] = $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' : '')))
|
FROM `'._DB_PREFIX_.'customization` WHERE `id_cart` = '.(int)($id_cart).($only_in_cart ? ' AND `in_cart` = 1' : '')))
|
||||||
return false;
|
return false;
|
||||||
foreach ($result as $row)
|
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')));
|
$max = array(Product::CUSTOMIZE_FILE => (int)(Tools::getValue('uploadable_files')), Product::CUSTOMIZE_TEXTFIELD => (int)(Tools::getValue('text_fields')));
|
||||||
/* Get customization field ids */
|
/* 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)
|
ORDER BY `id_customization_field`')) === false)
|
||||||
return false;
|
return false;
|
||||||
if (empty($result))
|
if (empty($result))
|
||||||
@@ -3049,18 +3049,18 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
/* If too much inside the database, deletion */
|
/* If too much inside the database, deletion */
|
||||||
if ($extraFile > 0 && count($customizationFields[Product::CUSTOMIZE_FILE]) - $extraFile >= 0 &&
|
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.'
|
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]))
|
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`)')))
|
WHERE `id_customization_field` NOT IN (SELECT `id_customization_field` FROM `'._DB_PREFIX_.'customization_field`)')))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ($extraText > 0 && count($customizationFields[Product::CUSTOMIZE_TEXTFIELD]) - $extraText >= 0 &&
|
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.'
|
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]))
|
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`)')))
|
WHERE `id_customization_field` NOT IN (SELECT `id_customization_field` FROM `'._DB_PREFIX_.'customization_field`)')))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -3073,7 +3073,7 @@ class ProductCore extends ObjectModel
|
|||||||
protected function _createLabel(&$languages, $type)
|
protected function _createLabel(&$languages, $type)
|
||||||
{
|
{
|
||||||
// Label insertion
|
// Label insertion
|
||||||
if (!Db::getInstance()->Execute('
|
if (!Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'customization_field` (`id_product`, `type`, `required`)
|
INSERT INTO `'._DB_PREFIX_.'customization_field` (`id_product`, `type`, `required`)
|
||||||
VALUES ('.(int)$this->id.', '.(int)($type).', 0)') ||
|
VALUES ('.(int)$this->id.', '.(int)($type).', 0)') ||
|
||||||
!$id_customization_field = (int)(Db::getInstance()->Insert_ID()))
|
!$id_customization_field = (int)(Db::getInstance()->Insert_ID()))
|
||||||
@@ -3084,7 +3084,7 @@ class ProductCore extends ObjectModel
|
|||||||
foreach ($languages as $language)
|
foreach ($languages as $language)
|
||||||
$values .= '('.(int)($id_customization_field).', '.(int)($language['id_lang']).', \'\'), ';
|
$values .= '('.(int)($id_customization_field).', '.(int)($language['id_lang']).', \'\'), ';
|
||||||
$values = rtrim($values, ', ');
|
$values = rtrim($values, ', ');
|
||||||
if (!Db::getInstance()->Execute('
|
if (!Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'customization_field_lang` (`id_customization_field`, `id_lang`, `name`)
|
INSERT INTO `'._DB_PREFIX_.'customization_field_lang` (`id_customization_field`, `id_lang`, `name`)
|
||||||
VALUES '.$values))
|
VALUES '.$values))
|
||||||
return false;
|
return false;
|
||||||
@@ -3119,7 +3119,7 @@ class ProductCore extends ObjectModel
|
|||||||
if (!$tmp = $this->_checkLabelField($field, $value))
|
if (!$tmp = $this->_checkLabelField($field, $value))
|
||||||
return false;
|
return false;
|
||||||
/* Multilingual label name update */
|
/* Multilingual label name update */
|
||||||
if (!Db::getInstance()->Execute('
|
if (!Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'customization_field_lang`
|
INSERT INTO `'._DB_PREFIX_.'customization_field_lang`
|
||||||
(`id_customization_field`, `id_lang`, `name`) VALUES ('.(int)($tmp[2]).', '.(int)($tmp[3]).', \''.pSQL($value).'\')
|
(`id_customization_field`, `id_lang`, `name`) VALUES ('.(int)($tmp[2]).', '.(int)($tmp[3]).', \''.pSQL($value).'\')
|
||||||
ON DUPLICATE KEY UPDATE `name` = \''.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;
|
$isRequired = isset($_POST['require_'.(int)($tmp[1]).'_'.(int)($tmp[2])]) ? 1 : 0;
|
||||||
$hasRequiredFields |= $isRequired;
|
$hasRequiredFields |= $isRequired;
|
||||||
/* Require option update */
|
/* 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;
|
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;
|
return false;
|
||||||
if (!$this->_deleteOldLabels())
|
if (!$this->_deleteOldLabels())
|
||||||
return false;
|
return false;
|
||||||
@@ -3141,7 +3141,7 @@ class ProductCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!Customization::isFeatureActive())
|
if (!Customization::isFeatureActive())
|
||||||
return false;
|
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`
|
SELECT cf.`id_customization_field`, cf.`type`, cf.`required`, cfl.`name`, cfl.`id_lang`
|
||||||
FROM `'._DB_PREFIX_.'customization_field` cf
|
FROM `'._DB_PREFIX_.'customization_field` cf
|
||||||
NATURAL JOIN `'._DB_PREFIX_.'customization_field_lang` cfl
|
NATURAL JOIN `'._DB_PREFIX_.'customization_field_lang` cfl
|
||||||
@@ -3160,7 +3160,7 @@ class ProductCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!Customization::isFeatureActive())
|
if (!Customization::isFeatureActive())
|
||||||
return array();
|
return array();
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT `id_customization_field`, `type`
|
SELECT `id_customization_field`, `type`
|
||||||
FROM `'._DB_PREFIX_.'customization_field`
|
FROM `'._DB_PREFIX_.'customization_field`
|
||||||
WHERE `id_product` = '.(int)($this->id));
|
WHERE `id_product` = '.(int)($this->id));
|
||||||
@@ -3170,7 +3170,7 @@ class ProductCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!Customization::isFeatureActive())
|
if (!Customization::isFeatureActive())
|
||||||
return array();
|
return array();
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT `id_customization_field`, `type`
|
SELECT `id_customization_field`, `type`
|
||||||
FROM `'._DB_PREFIX_.'customization_field`
|
FROM `'._DB_PREFIX_.'customization_field`
|
||||||
WHERE `id_product` = '.(int)($this->id).'
|
WHERE `id_product` = '.(int)($this->id).'
|
||||||
@@ -3218,7 +3218,7 @@ class ProductCore extends ObjectModel
|
|||||||
if (isset(self::$_incat[md5($sql)]))
|
if (isset(self::$_incat[md5($sql)]))
|
||||||
return 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;
|
return false;
|
||||||
self::$_incat[md5($sql)] = (Db::getInstance(_PS_USE_SQL_SLAVE_)->NumRows() > 0 ? true : false);
|
self::$_incat[md5($sql)] = (Db::getInstance(_PS_USE_SQL_SLAVE_)->NumRows() > 0 ? true : false);
|
||||||
return self::$_incat[md5($sql)];
|
return self::$_incat[md5($sql)];
|
||||||
@@ -3292,7 +3292,7 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public function getStockMvts($id_lang)
|
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,
|
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
|
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
|
FROM `'._DB_PREFIX_.'stock_mvt` sm
|
||||||
@@ -3308,7 +3308,7 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getUrlRewriteInformations($id_product)
|
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
|
SELECT pl.`id_lang`, pl.`link_rewrite`, p.`ean13`, cl.`link_rewrite` AS category_rewrite
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product`'.Context::getContext()->shop->sqlLang('pl').')
|
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);
|
$ids = array_map('intval', $ids);
|
||||||
foreach ($ids as $position => $id)
|
foreach ($ids as $position => $id)
|
||||||
$sqlValues[] = '('.(int)$id.', '.(int)$this->id.', '.(int)$position.')';
|
$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`)
|
INSERT INTO `'._DB_PREFIX_.'category_product` (`id_category`, `id_product`, `position`)
|
||||||
VALUES '.implode(',', $sqlValues)
|
VALUES '.implode(',', $sqlValues)
|
||||||
);
|
);
|
||||||
@@ -3451,7 +3451,7 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getWsCombinations()
|
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;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3468,13 +3468,13 @@ class ProductCore extends ObjectModel
|
|||||||
$ids_new[] = (int)$combination['id'];
|
$ids_new[] = (int)$combination['id'];
|
||||||
|
|
||||||
$ids_orig = array();
|
$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))
|
if (is_array($original))
|
||||||
foreach ($original as $id)
|
foreach ($original as $id)
|
||||||
$ids_orig[] = $id['id'];
|
$ids_orig[] = $id['id'];
|
||||||
|
|
||||||
$all_ids = array();
|
$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))
|
if (is_array($all))
|
||||||
foreach ($all as $id)
|
foreach ($all as $id)
|
||||||
$all_ids[] = $id['id'];
|
$all_ids[] = $id['id'];
|
||||||
@@ -3491,15 +3491,15 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
// Delete rows
|
// Delete rows
|
||||||
if (count($toDelete) > 0)
|
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)
|
foreach ($toAdd as $id)
|
||||||
{
|
{
|
||||||
// Update id_product if exists else create
|
// Update id_product if exists else create
|
||||||
if (in_array($id, $all_ids))
|
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
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3511,7 +3511,7 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getWsProductOptionValues()
|
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
|
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.id_product_attribute = pa.id_product_attribute)
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.id_product_attribute = pa.id_product_attribute)
|
||||||
WHERE pa.id_product = '.(int)$this->id);
|
WHERE pa.id_product = '.(int)$this->id);
|
||||||
@@ -3525,7 +3525,7 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getWsPositionInCategory()
|
public function getWsPositionInCategory()
|
||||||
{
|
{
|
||||||
$result = Db::getInstance()->ExecuteS('SELECT position
|
$result = Db::getInstance()->executeS('SELECT position
|
||||||
FROM `'._DB_PREFIX_.'category_product`
|
FROM `'._DB_PREFIX_.'category_product`
|
||||||
WHERE id_category = '.(int)($this->id_category_default).'
|
WHERE id_category = '.(int)($this->id_category_default).'
|
||||||
AND id_product = '.(int)($this->id));
|
AND id_product = '.(int)($this->id));
|
||||||
@@ -3552,10 +3552,10 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function setCoverWs($id_image)
|
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).'
|
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);
|
SET `cover` = 1 WHERE `id_product` = '.(int)($this->id).' AND `id_image` = '.(int)$id_image);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3567,7 +3567,7 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getWsImages()
|
public function getWsImages()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT `id_image` as id
|
SELECT `id_image` as id
|
||||||
FROM `'._DB_PREFIX_.'image`
|
FROM `'._DB_PREFIX_.'image`
|
||||||
WHERE `id_product` = '.(int)($this->id).'
|
WHERE `id_product` = '.(int)($this->id).'
|
||||||
@@ -3576,7 +3576,7 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public function getWsTags()
|
public function getWsTags()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT `id_tag` as id
|
SELECT `id_tag` as id
|
||||||
FROM `'._DB_PREFIX_.'product_tag`
|
FROM `'._DB_PREFIX_.'product_tag`
|
||||||
WHERE `id_product` = '.(int)($this->id));
|
WHERE `id_product` = '.(int)($this->id));
|
||||||
@@ -3590,7 +3590,7 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public static function resetEcoTax()
|
public static function resetEcoTax()
|
||||||
{
|
{
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'product`
|
UPDATE `'._DB_PREFIX_.'product`
|
||||||
SET ecotax = 0
|
SET ecotax = 0
|
||||||
');
|
');
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ class ProductDownloadCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getAttributeFromIdProduct($id_product)
|
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`
|
SELECT `id_product_download`
|
||||||
FROM `'._DB_PREFIX_.'product_download`
|
FROM `'._DB_PREFIX_.'product_download`
|
||||||
WHERE `id_product` = '.(int)$id_product.' AND `active` = 1');
|
WHERE `id_product` = '.(int)$id_product.' AND `active` = 1');
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class ProductSaleCore
|
|||||||
(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
|
(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
|
||||||
SELECT od.product_id, COUNT(od.product_id), SUM(od.product_quantity), NOW()
|
SELECT od.product_id, COUNT(od.product_id), SUM(od.product_quantity), NOW()
|
||||||
FROM '._DB_PREFIX_.'order_detail od GROUP BY od.product_id';
|
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).'
|
ORDER BY `'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||||
LIMIT '.(int)($pageNumber * $nbProducts).', '.(int)$nbProducts;
|
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')
|
if ($orderBy == 'price')
|
||||||
Tools::orderbyPrice($result,$orderWay);
|
Tools::orderbyPrice($result,$orderWay);
|
||||||
@@ -147,7 +147,7 @@ class ProductSaleCore
|
|||||||
)
|
)
|
||||||
ORDER BY sales DESC
|
ORDER BY sales DESC
|
||||||
LIMIT '.(int)($pageNumber * $nbProducts).', '.(int)$nbProducts;
|
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;
|
return false;
|
||||||
|
|
||||||
foreach ($result AS &$row)
|
foreach ($result AS &$row)
|
||||||
@@ -160,7 +160,7 @@ class ProductSaleCore
|
|||||||
|
|
||||||
public static function addProductSale($product_id, $qty = 1)
|
public static function addProductSale($product_id, $qty = 1)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
INSERT INTO '._DB_PREFIX_.'product_sale
|
INSERT INTO '._DB_PREFIX_.'product_sale
|
||||||
(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
|
(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
|
||||||
VALUES ('.(int)($product_id).', '.(int)($qty).', 1, NOW())
|
VALUES ('.(int)($product_id).', '.(int)($qty).', 1, NOW())
|
||||||
@@ -179,9 +179,9 @@ class ProductSaleCore
|
|||||||
{
|
{
|
||||||
$nbrSales = self::getNbrSales($id_product);
|
$nbrSales = self::getNbrSales($id_product);
|
||||||
if ($nbrSales > 1)
|
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)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -60,7 +60,7 @@ class ProfileCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getProfiles($id_lang)
|
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`
|
SELECT p.`id_profile`, `name`
|
||||||
FROM `'._DB_PREFIX_.'profile` p
|
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).')
|
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))
|
if (parent::add($autodate, true))
|
||||||
return (
|
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_.'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_.'module_access (`id_profile`, `id_module`, `configure`, `view`) (SELECT '.(int)$this->id.', id_module, 0, 1 FROM '._DB_PREFIX_.'module)')
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -99,8 +99,8 @@ class ProfileCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (parent::delete())
|
if (parent::delete())
|
||||||
return (
|
return (
|
||||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'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)
|
&& Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'module_access` WHERE `id_profile` = '.(int)$this->id)
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ class ProfileCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!isset(self::$_cache_accesses[$id_profile]))
|
if (!isset(self::$_cache_accesses[$id_profile]))
|
||||||
{
|
{
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'access`
|
FROM `'._DB_PREFIX_.'access`
|
||||||
WHERE `id_profile` = '.(int)$id_profile);
|
WHERE `id_profile` = '.(int)$id_profile);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class QuickAccessCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getQuickAccesses($id_lang)
|
public static function getQuickAccesses($id_lang)
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'quick_access` qa
|
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).')
|
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)
|
public static function getRanges($id_carrier)
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'range_price`
|
FROM `'._DB_PREFIX_.'range_price`
|
||||||
WHERE `id_carrier` = '.(int)($id_carrier).'
|
WHERE `id_carrier` = '.(int)($id_carrier).'
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class RangeWeightCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getRanges($id_carrier)
|
public static function getRanges($id_carrier)
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'range_weight`
|
FROM `'._DB_PREFIX_.'range_weight`
|
||||||
WHERE `id_carrier` = '.(int)($id_carrier).'
|
WHERE `id_carrier` = '.(int)($id_carrier).'
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class ReferrerCore extends ObjectModel
|
|||||||
LEFT JOIN '._DB_PREFIX_.'connections_source cs ON ('.self::$_join.')
|
LEFT JOIN '._DB_PREFIX_.'connections_source cs ON ('.self::$_join.')
|
||||||
WHERE id_connections_source = '.(int)($id_connections_source).'
|
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).'
|
WHERE g.id_customer = '.(int)($id_customer).'
|
||||||
AND r.name IS NOT NULL
|
AND r.name IS NOT NULL
|
||||||
ORDER BY c.date_add DESC';
|
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)
|
public static function refreshCache($referrers = null, $employee = null)
|
||||||
{
|
{
|
||||||
if (!$referrers OR !is_array($referrers))
|
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)
|
foreach ($referrers as $row)
|
||||||
{
|
{
|
||||||
$referrer = new Referrer($row['id_referrer']);
|
$referrer = new Referrer($row['id_referrer']);
|
||||||
@@ -307,8 +307,8 @@ class ReferrerCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (!$referrers OR !is_array($referrers))
|
if (!$referrers OR !is_array($referrers))
|
||||||
{
|
{
|
||||||
Db::getInstance()->Execute('TRUNCATE '._DB_PREFIX_.'referrer_cache');
|
Db::getInstance()->execute('TRUNCATE '._DB_PREFIX_.'referrer_cache');
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
INSERT INTO '._DB_PREFIX_.'referrer_cache (id_referrer, id_connections_source) (
|
INSERT INTO '._DB_PREFIX_.'referrer_cache (id_referrer, id_connections_source) (
|
||||||
SELECT id_referrer, id_connections_source
|
SELECT id_referrer, id_connections_source
|
||||||
FROM '._DB_PREFIX_.'referrer r
|
FROM '._DB_PREFIX_.'referrer r
|
||||||
@@ -318,8 +318,8 @@ class ReferrerCore extends ObjectModel
|
|||||||
else
|
else
|
||||||
foreach ($referrers as $row)
|
foreach ($referrers as $row)
|
||||||
{
|
{
|
||||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'referrer_cache WHERE id_referrer = '.(int)($row['id_referrer']));
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'referrer_cache WHERE id_referrer = '.(int)($row['id_referrer']));
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
INSERT INTO '._DB_PREFIX_.'referrer_cache (id_referrer, id_connections_source) (
|
INSERT INTO '._DB_PREFIX_.'referrer_cache (id_referrer, id_connections_source) (
|
||||||
SELECT id_referrer, id_connections_source
|
SELECT id_referrer, id_connections_source
|
||||||
FROM '._DB_PREFIX_.'referrer r
|
FROM '._DB_PREFIX_.'referrer r
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class RequestSqlCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getRequestSql()
|
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;
|
return false;
|
||||||
$request_sql = array();
|
$request_sql = array();
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
@@ -77,7 +77,7 @@ class RequestSqlCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getRequestSqlById($id)
|
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)
|
public function parsingSql($sql)
|
||||||
@@ -140,14 +140,14 @@ class RequestSqlCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->_errors))
|
if (empty($this->_errors))
|
||||||
if (!Db::getInstance()->ExecuteS($sql))
|
if (!Db::getInstance()->executeS($sql))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showTables()
|
public function showTables()
|
||||||
{
|
{
|
||||||
$results = Db::getInstance()->ExecuteS('SHOW TABLES');
|
$results = Db::getInstance()->executeS('SHOW TABLES');
|
||||||
foreach ($results as $result)
|
foreach ($results as $result)
|
||||||
{
|
{
|
||||||
$key = array_keys($result);
|
$key = array_keys($result);
|
||||||
@@ -223,7 +223,7 @@ class RequestSqlCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (is_array($table) && (count($table) == 1))
|
if (is_array($table) && (count($table) == 1))
|
||||||
$table = $table[0];
|
$table = $table[0];
|
||||||
$attributs = Db::getInstance()->ExecuteS(sprintf('DESCRIBE `%s`', $table));
|
$attributs = Db::getInstance()->executeS(sprintf('DESCRIBE `%s`', $table));
|
||||||
foreach ($attributs as $attribut)
|
foreach ($attributs as $attribut)
|
||||||
if ($attribut['Field'] == trim($attr))
|
if ($attribut['Field'] == trim($attr))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+7
-7
@@ -146,7 +146,7 @@ class SceneCore extends ObjectModel
|
|||||||
$result = true;
|
$result = true;
|
||||||
foreach ($categories AS $category)
|
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;
|
$result = false;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
@@ -154,7 +154,7 @@ class SceneCore extends ObjectModel
|
|||||||
|
|
||||||
public function deleteCategories()
|
public function deleteCategories()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'scene_category`
|
DELETE FROM `'._DB_PREFIX_.'scene_category`
|
||||||
WHERE `id_scene` = '.(int)($this->id));
|
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
|
$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']).')';
|
('.(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;
|
$result = false;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
@@ -183,7 +183,7 @@ class SceneCore extends ObjectModel
|
|||||||
|
|
||||||
public function deleteZoneProducts()
|
public function deleteZoneProducts()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'scene_products`
|
DELETE FROM `'._DB_PREFIX_.'scene_products`
|
||||||
WHERE `id_scene` = '.(int)($this->id));
|
WHERE `id_scene` = '.(int)($this->id));
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ class SceneCore extends ObjectModel
|
|||||||
AND sl.id_lang = '.(int)$id_lang
|
AND sl.id_lang = '.(int)$id_lang
|
||||||
.($onlyActive ? ' AND s.active = 1' : '').'
|
.($onlyActive ? ' AND s.active = 1' : '').'
|
||||||
ORDER BY sl.name ASC';
|
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)
|
if (!$liteResult AND $scenes)
|
||||||
foreach($scenes AS &$scene)
|
foreach($scenes AS &$scene)
|
||||||
@@ -242,7 +242,7 @@ class SceneCore extends ObjectModel
|
|||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
$id_lang = is_null($id_lang) ? $context->language->id : $id_lang;
|
$id_lang = is_null($id_lang) ? $context->language->id : $id_lang;
|
||||||
|
|
||||||
$products = Db::getInstance()->ExecuteS('
|
$products = Db::getInstance()->executeS('
|
||||||
SELECT s.*
|
SELECT s.*
|
||||||
FROM `'._DB_PREFIX_.'scene_products` s
|
FROM `'._DB_PREFIX_.'scene_products` s
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = s.id_product)
|
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)
|
public static function getIndexedCategories($id_scene)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT `id_category`
|
SELECT `id_category`
|
||||||
FROM `'._DB_PREFIX_.'scene_category`
|
FROM `'._DB_PREFIX_.'scene_category`
|
||||||
WHERE `id_scene` = '.(int)($id_scene));
|
WHERE `id_scene` = '.(int)($id_scene));
|
||||||
|
|||||||
+15
-15
@@ -218,14 +218,14 @@ class SearchCore
|
|||||||
SELECT id_group FROM '._DB_PREFIX_.'customer_group
|
SELECT id_group FROM '._DB_PREFIX_.'customer_group
|
||||||
WHERE id_customer = '.(int)$id_customer.'
|
WHERE id_customer = '.(int)$id_customer.'
|
||||||
)');
|
)');
|
||||||
$result = $db->ExecuteS($sql, false);
|
$result = $db->executeS($sql, false);
|
||||||
|
|
||||||
$eligibleProducts = array();
|
$eligibleProducts = array();
|
||||||
while ($row = $db->nextRow($result))
|
while ($row = $db->nextRow($result))
|
||||||
$eligibleProducts[] = $row['id_product'];
|
$eligibleProducts[] = $row['id_product'];
|
||||||
foreach ($intersectArray as $query)
|
foreach ($intersectArray as $query)
|
||||||
{
|
{
|
||||||
$result = $db->ExecuteS($query, false);
|
$result = $db->executeS($query, false);
|
||||||
$eligibleProducts2 = array();
|
$eligibleProducts2 = array();
|
||||||
while ($row = $db->nextRow($result))
|
while ($row = $db->nextRow($result))
|
||||||
$eligibleProducts2[] = $row['id_product'];
|
$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').')
|
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.'
|
WHERE p.`id_product` '.$productPool.'
|
||||||
ORDER BY position DESC LIMIT 10';
|
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`,
|
$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.'
|
WHERE p.`id_product` '.$productPool.'
|
||||||
'.($orderBy ? 'ORDER BY '.$orderBy : '').($orderWay ? ' '.$orderWay : '').'
|
'.($orderBy ? 'ORDER BY '.$orderBy : '').($orderWay ? ' '.$orderWay : '').'
|
||||||
LIMIT '.(int)(($pageNumber - 1) * $pageSize).','.(int)$pageSize;
|
LIMIT '.(int)(($pageNumber - 1) * $pageSize).','.(int)$pageSize;
|
||||||
$result = $db->ExecuteS($sql);
|
$result = $db->executeS($sql);
|
||||||
|
|
||||||
$sql = 'SELECT COUNT(*)
|
$sql = 'SELECT COUNT(*)
|
||||||
FROM '._DB_PREFIX_.'product p
|
FROM '._DB_PREFIX_.'product p
|
||||||
@@ -296,7 +296,7 @@ class SearchCore
|
|||||||
public static function getTags($db, $id_product, $id_lang)
|
public static function getTags($db, $id_product, $id_lang)
|
||||||
{
|
{
|
||||||
$tags = '';
|
$tags = '';
|
||||||
$tagsArray = $db->ExecuteS('
|
$tagsArray = $db->executeS('
|
||||||
SELECT t.name FROM '._DB_PREFIX_.'product_tag pt
|
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.')
|
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);
|
WHERE pt.id_product = '.(int)$id_product);
|
||||||
@@ -311,7 +311,7 @@ class SearchCore
|
|||||||
return '';
|
return '';
|
||||||
|
|
||||||
$attributes = '';
|
$attributes = '';
|
||||||
$attributesArray = $db->ExecuteS('
|
$attributesArray = $db->executeS('
|
||||||
SELECT al.name FROM '._DB_PREFIX_.'product_attribute pa
|
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_.'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.')
|
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 '';
|
return '';
|
||||||
|
|
||||||
$features = '';
|
$features = '';
|
||||||
$featuresArray = $db->ExecuteS('
|
$featuresArray = $db->executeS('
|
||||||
SELECT fvl.value FROM '._DB_PREFIX_.'feature_product fp
|
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.')
|
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);
|
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)
|
// Adjust the limit to get only "whole" products, in every languages (and at least one)
|
||||||
$limit = max(1, round($limit / $nbLanguages) * $nbLanguages);
|
$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
|
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
|
FROM '._DB_PREFIX_.'product p
|
||||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON p.id_product = pl.id_product
|
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON p.id_product = pl.id_product
|
||||||
@@ -366,7 +366,7 @@ class SearchCore
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Do it even if you already know the product id in order to be sure that it exists
|
// 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
|
SELECT id_product
|
||||||
FROM '._DB_PREFIX_.'product
|
FROM '._DB_PREFIX_.'product
|
||||||
WHERE '.($id_product ? 'id_product = '.(int)$id_product : 'indexed = 0'));
|
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
|
// Every indexed words are cached into a PHP array
|
||||||
$wordIdsByWord = array();
|
$wordIdsByWord = array();
|
||||||
$wordIds = Db::getInstance()->ExecuteS('
|
$wordIds = Db::getInstance()->executeS('
|
||||||
SELECT id_word, word, id_lang, id_shop
|
SELECT id_word, word, id_lang, id_shop
|
||||||
FROM '._DB_PREFIX_.'search_word', false);
|
FROM '._DB_PREFIX_.'search_word', false);
|
||||||
$wordIdsByWord = array();
|
$wordIdsByWord = array();
|
||||||
@@ -458,7 +458,7 @@ class SearchCore
|
|||||||
$wordIdsByWord[$product['id_shop']][$product['id_lang']]['_'.$word] = 0;
|
$wordIdsByWord[$product['id_shop']][$product['id_lang']]['_'.$word] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$existingWords = $db->ExecuteS('
|
$existingWords = $db->executeS('
|
||||||
SELECT DISTINCT word FROM '._DB_PREFIX_.'search_word
|
SELECT DISTINCT word FROM '._DB_PREFIX_.'search_word
|
||||||
WHERE word IN ('.implode(',', $queryArray2).')
|
WHERE word IN ('.implode(',', $queryArray2).')
|
||||||
AND id_lang = '.(int)$product['id_lang']);
|
AND id_lang = '.(int)$product['id_lang']);
|
||||||
@@ -476,7 +476,7 @@ class SearchCore
|
|||||||
if (count($queryArray2))
|
if (count($queryArray2))
|
||||||
{
|
{
|
||||||
// ...then their IDs are retrieved and added to the cache
|
// ...then their IDs are retrieved and added to the cache
|
||||||
$addedWords = $db->ExecuteS('
|
$addedWords = $db->executeS('
|
||||||
SELECT sw.id_word, sw.word
|
SELECT sw.id_word, sw.word
|
||||||
FROM '._DB_PREFIX_.'search_word sw
|
FROM '._DB_PREFIX_.'search_word sw
|
||||||
WHERE sw.word IN ('.implode(',', $queryArray2).')
|
WHERE sw.word IN ('.implode(',', $queryArray2).')
|
||||||
@@ -517,7 +517,7 @@ class SearchCore
|
|||||||
protected static function setProductsAsIndexed(&$products)
|
protected static function setProductsAsIndexed(&$products)
|
||||||
{
|
{
|
||||||
if (count($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();
|
$productsArray = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -525,7 +525,7 @@ class SearchCore
|
|||||||
protected static function saveIndex(&$queryArray3)
|
protected static function saveIndex(&$queryArray3)
|
||||||
{
|
{
|
||||||
if (count($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();
|
$queryArray3 = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,7 +587,7 @@ class SearchCore
|
|||||||
AND t.`name` LIKE \'%'.pSQL($tag).'%\'
|
AND t.`name` LIKE \'%'.pSQL($tag).'%\'
|
||||||
ORDER BY position DESC'.($orderBy ? ', '.$orderBy : '').($orderWay ? ' '.$orderWay : '').'
|
ORDER BY position DESC'.($orderBy ? ', '.$orderBy : '').($orderWay ? ' '.$orderWay : '').'
|
||||||
LIMIT '.(int)(($pageNumber - 1) * $pageSize).','.(int)$pageSize;
|
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 false;
|
||||||
|
|
||||||
return Product::getProductsProperties((int)$id_lang, $result);
|
return Product::getProductsProperties((int)$id_lang, $result);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class SearchEngineCore extends ObjectModel
|
|||||||
$parsedUrl = @parse_url($url);
|
$parsedUrl = @parse_url($url);
|
||||||
if (!isset($parsedUrl['host']) OR !isset($parsedUrl['query']))
|
if (!isset($parsedUrl['host']) OR !isset($parsedUrl['query']))
|
||||||
return false;
|
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)
|
foreach ($result as $row)
|
||||||
{
|
{
|
||||||
$host =& $row['server'];
|
$host =& $row['server'];
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getByProductId($id_product)
|
public static function getByProductId($id_product)
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'specific_price`
|
FROM `'._DB_PREFIX_.'specific_price`
|
||||||
WHERE `id_product` = '.(int)$id_product);
|
WHERE `id_product` = '.(int)$id_product);
|
||||||
@@ -97,7 +97,7 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getIdsByProductId($id_product)
|
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`
|
SELECT `id_specific_price`
|
||||||
FROM `'._DB_PREFIX_.'specific_price`
|
FROM `'._DB_PREFIX_.'specific_price`
|
||||||
WHERE `id_product` = '.(int)$id_product);
|
WHERE `id_product` = '.(int)$id_product);
|
||||||
@@ -185,7 +185,7 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
|
|
||||||
public static function deletePriorities()
|
public static function deletePriorities()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
TRUNCATE `'._DB_PREFIX_.'specific_price_priority`
|
TRUNCATE `'._DB_PREFIX_.'specific_price_priority`
|
||||||
');
|
');
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
foreach ($priorities as $priority)
|
foreach ($priorities as $priority)
|
||||||
$value .= pSQL($priority).';';
|
$value .= pSQL($priority).';';
|
||||||
|
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'specific_price_priority` (`id_product`, `priority`)
|
INSERT INTO `'._DB_PREFIX_.'specific_price_priority` (`id_product`, `priority`)
|
||||||
VALUES ('.(int)$id_product.',\''.pSQL(rtrim($value, ';')).'\')
|
VALUES ('.(int)$id_product.',\''.pSQL(rtrim($value, ';')).'\')
|
||||||
ON DUPLICATE KEY UPDATE `priority` = \''.pSQL(rtrim($value, ';')).'\'
|
ON DUPLICATE KEY UPDATE `priority` = \''.pSQL(rtrim($value, ';')).'\'
|
||||||
@@ -209,7 +209,7 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
return array();
|
return array();
|
||||||
|
|
||||||
$now = date('Y-m-d H:i:s');
|
$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 *,
|
SELECT *,
|
||||||
'.self::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group).'
|
'.self::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group).'
|
||||||
FROM `'._DB_PREFIX_.'specific_price`
|
FROM `'._DB_PREFIX_.'specific_price`
|
||||||
@@ -276,7 +276,7 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
if (!self::isFeatureActive())
|
if (!self::isFeatureActive())
|
||||||
return array();
|
return array();
|
||||||
|
|
||||||
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT `id_product`
|
SELECT `id_product`
|
||||||
FROM `'._DB_PREFIX_.'specific_price`
|
FROM `'._DB_PREFIX_.'specific_price`
|
||||||
WHERE `id_shop` IN(0, '.(int)$id_shop.') AND
|
WHERE `id_shop` IN(0, '.(int)$id_shop.') AND
|
||||||
@@ -300,7 +300,7 @@ class SpecificPriceCore extends ObjectModel
|
|||||||
|
|
||||||
public static function deleteByProductId($id_product)
|
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
|
// Refresh cache of feature detachable
|
||||||
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', self::isCurrentlyUsed('specific_price'));
|
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)
|
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`
|
SELECT `id_state`, `id_country`, `id_zone`, `iso_code`, `name`, `active`
|
||||||
FROM `'._DB_PREFIX_.'state`
|
FROM `'._DB_PREFIX_.'state`
|
||||||
'.($active ? 'WHERE active = 1' : '').'
|
'.($active ? 'WHERE active = 1' : '').'
|
||||||
@@ -136,13 +136,13 @@ class StateCore extends ObjectModel
|
|||||||
if (!$this->isUsed())
|
if (!$this->isUsed())
|
||||||
{
|
{
|
||||||
/* Database deletion */
|
/* 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)
|
if (!$result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Database deletion for multilingual fields related to the object */
|
/* Database deletion for multilingual fields related to the object */
|
||||||
if (method_exists($this, 'getTranslationsFieldsChild'))
|
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;
|
return $result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -178,7 +178,7 @@ class StateCore extends ObjectModel
|
|||||||
if (empty($id_country))
|
if (empty($id_country))
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'state` s
|
FROM `'._DB_PREFIX_.'state` s
|
||||||
WHERE s.`id_country` = '.(int)$id_country
|
WHERE s.`id_country` = '.(int)$id_country
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class StockMvtCore extends ObjectModel
|
|||||||
) = 0
|
) = 0
|
||||||
GROUP BY s.id_product, s.id_shop
|
GROUP BY s.id_product, s.id_shop
|
||||||
HAVING qty <> 0';
|
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
|
// Search missing stock movement on products with attributes
|
||||||
$sql = 'SELECT s.id_stock, (stock.quantity - SUM(IFNULL(sm.quantity, 0))) AS qty
|
$sql = 'SELECT s.id_stock, (stock.quantity - SUM(IFNULL(sm.quantity, 0))) AS qty
|
||||||
@@ -114,7 +114,7 @@ class StockMvtCore extends ObjectModel
|
|||||||
) > 0
|
) > 0
|
||||||
GROUP BY s.id_product_attribute
|
GROUP BY s.id_product_attribute
|
||||||
HAVING qty <> 0';
|
HAVING qty <> 0';
|
||||||
$products_with_attributes = Db::getInstance()->ExecuteS($sql);
|
$products_with_attributes = Db::getInstance()->executeS($sql);
|
||||||
|
|
||||||
// Add missing stock movements
|
// Add missing stock movements
|
||||||
$products = array_merge($products_without_attributes, $products_with_attributes);
|
$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
|
$sql = 'SELECT smrl.name, smr.id_stock_mvt_reason, smr.sign
|
||||||
FROM '._DB_PREFIX_.'stock_mvt_reason smr
|
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.')';
|
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()
|
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;
|
return false;
|
||||||
$subDomains = array();
|
$subDomains = array();
|
||||||
foreach ($result AS $row)
|
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).')
|
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 ' : '');
|
'.($active ? ' WHERE s.`active` = 1 ' : '');
|
||||||
$query .= ' ORDER BY s.`name` ASC'.($p ? ' LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n) : '');
|
$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)
|
if ($suppliers === false)
|
||||||
return false;
|
return false;
|
||||||
if ($getNbProducts)
|
if ($getNbProducts)
|
||||||
@@ -146,7 +146,7 @@ class SupplierCore extends ObjectModel
|
|||||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||||
WHERE cg.`id_group` '.$sqlGroups.'
|
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);
|
$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' : '').'
|
($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
|
||||||
WHERE cg.`id_group` '.$sqlGroups.'
|
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));
|
return (int)(sizeof($result));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ class SupplierCore extends ObjectModel
|
|||||||
ORDER BY '.(($orderBy == 'id_product') ? 'p.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
ORDER BY '.(($orderBy == 'id_product') ? 'p.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||||
LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n);
|
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)
|
if (!$result)
|
||||||
return false;
|
return false;
|
||||||
if ($orderBy == 'price')
|
if ($orderBy == 'price')
|
||||||
@@ -249,7 +249,7 @@ class SupplierCore extends ObjectModel
|
|||||||
|
|
||||||
public function getProductsLite($id_lang)
|
public function getProductsLite($id_lang)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT p.`id_product`, pl.`name`
|
SELECT p.`id_product`, pl.`name`
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
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).')
|
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)
|
if (!$context->employee->id_profile)
|
||||||
return false;
|
return false;
|
||||||
/* Profile selection */
|
/* 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))
|
if (!$profiles || empty($profiles))
|
||||||
return false;
|
return false;
|
||||||
/* Query definition */
|
/* Query definition */
|
||||||
@@ -120,12 +120,12 @@ class TabCore extends ObjectModel
|
|||||||
$query .= '('.$profile['id_profile'].', '.(int)$id_tab.', '.$rights.', '.$rights.', '.$rights.', '.$rights.'),';
|
$query .= '('.$profile['id_profile'].', '.(int)$id_tab.', '.$rights.', '.$rights.', '.$rights.', '.$rights.'),';
|
||||||
}
|
}
|
||||||
$query = trim($query, ', ');
|
$query = trim($query, ', ');
|
||||||
return Db::getInstance()->Execute($query);
|
return Db::getInstance()->execute($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
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 $this->cleanPositions($this->id_parent);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ class TabCore extends ObjectModel
|
|||||||
if (!isset(self::$_cache_tabs[$id_lang]))
|
if (!isset(self::$_cache_tabs[$id_lang]))
|
||||||
{
|
{
|
||||||
self::$_cache_tabs[$id_lang] = array();
|
self::$_cache_tabs[$id_lang] = array();
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'tab` t
|
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.')
|
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)
|
if (self::$_getIdFromClassName === null)
|
||||||
{
|
{
|
||||||
self::$_getIdFromClassName = array();
|
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)
|
foreach ($result as $row)
|
||||||
self::$_getIdFromClassName[$row['class_name']] = $row['id_tab'];
|
self::$_getIdFromClassName[$row['class_name']] = $row['id_tab'];
|
||||||
}
|
}
|
||||||
@@ -250,7 +250,7 @@ class TabCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
$new_position = ($direction == 'l') ? $this->position - 1 : $this->position + 1;
|
$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.'
|
SET position = '.(int)$this->position.'
|
||||||
WHERE id_parent = '.(int)$this->id_parent.' AND position = '.(int)$new_position);
|
WHERE id_parent = '.(int)$this->id_parent.' AND position = '.(int)$new_position);
|
||||||
$this->position = $new_position;
|
$this->position = $new_position;
|
||||||
@@ -259,14 +259,14 @@ class TabCore extends ObjectModel
|
|||||||
|
|
||||||
public function cleanPositions($id_parent)
|
public function cleanPositions($id_parent)
|
||||||
{
|
{
|
||||||
$result = Db::getInstance()->ExecuteS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT `id_tab`
|
SELECT `id_tab`
|
||||||
FROM `'._DB_PREFIX_.'tab`
|
FROM `'._DB_PREFIX_.'tab`
|
||||||
WHERE `id_parent` = '.(int)$id_parent.'
|
WHERE `id_parent` = '.(int)$id_parent.'
|
||||||
ORDER BY `position`');
|
ORDER BY `position`');
|
||||||
$sizeof = count($result);
|
$sizeof = count($result);
|
||||||
for ($i = 0; $i < $sizeof; ++$i)
|
for ($i = 0; $i < $sizeof; ++$i)
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->execute('
|
||||||
UPDATE `'._DB_PREFIX_.'tab`
|
UPDATE `'._DB_PREFIX_.'tab`
|
||||||
SET `position` = '.($i + 1).'
|
SET `position` = '.($i + 1).'
|
||||||
WHERE `id_tab` = '.(int)$result[$i]['id_tab']);
|
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 .= '('.(int)$tag.','.(int)$id_product.'),';
|
||||||
$data = rtrim($data, ',');
|
$data = rtrim($data, ',');
|
||||||
|
|
||||||
return Db::getInstance()->Execute('
|
return Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'product_tag` (`id_tag`, `id_product`)
|
INSERT INTO `'._DB_PREFIX_.'product_tag` (`id_tag`, `id_product`)
|
||||||
VALUES '.$data);
|
VALUES '.$data);
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ class TagCore extends ObjectModel
|
|||||||
$groups = FrontController::getCurrentCustomerGroups();
|
$groups = FrontController::getCurrentCustomerGroups();
|
||||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
$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
|
SELECT t.name, COUNT(pt.id_tag) AS times
|
||||||
FROM `'._DB_PREFIX_.'product_tag` pt
|
FROM `'._DB_PREFIX_.'product_tag` pt
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tag` t ON (t.id_tag = pt.id_tag)
|
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)
|
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`
|
SELECT t.`id_lang`, t.`name`
|
||||||
FROM '._DB_PREFIX_.'tag t
|
FROM '._DB_PREFIX_.'tag t
|
||||||
LEFT JOIN '._DB_PREFIX_.'product_tag pt ON (pt.id_tag = t.id_tag)
|
LEFT JOIN '._DB_PREFIX_.'product_tag pt ON (pt.id_tag = t.id_tag)
|
||||||
@@ -171,7 +171,7 @@ class TagCore extends ObjectModel
|
|||||||
return array();
|
return array();
|
||||||
|
|
||||||
$in = $associated ? 'IN' : 'NOT IN';
|
$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
|
SELECT pl.name, pl.id_product
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.id_product = pl.id_product'.$context->shop->sqlLang('pl').'
|
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)
|
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))
|
if (is_array($array))
|
||||||
{
|
{
|
||||||
$array = array_map('intval', $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();
|
$ids = array();
|
||||||
foreach ($array as $id_product)
|
foreach ($array as $id_product)
|
||||||
$ids[] = '('.(int)$id_product.','.(int)$this->id.')';
|
$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;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteTagsForProduct($id_product)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loaded 100 of 280 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user