// Normalization
This commit is contained in:
1 parent
a78e7ecdb0
commit
5f7c2386bd
3 files changed
+28
-34
No files matched your search
@@ -112,9 +112,7 @@ class Autoload
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->index[$classname]))
|
if (isset($this->index[$classname]))
|
||||||
{
|
|
||||||
require_once($this->root_dir.$this->index[$classname]);
|
require_once($this->root_dir.$this->index[$classname]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Call directly ProductCore, ShopCore class
|
// Call directly ProductCore, ShopCore class
|
||||||
|
|||||||
+22
-26
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
class CMSCore extends ObjectModel
|
class CMSCore extends ObjectModel
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var string Name */
|
/** @var string Name */
|
||||||
public $meta_title;
|
public $meta_title;
|
||||||
public $meta_description;
|
public $meta_description;
|
||||||
@@ -88,7 +87,7 @@ class CMSCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getLinks($id_lang, $selection = NULL, $active = true, Link $link = null)
|
public static function getLinks($id_lang, $selection = null, $active = true, Link $link = null)
|
||||||
{
|
{
|
||||||
if (!$link)
|
if (!$link)
|
||||||
$link = Context::getContext()->link;
|
$link = Context::getContext()->link;
|
||||||
@@ -97,7 +96,7 @@ class CMSCore extends ObjectModel
|
|||||||
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).')
|
||||||
WHERE 1
|
WHERE 1
|
||||||
'.(($selection !== NULL) ? ' AND c.id_cms IN ('.implode(',', array_map('intval', $selection)).')' : '').
|
'.(($selection !== null) ? ' AND c.id_cms IN ('.implode(',', array_map('intval', $selection)).')' : '').
|
||||||
($active ? ' AND c.`active` = 1 ' : '').
|
($active ? ' AND c.`active` = 1 ' : '').
|
||||||
'ORDER BY c.`position`');
|
'ORDER BY c.`position`');
|
||||||
|
|
||||||
@@ -111,7 +110,7 @@ class CMSCore extends ObjectModel
|
|||||||
return $links;
|
return $links;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function listCms($id_lang = NULL, $id_block = false, $active = true)
|
public static function listCms($id_lang = null, $id_block = false, $active = true)
|
||||||
{
|
{
|
||||||
if (empty($id_lang))
|
if (empty($id_lang))
|
||||||
$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
|
$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||||
@@ -135,7 +134,7 @@ class CMSCore extends ObjectModel
|
|||||||
))
|
))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach ($res AS $cms)
|
foreach ($res as $cms)
|
||||||
if ((int)($cms['id_cms']) == (int)($this->id))
|
if ((int)($cms['id_cms']) == (int)($this->id))
|
||||||
$movedCms = $cms;
|
$movedCms = $cms;
|
||||||
|
|
||||||
@@ -152,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']))
|
||||||
AND 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']).'
|
||||||
@@ -166,15 +165,14 @@ class CMSCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'cms`
|
FROM `'._DB_PREFIX_.'cms`
|
||||||
WHERE `id_cms_category` = '.(int)($id_category).'
|
WHERE `id_cms_category` = '.(int)($id_category).'
|
||||||
ORDER BY `position`');
|
ORDER BY `position`');
|
||||||
$sizeof = sizeof($result);
|
for ($i = 0, $total = count($result); $i < $sizeof; ++$i)
|
||||||
for ($i = 0; $i < $sizeof; ++$i){
|
{
|
||||||
$sql = '
|
$sql = 'UPDATE `'._DB_PREFIX_.'cms`
|
||||||
UPDATE `'._DB_PREFIX_.'cms`
|
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 +181,7 @@ class CMSCore extends ObjectModel
|
|||||||
return (Db::getInstance()->getValue('SELECT MAX(position)+1 FROM `'._DB_PREFIX_.'cms` WHERE `id_cms_category` = '.(int)($id_category)));
|
return (Db::getInstance()->getValue('SELECT MAX(position)+1 FROM `'._DB_PREFIX_.'cms` WHERE `id_cms_category` = '.(int)($id_category)));
|
||||||
}
|
}
|
||||||
|
|
||||||
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 *
|
||||||
@@ -194,16 +192,14 @@ class CMSCore extends ObjectModel
|
|||||||
AND l.id_lang = '.(int)($id_lang).'
|
AND l.id_lang = '.(int)($id_lang).'
|
||||||
ORDER BY `position`');
|
ORDER BY `position`');
|
||||||
}
|
}
|
||||||
public static function getUrlRewriteInformations($id_cms)
|
|
||||||
|
public static function getUrlRewriteInformations($id_cms)
|
||||||
{
|
{
|
||||||
$sql = '
|
$sql = 'SELECT l.`id_lang`, c.`link_rewrite`
|
||||||
SELECT l.`id_lang`, c.`link_rewrite`
|
FROM `'._DB_PREFIX_.'cms_lang` AS c
|
||||||
FROM `'._DB_PREFIX_.'cms_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`
|
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);
|
||||||
$arr_return = Db::getInstance()->ExecuteS($sql);
|
|
||||||
return $arr_return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+6
-6
@@ -122,7 +122,7 @@ class ShopCore extends ObjectModel
|
|||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct($id = NULL, $id_lang = NULL, $id_shop = NULL)
|
public function __construct($id = null, $id_lang = null, $id_shop = null)
|
||||||
{
|
{
|
||||||
parent::__construct($id, $id_lang, $id_shop);
|
parent::__construct($id, $id_lang, $id_shop);
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ class ShopCore extends ObjectModel
|
|||||||
|
|
||||||
public function add($autodate = true, $nullValues = false)
|
public function add($autodate = true, $nullValues = false)
|
||||||
{
|
{
|
||||||
$res = parent::add();
|
$res = parent::add($autodate, $nullValues);
|
||||||
Shop::cacheShops(true);
|
Shop::cacheShops(true);
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
@@ -289,7 +289,7 @@ class ShopCore extends ObjectModel
|
|||||||
*
|
*
|
||||||
* @return GroupShop
|
* @return GroupShop
|
||||||
*/
|
*/
|
||||||
public function getGroup($asObject = false)
|
public function getGroup()
|
||||||
{
|
{
|
||||||
if (!$this->group)
|
if (!$this->group)
|
||||||
$this->group = new GroupShop($this->getGroupID());
|
$this->group = new GroupShop($this->getGroupID());
|
||||||
@@ -765,10 +765,10 @@ class ShopCore extends ObjectModel
|
|||||||
Db::getInstance()->Execute($sql);
|
Db::getInstance()->Execute($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
/*else
|
||||||
{
|
{
|
||||||
//Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.$table_name.'` SET WHERE `'.$id.'`='.(int)$old_id);
|
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.$table_name.'` SET WHERE `'.$id.'`='.(int)$old_id);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user