Merge branch 'develop' of gitlab.antadis.net:dev-antadis/bebeboutik into develop
This commit is contained in:
commit
a6c724badc
@ -784,7 +784,7 @@ class AdminCustomerThreads extends AdminTab
|
|||||||
}
|
}
|
||||||
$output .= '
|
$output .= '
|
||||||
<div class="product-box">
|
<div class="product-box">
|
||||||
<span class="quantity">'.(int)($product['product_quantity']).'</span>
|
<span class="quantity">'.(int)($product['product_return_quantity']).'</span>
|
||||||
<a target="_blank" href="index.php?tab=AdminCatalog&id_product='.(int)($product['id_product']).'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" title="'.$product['name'].'">
|
<a target="_blank" href="index.php?tab=AdminCatalog&id_product='.(int)($product['id_product']).'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" title="'.$product['name'].'">
|
||||||
<img width="62" src="'.(isset($img_path)?_THEME_PROD_DIR_.$img_path.'-small.jpg':'').'"/>
|
<img width="62" src="'.(isset($img_path)?_THEME_PROD_DIR_.$img_path.'-small.jpg':'').'"/>
|
||||||
<p><b>#'.(int)($product['id_product']).'</b><br />'.mb_strimwidth($product['name'], 0, 55, "...").'</p>
|
<p><b>#'.(int)($product['id_product']).'</b><br />'.mb_strimwidth($product['name'], 0, 55, "...").'</p>
|
||||||
|
@ -30,7 +30,19 @@ if ($cookie->isLogged() && Tools::getValue('id_order')) {
|
|||||||
WHERE id_product = '.(int)($product['product_id']).' AND cover = 1');
|
WHERE id_product = '.(int)($product['product_id']).' AND cover = 1');
|
||||||
}
|
}
|
||||||
$product_img_path = $link->getImageLink($p->link_rewrite, (int)$image['id_image'], 'small');
|
$product_img_path = $link->getImageLink($p->link_rewrite, (int)$image['id_image'], 'small');
|
||||||
$productList .= '<p><input type="checkbox" name="id_products[]" value="'.$product['product_id'].'_'.$product['product_attribute_id'].'" id="product_'.$product['product_id'].'_'.$product['product_attribute_id'].'"/><label for="product_'.$product['product_id'].'_'.$product['product_attribute_id'].'">'.((isset($product_img_path))?'<img src="'.$product_img_path.'" /> ':'').' '.$product['product_name'].'</label></p>';
|
$productList .= '<p>';
|
||||||
|
$productList .= '<input type="checkbox" class="productreturn" name="id_products[]" value="'.$product['product_id'].'_'.$product['product_attribute_id'].'" id="product_'.$product['product_id'].'_'.$product['product_attribute_id'].'"/>';
|
||||||
|
$productList .= '<label for="product_'.$product['product_id'].'_'.$product['product_attribute_id'].'">'.((isset($product_img_path))?'<img src="'.$product_img_path.'" /> ':'').' '.$product['product_name'].'</label>';
|
||||||
|
$productList .= '</p>';
|
||||||
|
|
||||||
|
// Add quantity selector
|
||||||
|
if ($product['product_quantity'] > 0) {
|
||||||
|
$productList.= '<p id="product_'.$product['product_id'].'_'.$product['product_attribute_id'].'_qty" class="hidden">Quantité: <select style="width:auto;" name="product_'.$product['product_id'].'_'.$product['product_attribute_id'].'_qty">';
|
||||||
|
for($i=1; $i<=$product['product_quantity']; $i++) {
|
||||||
|
$productList.= '<option value="'.$i.'">'.$i.'</option>';
|
||||||
|
}
|
||||||
|
$productList.= '</select></p>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!empty($productList)) {
|
if(!empty($productList)) {
|
||||||
header('Content-Type: text/json');
|
header('Content-Type: text/json');
|
||||||
|
@ -156,7 +156,7 @@ if (Tools::isSubmit('submitMessage')) {
|
|||||||
// local
|
// local
|
||||||
// $smarty->assign('confirmation', 1);
|
// $smarty->assign('confirmation', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($contact->customer_service)
|
if ($contact->customer_service)
|
||||||
{
|
{
|
||||||
if ((int)$id_customer_thread)
|
if ((int)$id_customer_thread)
|
||||||
@ -207,15 +207,33 @@ if (Tools::isSubmit('submitMessage')) {
|
|||||||
// adding (antadis) - linking productS and customer_thread
|
// adding (antadis) - linking productS and customer_thread
|
||||||
if ($id_products = Tools::getValue('id_products')) {
|
if ($id_products = Tools::getValue('id_products')) {
|
||||||
foreach ($id_products as $key => $val) {
|
foreach ($id_products as $key => $val) {
|
||||||
|
// Check if quantity field is set ( product_{product_id}_{product_attribute_id}_qty )
|
||||||
|
$qty = 1;
|
||||||
|
if (Tools::getValue('product_'.$val.'_qty')) {
|
||||||
|
$qty = (int)Tools::getValue('product_'.$val.'_qty');
|
||||||
|
}
|
||||||
|
|
||||||
$p = explode("_", $val);
|
$p = explode("_", $val);
|
||||||
DB::getInstance()->execute('
|
|
||||||
INSERT IGNORE INTO `'._DB_PREFIX_.'support_product_customerthread` (`id_product`,`id_product_attribute`, `id_customer_thread`)
|
// Check quantity in db
|
||||||
VALUE(
|
if (($resultOld = Db::getInstance()->getRow('SELECT `product_return_quantity` FROM `'._DB_PREFIX_.'support_product_customerthread`
|
||||||
'.(int)$p[0].',
|
WHERE `id_customer_thread` = '.(int)$ct->id.' AND `id_product_attribute` = '.(int)$p[1].' AND `id_product` = '.(int)$p[0])) !== false) {
|
||||||
'.(int)$p[1].',
|
$qtyOld = $resultOld['product_return_quantity'];
|
||||||
'.(int)$ct->id.'
|
if ($qty > $qtyOld) {
|
||||||
)
|
DB::getInstance()->execute('
|
||||||
');
|
UPDATE `'._DB_PREFIX_.'support_product_customerthread` SET `product_return_quantity` = '.$qty.'
|
||||||
|
WHERE `id_customer_thread` = '.(int)$ct->id.' AND `id_product_attribute` = '.(int)$p[1].' AND `id_product` = '.(int)$p[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Insert new value
|
||||||
|
else {
|
||||||
|
DB::getInstance()->execute('
|
||||||
|
INSERT IGNORE INTO `'._DB_PREFIX_.'support_product_customerthread`
|
||||||
|
(`id_product`, `id_product_attribute`, `product_return_quantity`, `id_customer_thread`)
|
||||||
|
VALUE
|
||||||
|
('.(int)$p[0].', '.(int)$p[1].', '.$qty.','.(int)$ct->id.')
|
||||||
|
');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,10 @@
|
|||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to get order products \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to get order products \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('div#products').delegate('.productreturn', 'click', function(){
|
||||||
|
$('#product_'+$(this).val()+'_qty').toggleClass('hidden');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>{/literal}
|
</script>{/literal}
|
||||||
{elseif $customerThread.id_product > 0}
|
{elseif $customerThread.id_product > 0}
|
||||||
@ -201,7 +205,7 @@
|
|||||||
}else{
|
}else{
|
||||||
window.location = "{/literal}{$base_dir_ssl}{literal}contact-form.php?id_contact="+$("option:selected", $('#select_contact')).val();
|
window.location = "{/literal}{$base_dir_ssl}{literal}contact-form.php?id_contact="+$("option:selected", $('#select_contact')).val();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{/literal}
|
{/literal}
|
||||||
|
Loading…
Reference in New Issue
Block a user