Merge branch 'alexandre-braderie' into develop

This commit is contained in:
Marion Muszynski 2016-04-04 13:35:04 +02:00
commit e8a15b1e19

View File

@ -143,6 +143,20 @@ function addToSellout()
$product->active = 1;
$product->quantity = $quantity;
$product->reference = $storage.'-'.$product->reference;
$languages = Language::getLanguages(false);
foreach ($languages as $key => $language) {
$category_name = Db::getInstance()->getRow('
SELECT cl.`name`
FROM `'._DB_PREFIX_.'category_lang` cl
LEFT JOIN `'._DB_PREFIX_.'privatesale` ps ON (ps.`id_category` = cl.`id_category`)
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` pps ON (pps.`id_sale` = ps.`id_sale`)
WHERE pps.`id_product` = '.(int)$id_product_old.'
AND cl.`id_lang` = '.(int)$language['id_lang']
);
$product->name[(int)$language['id_lang']] = $product->name[$language['id_lang']].' - '.strtoupper($category_name['name']);
}
$product->id_category_default = (int)$category;
if ($product->add()) {