139 lines
5.1 KiB
PHP
139 lines
5.1 KiB
PHP
<?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>';
|
|
}
|
|
}
|
|
} |