Merge branch 'ticket-AideContact-SAV' into develop
This commit is contained in:
commit
b5916c5a74
@ -116,7 +116,7 @@ class AdminCustomerThreads extends AdminTab
|
||||
ORDER BY cm.date_add DESC');
|
||||
$output = '';
|
||||
foreach ($messages AS $message)
|
||||
$output .= $this->displayMsg($message, true, (int)Tools::getValue('id_employee_forward'));
|
||||
$output .= $this->displayMsgCustom($message, true, (int)Tools::getValue('id_employee_forward'));
|
||||
|
||||
$cm = new CustomerMessage();
|
||||
$cm->id_employee = (int)$cookie->id_employee;
|
||||
@ -305,6 +305,146 @@ class AdminCustomerThreads extends AdminTab
|
||||
readfile(_PS_UPLOAD_DIR_.$filename);
|
||||
die;
|
||||
}
|
||||
private function displayMsgCustom($message, $email = false, $id_employee = null)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$customersToken = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee));
|
||||
$contacts = Contact::getContacts($cookie->id_lang);
|
||||
|
||||
$output = '<div class="panel-message">';
|
||||
if (!$email)
|
||||
{
|
||||
if (!empty($message['id_product']) AND empty($message['employee_name']))
|
||||
$id_order_product = Db::getInstance()->getValue('
|
||||
SELECT o.id_order
|
||||
FROM '._DB_PREFIX_.'orders o
|
||||
LEFT JOIN '._DB_PREFIX_.'order_detail od ON o.id_order = od.id_order
|
||||
WHERE o.id_customer = '.(int)$message['id_customer'].'
|
||||
AND od.product_id = '.(int)$message['id_product'].'
|
||||
ORDER BY o.date_add DESC');
|
||||
|
||||
$output .= '
|
||||
<div class="panel-head '.(!empty($message['employee_name'])?'bg-rose':'').'">
|
||||
<div class="panel-head-left">
|
||||
<div class="user-info">
|
||||
'.(!empty($message['employee_name'])
|
||||
?'<span class="anticon anticon-user-tie"></span> '.Configuration::get('PS_SHOP_NAME').' - '.$message['employee_name']
|
||||
:'<span class="anticon anticon-user"></span>
|
||||
'.(!empty($message['id_customer'])
|
||||
?'<a href="index.php?tab=AdminCustomers&id_customer='.(int)($message['id_customer']).'&viewcustomer&token='.$customersToken.'" title="'.$this->l('View customer').'">'.strtoupper($message['customer_name']).'</a>'
|
||||
: $message['email'])
|
||||
).
|
||||
'</div>
|
||||
<div class="grey div-date"><span class="anticon anticon-clock"></span> '.Tools::displayDate($message['date_add'], (int)($cookie->id_lang), true).'</div>
|
||||
</div>
|
||||
<div class="panel-head-right">
|
||||
'.(
|
||||
(!empty($message['file_name']) AND file_exists(_PS_UPLOAD_DIR_.$message['file_name']))
|
||||
? '<a href="index.php?tab=AdminCustomerThreads&id_customer_thread='.$message['id_customer_thread'].'&viewcustomer_thread&token='.Tools::getAdminToken('AdminCustomerThreads'.(int)(Tab::getIdFromClassName('AdminCustomerThreads')).(int)($cookie->id_employee)).'&filename='.$message['file_name'].'" title="'.$this->l('View file').'"><span class="anticon anticon-attachment"></span></a>'
|
||||
: ''
|
||||
)
|
||||
.(empty($message['employee_name'])
|
||||
?'<a onclick="$(\'#info_'.(int)$message['id_customer_message'].'\').toggle();"><span class="anticon anticon-info"></span></a>'
|
||||
:'').'
|
||||
</div>
|
||||
</div>
|
||||
'.(empty($message['employee_name'])?'
|
||||
<div class="more-info" id="info_'.(int)$message['id_customer_message'].'"" style="font-size:11px">
|
||||
<h4><span class="anticon anticon-info"></span> '.$this->l('Informations').'</h4>
|
||||
<ul>'.(empty($message['employee_name'])
|
||||
? '<li><span class="anticon anticon-sphere"></span> '.strip_tags($message['user_agent']).'</li>'
|
||||
: ''
|
||||
).(
|
||||
(!empty($message['id_order']) AND empty($message['employee_name']))
|
||||
? '<li><b>'.$this->l('Order #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($message['id_order']).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'" title="'.$this->l('View order').'">'.(int)($message['id_order']).' <span class="anticon anticon-eye"></span></a></li>'
|
||||
: ''
|
||||
).(
|
||||
(!empty($message['id_product']) AND empty($message['employee_name']))
|
||||
? '<li><b>'.$this->l('Product #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($id_order_product).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'" title="'.$this->l('View order').'">'.(int)($message['id_product']).' <span class="anticon anticon-eye"></span></a></li>'
|
||||
: ''
|
||||
).'
|
||||
<li><b>'.$this->l('Thread ID:').'</b> '.(int)$message['id_customer_thread'].'</li>
|
||||
<li><b>'.$this->l('Message ID:').'</b> '.(int)$message['id_customer_message'].'</li>
|
||||
</ul>
|
||||
</div>'
|
||||
:'').'
|
||||
<form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post">
|
||||
<b>'.$this->l('Subject:').'</b>
|
||||
<input type="hidden" name="id_customer_message" value="'.$message['id_customer_message'].'" />
|
||||
<select name="id_contact" onchange="this.form.submit();">';
|
||||
foreach ($contacts as $contact)
|
||||
$output .= '<option value="'.(int)$contact['id_contact'].'" '.($contact['id_contact'] == $message['id_contact'] ? 'selected="selected"' : '').'>'.Tools::htmlentitiesutf8($contact['name']).'</option>';
|
||||
$output .= '</select>
|
||||
</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$output .= '
|
||||
'.($id_employee ? '<a href="'.Tools::getHttpHost(true).$currentIndex.'&token='.Tools::getAdminToken('AdminCustomerThreads'.(int)(Tab::getIdFromClassName('AdminCustomerThreads')).(int)($id_employee)).'&id_customer_thread='.(int)$message['id_customer_thread'].'&viewcustomer_thread">'.$this->l('View this thread').'</a><br />' : '').'
|
||||
<b>'.$this->l('Sent by:').'</b> '.(!empty($message['customer_name']) ? $message['customer_name'].' ('.$message['email'].')' : $message['email'])
|
||||
.((!empty($message['id_customer']) AND empty($message['employee_name'])) ? '<br /><b>'.$this->l('Customer ID:').'</b> '.(int)($message['id_customer']).'<br />' : '')
|
||||
.((!empty($message['id_order']) AND empty($message['employee_name'])) ? '<br /><b>'.$this->l('Order #').':</b> '.(int)($message['id_order']).'<br />' : '')
|
||||
.((!empty($message['id_product']) AND empty($message['employee_name'])) ? '<br /><b>'.$this->l('Product #').':</b> '.(int)($message['id_product']).'<br />' : '')
|
||||
.'<b>'.$this->l('Subject:').'</b> '.$message['subject'];
|
||||
}
|
||||
|
||||
// Adding Antadis - linking with ant_support_form module
|
||||
if (Module::isInstalled('ant_support_form')) {
|
||||
$result = Db::getInstance()->getRow('
|
||||
SELECT sr.*, srl.title
|
||||
FROM `'._DB_PREFIX_.'support_reason` sr
|
||||
LEFT JOIN `'._DB_PREFIX_.'support_reason_lang` srl ON (srl.id_reason = sr.id_reason)
|
||||
LEFT JOIN `'._DB_PREFIX_.'support_reason_customerthread` src ON (src.id_reason = sr.id_reason)
|
||||
WHERE `id_customer_thread` = '.(int) $message['id_customer_thread'].'
|
||||
AND srl.id_lang = '.$cookie->id_lang
|
||||
);
|
||||
if ($result) {
|
||||
$output .='<br />
|
||||
<b>'.$this->l('Reason:').'</b> '.$result['title'].'<br />';
|
||||
}
|
||||
}
|
||||
// end adding
|
||||
|
||||
$message['message'] = preg_replace('/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui', '<a href="\1">\1</a>\2', html_entity_decode($message['message'], ENT_NOQUOTES, 'UTF-8'));
|
||||
$output .= '<div class="panel-content-message '.(!empty($message['employee_name'])?'bg-rose':'bg-purple').'">
|
||||
<b>'.$this->l('Message:').'</b><br />
|
||||
'.$message['message'].'
|
||||
</div>';
|
||||
|
||||
if (!$email)
|
||||
{
|
||||
if (empty($message['employee_name']))
|
||||
$output .= '
|
||||
<p class="btn-answer" style="text-align:right">
|
||||
<button class="button" onclick="$(\'#reply_to_'.(int)($message['id_customer_message']).'\').show(500); $(this).hide();">
|
||||
<span class="anticon anticon-bubbles3"></span> '.$this->l('Reply to this message').'
|
||||
</button>
|
||||
</p>
|
||||
<p class="clear"> </p>
|
||||
<div id="reply_to_'.(int)($message['id_customer_message']).'" style="display: none; margin-top: 10px;" class="panel-answer">
|
||||
<form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
|
||||
<p>'.$this->l('Please type your reply below:').'</p>
|
||||
<div style="width: 450px; margin-top: 0px;margin-bottom:5px;">
|
||||
<input type="file" name="joinFile"/>
|
||||
</div>
|
||||
<textarea name="reply_message">'.str_replace('\r\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', $message['id_lang'])).'</textarea>
|
||||
<div style="text-align: right; font-style: italic; font-size: 9px; margin-top: 2px;">
|
||||
'.$this->l('Your reply will be sent to:').' '.$message['email'].'
|
||||
</div>
|
||||
<div style="text-align: right;">
|
||||
<input type="submit" class="button" name="submitReply" value="'.$this->l('Send my reply').'" style="margin-top:20px;" />
|
||||
<input type="hidden" name="id_customer_thread" value="'.(int)($message['id_customer_thread']).'" />
|
||||
<input type="hidden" name="msg_email" value="'.$message['email'].'" />
|
||||
</div>
|
||||
</form>
|
||||
</div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
private function displayMsg($message, $email = false, $id_employee = null)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
@ -474,8 +614,46 @@ class AdminCustomerThreads extends AdminTab
|
||||
<input type="Submit" name="submitForward" class="button" value="'.$this->l('Forward this discussion').'" style="margin-top: 10px;" />
|
||||
</div>
|
||||
</p>
|
||||
</form>
|
||||
<div class="clear"> </div>';
|
||||
</form>';
|
||||
|
||||
if ($nextThread)
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&id_customer_thread='.(int)$nextThread.'&viewcustomer_thread&token='.$this->token.'">
|
||||
'.$this->l('Answer to the next unanswered message in this category').' >
|
||||
</a>');
|
||||
else
|
||||
echo $this->displayButton('
|
||||
<span class="non-action"><span class="anticon anticon-tick"></span> '.$this->l('The other messages in this category have been answered').'</span>');
|
||||
|
||||
if ($thread->status != "closed")
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=2&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
<span class="anticon anticon-tick"></span> '.$this->l('Set this message as handled').'
|
||||
</a>');
|
||||
|
||||
if ($thread->status != "pending1")
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=3&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
<span class="anticon anticon-tick"></span> '.$this->l('pending 1').'
|
||||
</a>');
|
||||
else
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=1&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
'.$this->l('Click here to disable pending status').'
|
||||
</a>');
|
||||
|
||||
if ($thread->status != "pending2")
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=4&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
<span class="anticon anticon-tick"></span> '.$this->l('pending 2').'
|
||||
</a>');
|
||||
else
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=1&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
'.$this->l('Click here to disable pending status').'
|
||||
</a>');
|
||||
|
||||
echo '<div class="clear"> </div>';
|
||||
|
||||
$messages = Db::getInstance()->ExecuteS('
|
||||
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
|
||||
@ -500,52 +678,42 @@ class AdminCustomerThreads extends AdminTab
|
||||
'.($cookie->{'customer_threadFilter_l!id_lang'} ? 'AND ct.id_lang = '.(int)$cookie->{'customer_threadFilter_l!id_lang'} : '').
|
||||
' ORDER BY ct.date_upd ASC');
|
||||
|
||||
if ($nextThread)
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&id_customer_thread='.(int)$nextThread.'&viewcustomer_thread&token='.$this->token.'">
|
||||
<img src="../img/admin/next-msg.png" title="'.$this->l('Go to the oldest next unanswered message').'" style="margin-bottom: 10px;" />
|
||||
<br />'.$this->l('Answer to the next unanswered message in this category').' >
|
||||
</a>');
|
||||
else
|
||||
echo $this->displayButton('
|
||||
<img src="../img/admin/msg-ok.png" title="'.$this->l('Go to the oldest next unanswered message').'" style="margin-bottom: 10px;" />
|
||||
<br />'.$this->l('The other messages in this category have been answered'));
|
||||
$order_thread = null;
|
||||
foreach ($messages AS $message){
|
||||
if ($message['id_order']){
|
||||
$order_thread = new Order((int)($message['id_order']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($thread->id_customer) {
|
||||
$customer = new Customer($thread->id_customer);
|
||||
$products = $customer->getBoughtProducts();
|
||||
$nb_orders = Db::getInstance()->getValue('
|
||||
SELECT COUNT(id_order) FROM '._DB_PREFIX_.'orders
|
||||
WHERE id_customer = '.(int)$customer->id.' AND valid=1
|
||||
');
|
||||
$customer_info = array(
|
||||
'nb_orders' => $nb_orders,
|
||||
);
|
||||
}
|
||||
|
||||
if ($thread->status != "closed")
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=2&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
<img src="../img/admin/msg-ok.png" style="margin-bottom:10px" />
|
||||
<br />'.$this->l('Set this message as handled').'
|
||||
</a>');
|
||||
|
||||
if ($thread->status != "pending1")
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=3&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
<img src="../img/admin/msg-pending.png" style="margin-bottom:10px" />
|
||||
<br />'.$this->l('Declare this message').'<br />'.$this->l('as "pending 1"').'<br />'.$this->l('(will be answered later)').'
|
||||
</a>');
|
||||
else
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=1&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
<img src="../img/admin/msg-is-pending.png" style="margin-bottom:10px" />
|
||||
<br />'.$this->l('Click here to disable pending status').'
|
||||
</a>');
|
||||
|
||||
if ($thread->status != "pending2")
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=4&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
<img src="../img/admin/msg-pending.png" style="margin-bottom:10px" />
|
||||
<br />'.$this->l('Declare this message').'<br />'.$this->l('as "pending 2"').'<br />'.$this->l('(will be answered later)').'
|
||||
</a>');
|
||||
else
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=1&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
<img src="../img/admin/msg-is-pending.png" style="margin-bottom:10px" />
|
||||
<br />'.$this->l('Click here to disable pending status').'
|
||||
</a>');
|
||||
echo '<div style="margin-top:10px">';
|
||||
Module::hookExec('rightColumnSav', array(
|
||||
'customer' => $customer,
|
||||
'customer_info' => $customer_info,
|
||||
'order' => $order_thread)
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo '<div style="float:left;margin-top:10px">';
|
||||
foreach ($messages AS $message) {
|
||||
echo $this->displayMsgCustom($message);
|
||||
}
|
||||
echo '</div>';
|
||||
echo '<div class="clear"> </div>';
|
||||
|
||||
if ($thread->id_customer)
|
||||
{
|
||||
$customer = new Customer($thread->id_customer);
|
||||
@ -617,22 +785,20 @@ class AdminCustomerThreads extends AdminTab
|
||||
<td align="right">'.$product['product_quantity'].'</td>
|
||||
<td align="center"><a href="?tab=AdminOrders&id_order='.$product['id_order'].'&vieworder&token='.$tokenOrders.'"><img src="../img/admin/details.gif" /></a></td>
|
||||
</tr>';
|
||||
echo '</table></div>';
|
||||
echo '</table>
|
||||
</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '<div style="float:left;margin-top:10px">';
|
||||
foreach ($messages AS $message)
|
||||
echo $this->displayMsg($message);
|
||||
echo '</div><div class="clear"> </div>';
|
||||
echo '<div class="clear"> </div>';
|
||||
}
|
||||
|
||||
private function displayButton($content)
|
||||
{
|
||||
return '
|
||||
<div style="margin-bottom:10px;border:1px solid #005500;width:200px;height:130px;padding:10px;background:#EFE">
|
||||
<p style="text-align:center;font-size:15px;font-weight:bold">
|
||||
<div class="btn-action-message">
|
||||
<p style="text-align:center;font-size:13px;">
|
||||
'.$content.'
|
||||
</p>
|
||||
</div>';
|
||||
|
1987
css/admin.css
1987
css/admin.css
File diff suppressed because it is too large
Load Diff
BIN
css/fonts/IcoMoon-Free.ttf
Executable file
BIN
css/fonts/IcoMoon-Free.ttf
Executable file
Binary file not shown.
139
modules/ant_infocustomer/ant_infocustomer.php
Normal file
139
modules/ant_infocustomer/ant_infocustomer.php
Normal file
@ -0,0 +1,139 @@
|
||||
<?php
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
class Ant_Infocustomer extends Module
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'ant_infocustomer';
|
||||
$this->tab = 'administration';
|
||||
$this->author = 'Antadis';
|
||||
$this->version = '1.0';
|
||||
$this->need_instance = 0;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Information about customer');
|
||||
$this->description = $this->l('Block of information about customer in BO');
|
||||
}
|
||||
|
||||
private $hooks = array(
|
||||
'rightColumnSav' => array('BO SAV right column', 'Allow to add information in right column of SAV message thread'),
|
||||
);
|
||||
|
||||
public function install() {
|
||||
foreach($this->hooks as $k => $v) {
|
||||
if(count(Db::getInstance()->ExecuteS('
|
||||
SELECT `id_hook`
|
||||
FROM `'._DB_PREFIX_.'hook`
|
||||
WHERE `name` = "'.$k.'"
|
||||
LIMIT 1
|
||||
')) == 0) {
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'hook`
|
||||
VALUES (DEFAULT, "'.$k.'", "'.$v[0].'", "'.$v[1].'", 0, 0)
|
||||
');
|
||||
}
|
||||
}
|
||||
|
||||
$install_success = parent::install();
|
||||
if ($install_success) {
|
||||
foreach($this->hooks as $k => $v) {
|
||||
$install_success = $this->registerHook($k);
|
||||
if (!$install_success) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $install_success;
|
||||
}
|
||||
|
||||
public function hookRightColumnSav($params) {
|
||||
if(isset($params['customer'])) {
|
||||
global $cookie;
|
||||
|
||||
echo "<style type='text/css'>
|
||||
#blockinfocustomer {
|
||||
width: 300px;
|
||||
background: #fff;
|
||||
padding-bottom: 5px;
|
||||
margin-bottom: 20px;
|
||||
-moz-box-shadow: 1px 1px 2px 2px #cccccc;
|
||||
-webkit-box-shadow: 1px 1px 2px 2px #ccc;
|
||||
-ms-box-shadow: 1px 1px 2px 2px #cccccc;
|
||||
-o-box-shadow: 1px 1px 2px 2px #cccccc;
|
||||
box-shadow: 1px 1px 2px 2px #ccc;
|
||||
clear: both;
|
||||
}
|
||||
#blockinfocustomer .content {
|
||||
padding: 5px;
|
||||
position: relative;
|
||||
}
|
||||
#blockinfocustomer .content div{
|
||||
color: #1e1633;
|
||||
margin: 0px 5px;
|
||||
font-size: 12px;
|
||||
padding: 8px 0px 5px;
|
||||
border-top: 1px dashed #ccc;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
#blockinfocustomer .content div.first-div{
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
#blockinfocustomer h4{
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
color: #796dc7;
|
||||
font-weight: normal;
|
||||
margin: 0px 5px 2px;
|
||||
padding: 12px 0px 10px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
#blockinfocustomer h5 {
|
||||
color: #444d52;
|
||||
font-family: georgia, times new roman, serif;
|
||||
margin-bottom: 10px;
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
}
|
||||
#blockinfocustomer .content span.anticon-user{
|
||||
position: absolute;
|
||||
font-size: 80px;
|
||||
right: 10px;
|
||||
opacity: 0.3;
|
||||
}
|
||||
#blockinfocustomer ul {
|
||||
margin: 0px 0px 7px;
|
||||
padding: 0px;
|
||||
list-style: none;
|
||||
border-bottom: 1px solid #999;
|
||||
}
|
||||
#blockinfocustomer li {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
#blockinfocustomer p {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
#blockinfocustomer p span.anticon{
|
||||
font-size:14px;
|
||||
}
|
||||
</style>";
|
||||
|
||||
$customersToken = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee));
|
||||
echo '<div id="blockinfocustomer">
|
||||
<div class="content">
|
||||
<h4>'.$this->l('Customer Information' ).'</h4>
|
||||
<div class="first-div">
|
||||
<span class="anticon anticon-user"></span>
|
||||
<h5>'.ucfirst($params['customer']->firstname).' '.ucfirst($params['customer']->lastname).' <a target="_blank" href="index.php?tab=AdminCustomers&id_customer='.(int)$params['customer']->id.'&viewcustomer&token='.$customersToken.'">('.$params['customer']->id.')</a></h5>
|
||||
<p><span class="anticon anticon-envelop"></span> '.$params['customer']->email.'</p>
|
||||
<p><span class="anticon anticon-cart"></span> '.$params['customer_info']['nb_orders'].' '.$this->l('valid orders').'</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
}
|
@ -19,14 +19,200 @@ class BlockOrderSummary extends Module {
|
||||
$this->description = $this->l('Displays a summary of the current order');
|
||||
}
|
||||
|
||||
private $hooks = array(
|
||||
'rightColumnSav' => array('BO SAV right column', 'Allow to add information in right column of SAV message thread'),
|
||||
);
|
||||
|
||||
public function install() {
|
||||
return parent::install() && $this->registerHook('leftColumn');
|
||||
foreach($this->hooks as $k => $v) {
|
||||
if(count(Db::getInstance()->ExecuteS('
|
||||
SELECT `id_hook`
|
||||
FROM `'._DB_PREFIX_.'hook`
|
||||
WHERE `name` = "'.$k.'"
|
||||
LIMIT 1
|
||||
')) == 0) {
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'hook`
|
||||
VALUES (DEFAULT, "'.$k.'", "'.$v[0].'", "'.$v[1].'", 0, 0)
|
||||
');
|
||||
}
|
||||
}
|
||||
|
||||
$install_success = parent::install();
|
||||
if ($install_success) {
|
||||
foreach($this->hooks as $k => $v) {
|
||||
$install_success = $this->registerHook($k);
|
||||
if (!$install_success) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $install_success && $this->registerHook('leftColumn');
|
||||
}
|
||||
|
||||
public function hookLeftColumn($params) {
|
||||
global $cookie, $smarty, $cart;
|
||||
if(($step = (int) Tools::getValue('step')) && ($step == 3 || $step == 4)) {
|
||||
$data = $this->getOrderDetail($cart,$cookie->id_lang);
|
||||
$smarty->assign(array(
|
||||
'order_address' => $data['order_address'],
|
||||
'carrier_name' => $data['carrier_name'],
|
||||
'delay_name' => $data['delay_name'],
|
||||
'delivery_date' => (isset($data['delivery_date'])?$data['delivery_date']:null)
|
||||
));
|
||||
return $this->display(__FILE__, 'blockordersummary.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
public function hookRightColumn($params) {
|
||||
return $this->hookLeftColumn($params);
|
||||
}
|
||||
|
||||
public function hookRightColumnSav($params) {
|
||||
if(isset($params['order'])) {
|
||||
$cart = new Cart((int)$params['order']->id_cart);
|
||||
$data = $this->getOrderDetail($cart,(int)$cart->id_lang);
|
||||
|
||||
echo "<style type='text/css'>
|
||||
#blockordersummary {
|
||||
width: 300px;
|
||||
background: #fff;
|
||||
padding-bottom: 5px;
|
||||
margin-bottom: 20px;
|
||||
-moz-box-shadow: 1px 1px 2px 2px #cccccc;
|
||||
-webkit-box-shadow: 1px 1px 2px 2px #ccc;
|
||||
-ms-box-shadow: 1px 1px 2px 2px #cccccc;
|
||||
-o-box-shadow: 1px 1px 2px 2px #cccccc;
|
||||
box-shadow: 1px 1px 2px 2px #ccc;
|
||||
clear: both;
|
||||
}
|
||||
#blockordersummary .content {
|
||||
padding: 5px;
|
||||
}
|
||||
#blockordersummary .content div{
|
||||
color: #1e1633;
|
||||
margin: 0px 5px;
|
||||
font-size: 12px;
|
||||
padding: 8px 0px 5px;
|
||||
border-top: 1px dashed #ccc;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
#blockordersummary .content div.my-cart {
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
#blockordersummary h4{
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
color: #796dc7;
|
||||
font-weight: normal;
|
||||
margin: 0px 5px 2px;
|
||||
padding: 12px 0px 10px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
#blockordersummary h5 {
|
||||
color: #444d52;
|
||||
font-family: georgia, times new roman, serif;
|
||||
margin-bottom: 10px;
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
}
|
||||
#blockordersummary ul {
|
||||
margin: 0px 0px 7px;
|
||||
padding: 0px;
|
||||
list-style: none;
|
||||
border-bottom: 1px solid #999;
|
||||
}
|
||||
#blockordersummary li {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
#blockordersummary p {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
#blockordersummary p.carrier-info:after{
|
||||
content: '';
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
#blockordersummary span.carrier-name {
|
||||
float: left;
|
||||
max-width: 130px;
|
||||
}
|
||||
#blockordersummary p.delivery-delay {
|
||||
color: #e36ea2;
|
||||
font-weight: 600;
|
||||
}
|
||||
#blockordersummary p.delivery-date strong{
|
||||
font-size: 11px;
|
||||
}
|
||||
#blockordersummary .price {
|
||||
float: right;
|
||||
}
|
||||
#blockordersummary .price.price_total {
|
||||
color: #e36ea2;
|
||||
font-weight: bold;
|
||||
}
|
||||
#blockordersummary .address {
|
||||
color: #1e1633;
|
||||
}
|
||||
#blockordersummary .order_total {
|
||||
color: #e36ea2;
|
||||
padding: 15px;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
background: rgba(226,110,162,0.2) ;
|
||||
}
|
||||
|
||||
</style>";
|
||||
|
||||
echo '<div id="blockordersummary">
|
||||
<div class="content">
|
||||
<h4>'.$this->l('Summary of my order' ).'</h4>
|
||||
<div class="my-cart">
|
||||
<h5>'.$this->l('My Cart' ).'</h5>
|
||||
<ul>';
|
||||
foreach ($cart->getProducts() as $key => $product) {
|
||||
echo '<li>'.$product['quantity'].' x '.$product['name'].' <span class="price">'.$product['total_wt'].'</span></li>';
|
||||
}
|
||||
echo '</ul>
|
||||
<p>'.$this->l('Products total').' <span class="price price_total">'.$cart->getOrderTotal(TRUE, 1).'</span></p>';
|
||||
if ($cart->getOrderTotal(TRUE, 2) != 0){
|
||||
echo '<p>'.$this->l('Discounts total').' <span class="price price_total">'.$cart->getOrderTotal(TRUE, 2).'</span></p>';
|
||||
}
|
||||
echo '</div>
|
||||
<div>
|
||||
<h5>'.$this->l('Shipping').'</h5>
|
||||
<p class="carrier-info"><span class="carrier-name">'.$data['carrier_name'].'</span> <span class="price price_total">'.$cart->getOrderTotal(TRUE, 5).'</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<h5>'.$this->l('Delivery delays').'</h5>
|
||||
<p class="delivery-delay">'.$data['delay_name'].'</p>';
|
||||
if(isset($data['delivery_date'])){
|
||||
foreach($data['delivery_date'] as $k => $date) {
|
||||
if($k == 1) {
|
||||
echo '<p class="delivery-date">
|
||||
'.$this->l('Date de réception prévue entre le').' <strong>'.date('d/m/Y',strtotime($date['date_start'])).'</strong> '.$this->l('et le').' <strong>'.date('d/m/Y',strtotime($date['date_start'])).'</strong>
|
||||
</p>';
|
||||
} elseif ($k == 5){
|
||||
echo '<p class="delivery-date">'.$this->l('Livraison prévue avant le').' <strong>'.$this->l('24/12').'</strong></p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '</div>
|
||||
<div>
|
||||
<h5>'.$this->l('My shipping address').'</h5>
|
||||
<p class="address">'.$data['order_address'].'</p>
|
||||
</div>
|
||||
<div>
|
||||
<h5>'.$this->l('My payment').'</h5>
|
||||
<p class="order_total">'.$this->l('Total to pay').' <span class="price price_total">'.$cart->getOrderTotal(TRUE).'</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
public function getOrderDetail($cart,$id_lang){
|
||||
if(Db::getInstance()->getValue('
|
||||
SELECT `id_carrier`
|
||||
FROM `'._DB_PREFIX_.'carrier`
|
||||
@ -63,7 +249,7 @@ class BlockOrderSummary extends Module {
|
||||
$order_address = nl2br(AddressFormat::generateAddress(new Address((int) $cart->id_address_delivery)));
|
||||
}
|
||||
|
||||
if ($cookie->id_lang == 3 && (int)$cart->id_carrier == 87) {
|
||||
if ($id_lang == 3 && (int)$cart->id_carrier == 87) {
|
||||
$carrier_name = "SEUR a domicilio";
|
||||
} else {
|
||||
$carrier_name = Db::getInstance()->getValue('
|
||||
@ -98,7 +284,7 @@ class BlockOrderSummary extends Module {
|
||||
$row = Db::getInstance()->getRow('
|
||||
SELECT l.`name`
|
||||
FROM `'._DB_PREFIX_.'privatesale_delay_lang` l
|
||||
WHERE l.`id_lang` = '.(int) $cookie->id_lang.'
|
||||
WHERE l.`id_lang` = '.(int) $id_lang.'
|
||||
AND l.`id_delay`='.(int)$delay.'
|
||||
');
|
||||
$delay_name = $row['name'];
|
||||
@ -106,18 +292,11 @@ class BlockOrderSummary extends Module {
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign(array(
|
||||
return array(
|
||||
'order_address' => $order_address,
|
||||
'carrier_name' => $carrier_name,
|
||||
'delay_name' => $delay_name,
|
||||
'delivery_date' => (isset($delivery_date)?$delivery_date:null)
|
||||
));
|
||||
|
||||
return $this->display(__FILE__, 'blockordersummary.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
public function hookRightColumn($params) {
|
||||
return $this->hookLeftColumn($params);
|
||||
);
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@
|
||||
</p>
|
||||
{elseif $k == 5}
|
||||
<p class="delivery-date">
|
||||
{l s='Livraison prévue avant le' mod='blockordersummary'} <strong>{l s='24/12' mod='blockordersummary'}</strong> </strong>
|
||||
{l s='Livraison prévue avant le' mod='blockordersummary'} <strong>{l s='24/12' mod='blockordersummary'}</strong>
|
||||
</p>
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
Loading…
Reference in New Issue
Block a user