Merge branch 'develop' of gitlab.antadis.fr:dev-antadis/bebeboutik into develop
This commit is contained in:
commit
5769f5fb68
@ -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()) {
|
||||
@ -158,7 +172,9 @@ function addToSellout()
|
||||
Product::duplicateAccessories($id_product_old, $product->id);
|
||||
GroupReduction::duplicateReduction($id_product_old, $product->id);
|
||||
|
||||
$max_position = Db::getInstance()->getValue("SELECT MAX(cp.`position`) AS max FROM `"._DB_PREFIX_."category_product` cp WHERE cp.`id_category`=" . (int)$category);
|
||||
$product->UpdateCategories(array((int)$category,(int)$parent_category));
|
||||
|
||||
/*$max_position = Db::getInstance()->getValue("SELECT MAX(cp.`position`) AS max FROM `"._DB_PREFIX_."category_product` cp WHERE cp.`id_category`=" . (int)$category);
|
||||
$add_category = Db::getInstance()->Execute("INSERT INTO `"._DB_PREFIX_."category_product` (`id_product`, `id_category`, `position`)
|
||||
VALUES (
|
||||
'". $product->id ."',
|
||||
@ -172,7 +188,7 @@ function addToSellout()
|
||||
'". $product->id ."',
|
||||
'". (int)$parent_category ."',
|
||||
'". (int)($max_position_in_parent + 1 ) ."'
|
||||
)");
|
||||
)");*/
|
||||
|
||||
if ($product->hasAttributes())
|
||||
Product::updateDefaultAttribute($product->id);
|
||||
|
Loading…
Reference in New Issue
Block a user