diff --git a/adm/tabs/AdminCustomerThreads.php b/adm/tabs/AdminCustomerThreads.php index 085d29dc..4b441bc9 100755 --- a/adm/tabs/AdminCustomerThreads.php +++ b/adm/tabs/AdminCustomerThreads.php @@ -518,16 +518,20 @@ class AdminCustomerThreads extends AdminTab SELECT * FROM `'._DB_PREFIX_.'support_product_customerthread` WHERE `id_customer_thread` = '.(int)$tr['id_customer_thread'] ); - $supTo10 = false; - $supTo100 = false; + $supTo10 = 0; + $supTo100 = 0; if(!empty($products)) { foreach ($products as $product) { $price = Product::getPriceStatic((int)$product['id_product'], false, (int)$product['id_product_attribute'], 6, NULL, false, true, 1, false, ((int)($tr['id_customer']) ? (int)($tr['id_customer']) : NULL), (int)($order->id_cart), ((int)($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) ? (int)($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) : NULL), $specificPriceOutput); - $supTo10 = ($price>10)?true:false; - $supTo100 = ($price>100)?true:false; + if($price>10){ + $supTo10++; + } + if($price>100){ + $supTo100++; + } } } - echo ($supTo10?'

'.($supTo100?'':'').'

':'

--

'); + echo ($supTo10>0?'

'.($supTo100>0?'':'').'

':'

--

'); } elseif ($key == 'id_order' AND isset($tr[$key])) { $order = new Order((int)$tr[$key]); $cart = new Cart((int)$order->id_cart); diff --git a/modules/ant_support_form/support.php b/modules/ant_support_form/support.php index 7ca97842..5e6fdb3d 100644 --- a/modules/ant_support_form/support.php +++ b/modules/ant_support_form/support.php @@ -26,22 +26,13 @@ if ($cookie->isLogged()) { $order = new Order($row['id_order']); $date = explode(' ', $order->date_add); $orders[$row['id_order']] = Tools::displayDate($date[0], $cookie->id_lang); - $tmp = $order->getProducts(); - foreach ($tmp as $key => $val) - $products[$val['product_id']] = $val['product_name']; } $orderList = ''; foreach ($orders as $key => $val) { - $orderList .= ''; - } - $orderedProductList = ''; - - foreach ($products as $key => $val) { - $orderedProductList .= ''; + $orderList .= ''; } $smarty->assign('orderList', $orderList); - $smarty->assign('orderedProductList', $orderedProductList); } if (Tools::isSubmit('submitMessage')) { @@ -67,7 +58,7 @@ if (Tools::isSubmit('submitMessage')) { $errors[] = Tools::displayError('Please select a reason on the list.'); elseif (($id_contact = (int)(Tools::getValue('id_contact'))) && ($id_contact == 9 || $id_contact == 1) && !Tools::getValue('id_order')) $errors[] = Tools::displayError('Please enter/choose an order ID'); - elseif (($id_contact = (int)(Tools::getValue('id_contact'))) && $id_contact == 1 && !Tools::getValue('id_product')) + elseif (($id_contact = (int)(Tools::getValue('id_contact'))) && $id_contact == 1 && !Tools::getValue('id_products')) $errors[] = Tools::displayError('Please choose a product'); elseif (!empty($_FILES['fileUpload']['name']) AND $_FILES['fileUpload']['error'] != 0) $errors[] = Tools::displayError('An error occurred during the file upload'); @@ -152,10 +143,13 @@ if (Tools::isSubmit('submitMessage')) { $ct->status = 'open'; $ct->id_lang = (int)$cookie->id_lang; $ct->id_contact = (int)($id_contact); - if ($id_order = (int)Tools::getValue('id_order')) + if ($id_order = (int)Tools::getValue('id_order')) { $ct->id_order = $id_order; - if ($id_product = (int)Tools::getValue('id_product')) - $ct->id_product = $id_product; + } + if ($id_products = Tools::getValue('id_products')) { + $first_product = explode("_", $id_products[0]); + $ct->id_product = (int)$first_product[0]; + } $ct->update(); } else @@ -163,10 +157,13 @@ if (Tools::isSubmit('submitMessage')) { $ct = new CustomerThread(); if (isset($customer->id)) $ct->id_customer = (int)($customer->id); - if ($id_order = (int)Tools::getValue('id_order')) + if ($id_order = (int)Tools::getValue('id_order')){ $ct->id_order = $id_order; - if ($id_product = (int)Tools::getValue('id_product')) - $ct->id_product = $id_product; + } + if ($id_products = Tools::getValue('id_products')) { + $first_product = explode("_", $id_products[0]); + $ct->id_product = (int)$first_product[0]; + } $ct->id_contact = (int)($id_contact); $ct->id_lang = (int)$cookie->id_lang; $ct->email = $from; @@ -185,6 +182,20 @@ if (Tools::isSubmit('submitMessage')) { $reason->insertReasonCustomerThread((int) $ct->id); } } + // adding (antadis) - linking productS and customer_thread + if ($id_products = Tools::getValue('id_products')) { + foreach ($id_products as $key => $val) { + $p = explode("_", $val); + DB::getInstance()->execute(' + INSERT IGNORE INTO `'._DB_PREFIX_.'support_product_customerthread` (`id_product`,`id_product_attribute`, `id_customer_thread`) + VALUE( + '.(int)$p[0].', + '.(int)$p[1].', + '.(int)$ct->id.' + ) + '); + } + } $cm = new CustomerMessage(); $cm->id_customer_thread = $ct->id; diff --git a/modules/ant_support_form/support.tpl b/modules/ant_support_form/support.tpl index 41a9386d..6bed2224 100644 --- a/modules/ant_support_form/support.tpl +++ b/modules/ant_support_form/support.tpl @@ -34,7 +34,7 @@ {if !isset($customerThread.id_order) && isset($isLogged) && $isLogged == 1 && !empty($orderList)}

- + {elseif !isset($customerThread.id_order) && !isset($isLogged)}

@@ -50,15 +50,64 @@

{/if} {if isset($isLogged) && $isLogged && isset($allow_product) && $allow_product} - {if !isset($customerThread.id_product) && !empty($orderedProductList)} -

- - -

+ {if !isset($customerThread.id_product)} + + {literal}{/literal} {elseif $customerThread.id_product > 0}

- +

{else}

diff --git a/themes/site/css/style.css b/themes/site/css/style.css index b3090e01..6c123fcf 100755 --- a/themes/site/css/style.css +++ b/themes/site/css/style.css @@ -5836,6 +5836,11 @@ div#giftvoucher_ask_infos_block .gv_customization > .gv_param input { } /** Module ant_support_form **/ +#module-ant_support_form-support #center_column div#products_part label, +#module-ant_support_form-support #center_column div#products_part label img{ + display: inline-block; + vertical-align: middle; +} #module-ant_support_form-support #center_column p.submit { text-align: right; }