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

This commit is contained in:
root 2017-06-12 15:30:57 +02:00
commit 02ab520020

View File

@ -898,7 +898,6 @@ class AdminImport extends AdminTab
$image->id_product = (int)($product->id);
$image->position = Image::getHighestPosition($product->id) + 1;
$image->cover = (!$key AND !$productHasImages) ? true : false;
$image->legend = self::createMultiLangField($product->name[$defaultLanguageId]);
if (($fieldError = $image->validateFields(UNFRIENDLY_ERROR, true)) === true AND ($langFieldError = $image->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true AND $image->add())
{
if (!self::copyImg($product->id, $image->id, $url))
@ -911,6 +910,23 @@ class AdminImport extends AdminTab
}
}
}
if($iso_lang == "es") {
$image_ids = array();
foreach(Db::getInstance()->ExecuteS('
SELECT id_image
FROM ps_image
WHERE id_product = '.(int)($product->id)
) as $image){
$image_ids[] = (int)$image['id_image'];
}
if(!empty($image_ids)) {
Db::getInstance()->Execute('
UPDATE ps_image_lang
SET legend = "'.pSQL($product->name[3]).'"
WHERE id_image IN ('.implode(',',$image_ids).') AND id_lang=3
');
}
}
if (isset($product->id_category))
$product->updateCategories(array_map('intval', $product->id_category));