// Merge -> revision 8552
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8554 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -191,7 +191,10 @@ class CategoryCore extends ObjectModel
|
||||
$this->position = self::getLastPosition((int)$this->id_parent);
|
||||
$ret = parent::update($nullValues);
|
||||
if (!isset($this->doNotRegenerateNTree) OR !$this->doNotRegenerateNTree)
|
||||
{
|
||||
self::regenerateEntireNtree();
|
||||
$this->recalculateLevelDepth($this->id_category);
|
||||
}
|
||||
Module::hookExec('categoryUpdate', array('category' => $this));
|
||||
return $ret;
|
||||
}
|
||||
@@ -395,6 +398,27 @@ class CategoryCore extends ObjectModel
|
||||
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'category SET nleft = '.(int)$left.', nright = '.(int)$right.' WHERE id_category = '.(int)$id_category.' LIMIT 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-calculate the levels of all childs
|
||||
*/
|
||||
public function recalculateLevelDepth($id_category)
|
||||
{
|
||||
/* Gets all childs */
|
||||
$categories = Db::getInstance()->ExecuteS('SELECT id_category, id_parent, level_depth FROM '._DB_PREFIX_.'category
|
||||
WHERE id_parent = '.$id_category);
|
||||
$level = Db::getInstance()->getRow('SELECT level_depth FROM '._DB_PREFIX_.'category
|
||||
WHERE id_category = '.$id_category);
|
||||
/* Update level of depth for all childs */
|
||||
foreach ($categories as $sub_category)
|
||||
{
|
||||
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'category
|
||||
SET level_depth = '.($level['level_depth'] + 1).'
|
||||
WHERE id_category = '.$sub_category['id_category']);
|
||||
/* Recursive call */
|
||||
$this->recalculateLevelDepth($sub_category['id_category']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return available categories
|
||||
*
|
||||
|
||||
+4
-2
@@ -74,7 +74,11 @@ class TabCore extends ObjectModel
|
||||
{
|
||||
$this->position = self::getNbTabs($this->id_parent) + 1;
|
||||
if (parent::add($autodate, $nullValues))
|
||||
{
|
||||
// refresh cache when adding new tab
|
||||
self::$_getIdFromClassName[$this->class_name] = $this->id;
|
||||
return self::initAccess($this->id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -235,5 +239,3 @@ class TabCore extends ObjectModel
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+9
-6
@@ -665,9 +665,12 @@ class ToolsCore
|
||||
{
|
||||
if (empty($row['meta_description']))
|
||||
$row['meta_description'] = strip_tags($row['description']);
|
||||
$row['meta_title'] .= $row['name'] . (!empty($page_number) ? ' ('.$page_number.')' : '');
|
||||
$row['meta_title'] .= ' - '.Configuration::get('PS_SHOP_NAME');
|
||||
return self::completeMetaTags($row, $row['meta_title']);
|
||||
if (!empty($row['meta_title']))
|
||||
$row['meta_title'] = $row['meta_title'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME');
|
||||
else
|
||||
$row['meta_title'] = $row['name'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME');
|
||||
|
||||
return self::completeMetaTags($row, $row['name']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -764,11 +767,11 @@ class ToolsCore
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
if ($metaTags['meta_title'] == NULL)
|
||||
if (empty($metaTags['meta_title']))
|
||||
$metaTags['meta_title'] = $defaultValue.' - '.Configuration::get('PS_SHOP_NAME');
|
||||
if ($metaTags['meta_description'] == NULL)
|
||||
if (empty($metaTags['meta_description']))
|
||||
$metaTags['meta_description'] = Configuration::get('PS_META_DESCRIPTION', $context->language->id) ? Configuration::get('PS_META_DESCRIPTION', $context->language->id) : '';
|
||||
if ($metaTags['meta_keywords'] == NULL)
|
||||
if (empty($metaTags['meta_keywords']))
|
||||
$metaTags['meta_keywords'] = Configuration::get('PS_META_KEYWORDS', $context->language->id) ? Configuration::get('PS_META_KEYWORDS', $context->language->id) : '';
|
||||
return $metaTags;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user