[-] CORE : Could not add too long tags
This commit is contained in:
+16
-14
@@ -100,22 +100,24 @@ class TagCore extends ObjectModel
|
|||||||
$tag_list = array_filter(array_unique(array_map('trim', preg_split('#\\'.$separator.'#', $tag_list, null, PREG_SPLIT_NO_EMPTY))));
|
$tag_list = array_filter(array_unique(array_map('trim', preg_split('#\\'.$separator.'#', $tag_list, null, PREG_SPLIT_NO_EMPTY))));
|
||||||
|
|
||||||
$list = array();
|
$list = array();
|
||||||
foreach ($tag_list as $tag)
|
if (is_array($tag_list))
|
||||||
{
|
foreach ($tag_list as $tag)
|
||||||
if (!Validate::isGenericName($tag))
|
|
||||||
return false;
|
|
||||||
$tag_obj = new Tag(null, trim($tag), (int)$id_lang);
|
|
||||||
|
|
||||||
/* Tag does not exist in database */
|
|
||||||
if (!Validate::isLoadedObject($tag_obj))
|
|
||||||
{
|
{
|
||||||
$tag_obj->name = trim($tag);
|
if (!Validate::isGenericName($tag))
|
||||||
$tag_obj->id_lang = (int)$id_lang;
|
return false;
|
||||||
$tag_obj->add();
|
$tag = trim(substr($tag, 0, self::$definition['fields']['name']['size']));
|
||||||
|
$tag_obj = new Tag(null, $tag), (int)$id_lang);
|
||||||
|
|
||||||
|
/* Tag does not exist in database */
|
||||||
|
if (!Validate::isLoadedObject($tag_obj))
|
||||||
|
{
|
||||||
|
$tag_obj->name = $tag;
|
||||||
|
$tag_obj->id_lang = (int)$id_lang;
|
||||||
|
$tag_obj->add();
|
||||||
|
}
|
||||||
|
if (!in_array($tag_obj->id, $list))
|
||||||
|
$list[] = $tag_obj->id;
|
||||||
}
|
}
|
||||||
if (!in_array($tag_obj->id, $list))
|
|
||||||
$list[] = $tag_obj->id;
|
|
||||||
}
|
|
||||||
$data = '';
|
$data = '';
|
||||||
foreach ($list as $tag)
|
foreach ($list as $tag)
|
||||||
$data .= '('.(int)$tag.','.(int)$id_product.'),';
|
$data .= '('.(int)$tag.','.(int)$id_product.'),';
|
||||||
|
|||||||
Reference in New Issue
Block a user