fix conflict
This commit is contained in:
commit
a3f697a0be
@ -56,7 +56,7 @@ $enabledOnly = Tools::getValue('enabledOnly', false);
|
||||
$excludeVirtuals = (bool)Tools::getValue('excludeVirtuals', false);
|
||||
|
||||
$items = Db::getInstance()->ExecuteS('
|
||||
SELECT p.`id_product`, `reference`, pl.`name`, i.`id_image`
|
||||
SELECT p.`id_product`, `reference`, pl.`name`, pl.`link_rewrite`, i.`id_image`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
@ -64,13 +64,14 @@ WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query)
|
||||
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
|
||||
($enabledOnly ? ' AND p.`active` = 1 ' : ' ').
|
||||
($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : ''));
|
||||
|
||||
$link = new Link();
|
||||
if ($items)
|
||||
foreach ($items AS $item){
|
||||
$img_path = '';
|
||||
if(isset($item['id_image']) && !empty($item['id_image'])){
|
||||
$image_obj = new Image((int)$item['id_image']);
|
||||
$img_path = (isset($image_obj)?$image_obj->getExistingImgPath():'');
|
||||
// $image_obj = new Image((int)$item['id_image']);
|
||||
// $img_path = (isset($image_obj)?$image_obj->getExistingImgPath():'');
|
||||
$img_path = $link->getImageLink($item['link_rewrite'], (int)$item['id_image'], 'small');
|
||||
}
|
||||
echo trim($item['name']).(!empty($item['reference']) ? ' (ref: '.$item['reference'].')' : '').'|'.(int)($item['id_product']).(!empty($img_path) ?'|'.($img_path):'')."\n";
|
||||
}
|
||||
|
@ -3635,7 +3635,7 @@ class AdminProducts extends AdminTab
|
||||
scroll:false,
|
||||
cacheLength:0,
|
||||
formatItem: function(item) {
|
||||
return \'<img src="'._THEME_PROD_DIR_.'\'+item[2]+\'-small.jpg" /> \'+item[1]+\' - \'+item[0];
|
||||
return \'<img src="\'+item[2]+\'" /> \'+item[1]+\' - \'+item[0];
|
||||
},
|
||||
}).result(addAccessory);
|
||||
$(\'#product_autocomplete_input\').setOptions({
|
||||
|
@ -334,7 +334,7 @@ function addAccessory(event, data, formatted)
|
||||
var $imgAccessories = $('#imgAccessories');
|
||||
|
||||
/* delete product from select + add product line to the div, input_name, input_ids elements */
|
||||
$divAccessories.html($divAccessories.html() + '<div class="item_accessory"><img src="/img/p/'+productImg+'-small.jpg" /> <p>' + productName + ' <span onclick="delAccessory(' + productId + ');" style="cursor: pointer;"><img src="../img/admin/delete.gif" /></span></p></div>');
|
||||
$divAccessories.html($divAccessories.html() + '<div class="item_accessory"><img src="'+productImg+'" /> <p>' + productName + ' <span onclick="delAccessory(' + productId + ');" style="cursor: pointer;"><img src="../img/admin/delete.gif" /></span></p></div>');
|
||||
$nameAccessories.val($nameAccessories.val() + productName + '¤');
|
||||
$inputAccessories.val($inputAccessories.val() + productId + '-');
|
||||
$imgAccessories.val($imgAccessories.val() + productImg + ',');
|
||||
|
@ -156,13 +156,13 @@ function addToSellout()
|
||||
$parent_category = (int)Tools::getValue('parent_category', false);
|
||||
if (!$parent_category || !is_int($parent_category)) {
|
||||
http_response_code(500);
|
||||
return Toold::displayError('La catégorie principale n\'est pas valide');
|
||||
return Tools::displayError('La catégorie principale n\'est pas valide');
|
||||
}
|
||||
|
||||
$category = (int)Tools::getValue('category', false);
|
||||
if (!$category || !is_int($category)) {
|
||||
http_response_code(500);
|
||||
return Toold::displayError('La catégorie n\'est pas valide');
|
||||
return Tools::displayError('La catégorie n\'est pas valide');
|
||||
}
|
||||
|
||||
$product_id = (int)Tools::getValue('product', false);
|
||||
|
@ -183,6 +183,7 @@ if($magistorModule->active) {
|
||||
NOW()
|
||||
)
|
||||
');
|
||||
mail('marion@antadis.com', '[BBB] Philea - Send article for sale #'.$id_sale, $file); // log
|
||||
file_put_contents($fileName.'.DAT', "\xEF\xBB\xBF".utf8_encode($data));
|
||||
file_put_contents($fileArchive.'.DAT', "\xEF\xBB\xBF".utf8_encode($data));
|
||||
unset($data);
|
||||
|
@ -16,6 +16,7 @@ if($id_sale == 0) {
|
||||
exit;
|
||||
}
|
||||
$dateNow = date('ymdHis');
|
||||
$multi = array();
|
||||
|
||||
$magistorModule = new philea_magistor();
|
||||
$id_lang = Configuration::get('PS_LANG_DEFAULT');
|
||||
@ -73,7 +74,7 @@ if($magistorModule->active) {
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON o.`id_order` = d.`id_order`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c ON d.`product_id` = c.`id_product`
|
||||
LEFT JOIN `'._DB_PREFIX_.'philea_sent` pms ON (pms.`id_sale` = c.`id_sale` AND pms.`id_order` = o.`id_order`)
|
||||
WHERE o.`id_order_state` IN (2, 3, 4, 13, 17, 9, 18, 19)
|
||||
WHERE o.`id_order_state` IN (2, 3, 12, 13, 17)
|
||||
AND c.`id_sale` = '.(int) $id_sale.'
|
||||
AND pms.`id_order` IS NULL
|
||||
AND d.`product_quantity` - d.`product_quantity_refunded` > 0
|
||||
@ -161,6 +162,21 @@ if($magistorModule->active) {
|
||||
$partialOrder = false;
|
||||
$order = new Order($o['id_order']);
|
||||
|
||||
$sales = array();
|
||||
$sales[(int)$id_sale] = (int) $id_sale;
|
||||
|
||||
// ANTADIS - check if multi and order already sent
|
||||
$other_sales = Db::getInstance()->getValue('
|
||||
SELECT COUNT(`id_sale`)
|
||||
FROM `'._DB_PREFIX_.'philea_sent`
|
||||
WHERE `id_order` = '.(int) $o['id_order'].'
|
||||
');
|
||||
if($other_sales > 0){
|
||||
// order already sent to philea
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$products = $order->getProducts();
|
||||
// ANTADIS
|
||||
$products_ids = array();
|
||||
@ -325,7 +341,12 @@ if($magistorModule->active) {
|
||||
WHERE `id_sale` = '.(int) $id_sale.'
|
||||
AND `id_product` = '.(int) $product['product_id'].'
|
||||
')) {
|
||||
continue;
|
||||
$other_sale_id = Db::getInstance()->getValue('
|
||||
SELECT `id_sale`
|
||||
FROM `'._DB_PREFIX_.'product_ps_cache`
|
||||
WHERE `id_product` = '.(int) $product['product_id'].'
|
||||
');
|
||||
$sales[(int)$other_sale_id] = (int)$other_sale_id;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -431,14 +452,20 @@ if($magistorModule->active) {
|
||||
$data .= PHP_EOL;
|
||||
}
|
||||
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'philea_sent`
|
||||
VALUES (
|
||||
'.(int) $order->id.',
|
||||
'.(int) $id_sale.',
|
||||
NOW()
|
||||
)
|
||||
');
|
||||
foreach ($sales as $key => $sale_id) {
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'philea_sent`
|
||||
VALUES (
|
||||
'.(int) $order->id.',
|
||||
'.(int) $sale_id.',
|
||||
NOW()
|
||||
)
|
||||
');
|
||||
}
|
||||
if(count($sales)>1) {
|
||||
$multi[] = (int) $order->id;
|
||||
}
|
||||
|
||||
} //End if nbproducts
|
||||
}//End foreach
|
||||
|
||||
@ -454,6 +481,11 @@ if($magistorModule->active) {
|
||||
NOW()
|
||||
)
|
||||
');
|
||||
if (!empty($multi)) {
|
||||
mail('marion@antadis.com', '[BBB] Philea - Send command with multi', 'multi : '.implode(',',$multi).' - file : '.$file); // log multi
|
||||
} else {
|
||||
mail('marion@antadis.com', '[BBB] Philea - Send command without multi', 'Pas de multi - file : '.$file); // log multi
|
||||
}
|
||||
file_put_contents($fileName . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
|
||||
file_put_contents($fileName . '.BAL', '');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user