Merge branch 'develop' of gitlab.antadis.net:dev-antadis/bebeboutik into develop

This commit is contained in:
root 2017-06-12 14:42:39 +02:00
commit 000259f32e
2 changed files with 23 additions and 13 deletions

View File

@ -745,20 +745,27 @@ class AdminImport extends AdminTab
} }
$product->id_category_default = isset($product->id_category[0]) ? (int)($product->id_category[0]) : ''; $product->id_category_default = isset($product->id_category[0]) ? (int)($product->id_category[0]) : '';
$link_rewrite = (is_array($product->link_rewrite) && count($product->link_rewrite)) ? $product->link_rewrite[$defaultLanguageId] : '';
$lang_to_rewrite = ($iso_lang == 'es' ? 3 : $defaultLanguageId);
$link_rewrite = (is_array($product->link_rewrite) && count($product->link_rewrite)) ? $product->link_rewrite[$lang_to_rewrite] : '';
$valid_link = Validate::isLinkRewrite($link_rewrite); $valid_link = Validate::isLinkRewrite($link_rewrite);
if ((isset($product->link_rewrite[$defaultLanguageId]) AND empty($product->link_rewrite[$defaultLanguageId])) OR !$valid_link) if ((isset($product->link_rewrite[$lang_to_rewrite]) AND empty($product->link_rewrite[$lang_to_rewrite])) OR !$valid_link OR $lang_to_rewrite==3)
{ {
$link_rewrite = Tools::link_rewrite($product->name[$defaultLanguageId]); $link_rewrite = Tools::link_rewrite($product->name[$lang_to_rewrite]);
if ($link_rewrite == '') if ($link_rewrite == '')
$link_rewrite = 'friendly-url-autogeneration-failed'; $link_rewrite = 'friendly-url-autogeneration-failed';
} }
if (!$valid_link) if (!$valid_link)
$this->_warnings[] = Tools::displayError('Rewrite link for'). ' '.$link_rewrite.(isset($info['id']) ? ' (ID '.$info['id'].') ' : '').' '.Tools::displayError('was re-written as').' '.$link_rewrite; $this->_warnings[] = Tools::displayError('Rewrite link for'). ' '.$link_rewrite.(isset($info['id']) ? ' (ID '.$info['id'].') ' : '').' '.Tools::displayError('was re-written as').' '.$link_rewrite;
$product->link_rewrite = self::createMultiLangField($link_rewrite); if(!is_array($product->link_rewrite)){
$product->link_rewrite = self::createMultiLangField($link_rewrite);
} else {
$product->link_rewrite[$lang_to_rewrite] = $link_rewrite;
}
$res = false; $res = false;
$fieldError = $product->validateFields(UNFRIENDLY_ERROR, true); $fieldError = $product->validateFields(UNFRIENDLY_ERROR, true);

View File

@ -21,6 +21,7 @@ class AdminAntCreationcategories extends AdminTab
$date = date('Y') . '-' . date('m'); $date = date('Y') . '-' . date('m');
$name = Tools::getValue('category'); $name = Tools::getValue('category');
$meta_name = 'Vente privée '.$name; $meta_name = 'Vente privée '.$name;
$meta_name_es = 'Venta privada '.$name;
$category = new Category(); $category = new Category();
$category->id_parent = 1; $category->id_parent = 1;
@ -30,11 +31,11 @@ class AdminAntCreationcategories extends AdminTab
$category->description[2] = $date; $category->description[2] = $date;
$category->description[3] = $date; $category->description[3] = $date;
$category->meta_title[2] = $meta_name; $category->meta_title[2] = $meta_name;
$category->meta_title[3] = $meta_name; $category->meta_title[3] = $meta_name_es;
$category->meta_keywords[2] = $meta_name; $category->meta_keywords[2] = $meta_name;
$category->meta_keywords[3] = $meta_name; $category->meta_keywords[3] = $meta_name_es;
$category->meta_description[2] = $meta_name; $category->meta_description[2] = $meta_name;
$category->meta_description[3] = $meta_name; $category->meta_description[3] = $meta_name_es;
$category->link_rewrite[2] = $this->str2url($name); $category->link_rewrite[2] = $this->str2url($name);
$category->link_rewrite[3] = $category->link_rewrite[2]; $category->link_rewrite[3] = $category->link_rewrite[2];
$category->groupBox = $groups; $category->groupBox = $groups;
@ -64,6 +65,7 @@ class AdminAntCreationcategories extends AdminTab
} }
foreach ($subcategories as $key => $name) { foreach ($subcategories as $key => $name) {
$meta_name = 'Vente privée '.$name; $meta_name = 'Vente privée '.$name;
$meta_name_es = 'Venta privada '.$name;
$subcategory = new Category(); $subcategory = new Category();
$subcategory->id_parent = $category->id; $subcategory->id_parent = $category->id;
$subcategory->active = 1; $subcategory->active = 1;
@ -72,11 +74,11 @@ class AdminAntCreationcategories extends AdminTab
$subcategory->description[2] = $date; $subcategory->description[2] = $date;
$subcategory->description[3] = $date; $subcategory->description[3] = $date;
$subcategory->meta_title[2] = $meta_name; $subcategory->meta_title[2] = $meta_name;
$subcategory->meta_title[3] = $meta_name; $subcategory->meta_title[3] = $meta_name_es;
$subcategory->meta_keywords[2] = $meta_name; $subcategory->meta_keywords[2] = $meta_name;
$subcategory->meta_keywords[3] = $meta_name; $subcategory->meta_keywords[3] = $meta_name_es;
$subcategory->meta_description[2] = $meta_name; $subcategory->meta_description[2] = $meta_name;
$subcategory->meta_description[3] = $meta_name; $subcategory->meta_description[3] = $meta_name_es;
$subcategory->link_rewrite[2] = $this->str2url($name); $subcategory->link_rewrite[2] = $this->str2url($name);
$subcategory->link_rewrite[3] = $subcategory->link_rewrite[2]; $subcategory->link_rewrite[3] = $subcategory->link_rewrite[2];
$subcategory->groupBox = $groups; $subcategory->groupBox = $groups;
@ -118,6 +120,7 @@ class AdminAntCreationcategories extends AdminTab
} }
foreach ($subcategories as $key => $name) { foreach ($subcategories as $key => $name) {
$meta_name = 'Vente privée '.$name; $meta_name = 'Vente privée '.$name;
$meta_name_es = 'Venta privada '.$name;
$subcategory = new Category(); $subcategory = new Category();
$subcategory->id_parent = (int)$id_parent; $subcategory->id_parent = (int)$id_parent;
$subcategory->active = 1; $subcategory->active = 1;
@ -126,11 +129,11 @@ class AdminAntCreationcategories extends AdminTab
$subcategory->description[2] = $date; $subcategory->description[2] = $date;
$subcategory->description[3] = $date; $subcategory->description[3] = $date;
$subcategory->meta_title[2] = $meta_name; $subcategory->meta_title[2] = $meta_name;
$subcategory->meta_title[3] = $meta_name; $subcategory->meta_title[3] = $meta_name_es;
$subcategory->meta_keywords[2] = $meta_name; $subcategory->meta_keywords[2] = $meta_name;
$subcategory->meta_keywords[3] = $meta_name; $subcategory->meta_keywords[3] = $meta_name_es;
$subcategory->meta_description[2] = $meta_name; $subcategory->meta_description[2] = $meta_name;
$subcategory->meta_description[3] = $meta_name; $subcategory->meta_description[3] = $meta_name_es;
$subcategory->link_rewrite[2] = $this->str2url($name); $subcategory->link_rewrite[2] = $this->str2url($name);
$subcategory->link_rewrite[3] = $subcategory->link_rewrite[2]; $subcategory->link_rewrite[3] = $subcategory->link_rewrite[2];
$subcategory->groupBox = $groups; $subcategory->groupBox = $groups;