fix conflict

This commit is contained in:
Marion Muszynski 2016-11-02 12:43:27 +01:00
commit 3946f6ceac
12 changed files with 1714 additions and 284 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3345,4 +3345,379 @@ span.anticon{
color: #000;
background: none!important;
border: 0!important;
}
}
.text-green-light{
color: #55b239!important;
}
.text-rose{
color: #e36ea2!important;
}
.text-orange{
color: #FFA74E!important;
}
.text-purple{
color: #666491!important;
}
.text-purple-light{
color: #796dc7!important;
}
a.link-anticon{
color: #796dc7!important;
}
a.link-anticon:hover{
color: #483e93!important;
}
/** CustomerThread **/
form.form-subject-message{
width: 320px;
display: inline-block;
vertical-align: top;
}
form.form-forward-message{
margin-bottom: 20px;
width: 360px;
display: inline-block;
vertical-align: top;
}
form.form-forward-message label{
line-height: 26px;
font-size: 14px;
padding: 0 5px 0 0;
}
form.form-forward-message #message_forward {
padding: 5px;
width: 350px;
text-align: right;
}
form.form-forward-message textarea {
border: 1px solid #000;
}
form.form-forward-message input:focus,
form.form-forward-message textarea:focus {
background-color: #F1F1F1;
}
form.form-forward-message .button {
font-size: 14px;
background-color: rgba(86,84,133,0.7);
border: 1px solid #565485;
border-left: 1px solid rgba(86,84,133,0.6);
border-top: 1px solid rgba(86,84,133,0.6);
color: rgba(255,255,255,0.9);
padding: 5px 10px;
}
form.form-forward-message .button:hover {
background-color: #565485;
border: 1px solid rgba(86,84,133,0.6);
border-left: 1px solid #565485;
border-top: 1px solid #565485;
color: #fff;
}
form.form-forward-message .button:focus{
background-color: rgba(86,84,133,0.6);
}
.btn-action{
text-align: center;
}
.btn-action-message{
position:relative;
display: inline-block;
/*float:left;*/
margin-bottom:10px;
background: rgba(226,110,162,0.2);
margin-right:5px;
box-sizing: border-box;
text-transform:uppercase;
color:#e36ea2;
font-weight: bold;
}
.btn-action-message:hover{
background: rgba(226,110,162,1);
color: #fff;
}
.btn-action-message p {
font-size: 13px;
margin: 0;
}
.btn-action-message p a{
cursor: pointer;
}
.btn-action-message p a,
.btn-action-message p>span {
color: #e36ea2;
display: block;
width: auto;
height: 100%;
line-height: 48px;
padding-left: 10px;
padding-right: 55px;
text-align: left;
}
.btn-action-message p a.active,
.btn-action-message:hover p a,
.btn-action-message:hover p>span {
color: #fff;
}
.btn-action-message p a.active{
background: rgba(226,110,162,1);
}
.btn-action-message p span.anticon,
.btn-action-message p a span.anticon{
position: absolute;
top: 6px;
right: 10px;
font-size: 35px;
opacity: 0.5;
}
.panel-message{
box-sizing: border-box;
float: left;
width: 700px;
margin-top: 10px;
background: #fff;
padding: 5px 10px;
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;
}
.panel-message:after{
content: '';
display: block;
clear: both;
}
.panel-message:first-child{
margin-top: 0px;
}
.panel-head{
display: block;
position: relative;
clear: both;
width: 100%;
padding: 5px;
min-height: 30px;
box-sizing: border-box;
border-bottom: 1px solid #f1F1F1;
margin-bottom: 10px;
}
.panel-head.bg-rose{
background: rgba(226,110,162,0.2);
}
.panel-head.bg-purple{
background: rgba(121,109,199,0.2);
}
.panel-head .panel-head-left,
.panel-head .panel-head-left p,
.panel-head .panel-head-left div{
float: left
}
.panel-head .panel-head-right,
.panel-head .panel-head-right p,
.panel-head .panel-head-right div{
float:right;
}
.panel-message .panel-head div.user-info{
line-height: 20px;
font-weight: bold;
color: #796dc7;
margin-right: 5px;
font-size: 16px;
}
.panel-message .panel-head.bg-rose div.user-info{
color:#e36ea2;
}
.panel-message .panel-head div.user-info .anticon{
font-size: 20px;
}
.panel-message .panel-head div.user-info a {
color: #796dc7;
}
.panel-message .panel-head div.div-date{
color:rgba(0,0,0,0.5);
font-size: 12px;
line-height: 20px;
}
.panel-message .panel-head div.div-date .anticon{
font-size: 14px;
}
.panel-message .more-info{
display: none;
border: 1px solid #f1F1F1;
border-radius: 4px;
margin-bottom: 10px;
padding: 0px 10px;
}
.panel-message .more-info ul{
list-style: none;
}
.panel-message .more-info ul li{
line-height: 16px;
}
.panel-message .product-box{
float:left;
width:100px;
margin-right:10px;
margin-bottom:5px;
padding: 5px;
min-height: 152px;
text-align:center;
-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;
}
.panel-message form label {
width: auto;
font-size: 14px;
line-height: 22px;
}
.panel-content-message{
border-radius: 4px;
margin: 10px 0 0 0;
padding: 5px 10px 10px;
position: relative;
}
.panel-content-message.bg-rose{
border: 1px solid #e36ea2;
background: rgba(226,110,162,0.2);
}
.panel-content-message.bg-purple{
display: inline-block;
width: 80%;
border: 1px solid #796dc7;
background: rgba(121,109,199,0.2);
}
.panel-content-message b{
opacity: 1.2;
font-size: 30px;
position: absolute;
right: 5px;
}
.panel-content-message.bg-purple b{
color: rgba(121,109,199,0.2);
}
.panel-content-message.bg-rose b{
color: rgba(226,110,162,0.2);
}
.panel-message .btn-answer{
display: inline-block;
vertical-align: top;
margin-top: 10px;
}
.panel-message .button {
font-size: 14px;
background-color: rgba(86,84,133,0.7);
border: 1px solid #565485;
border-left: 1px solid rgba(86,84,133,0.6);
border-top: 1px solid rgba(86,84,133,0.6);
color: rgba(255,255,255,0.9);
padding: 5px 10px;
}
.panel-message .btn-answer .button{
padding: 13px 10px;
}
.panel-message .button:hover {
background-color: #565485;
border: 1px solid rgba(86,84,133,0.6);
border-left: 1px solid #565485;
border-top: 1px solid #565485;
color: #fff;
}
.panel-message .button:focus{
background-color: rgba(86,84,133,0.6);
}
.panel-message textarea {
border: 1px solid #000;
}
.panel-message input[type="file"] {
border :0px;
margin-top: 5px;
}
.panel-answer,
.panel-answer div:not(.styled-select) {
width: 100%;
}
.panel-answer textarea{
width: 670px;
height: 120px;
}
.panel-answer input:focus,
.panel-answer textarea:focus {
background-color: #F1F1F1;
}
#form_customer_thread table table,
.table.customerThread-table {
width: 100%;
border: 1px solid #565485;
background: #fff;
padding: 20px;
-moz-box-shadow: 2px 2px 5px #cccccc;
-webkit-box-shadow: 2px 2px 5px #CCC;
-ms-box-shadow: 2px 2px 5px #cccccc;
-o-box-shadow: 2px 2px 5px #cccccc;
box-shadow: 2px 2px 5px #CCC;
border-collapse: collapse;
border-spacing: 0;
margin-bottom: 20px;
}
.table.customerThread-table {
width: 700px;
}
#form_customer_thread table table tr th,
.tab_customer_thread table tr th,
.table.customerThread-table tr th {
background: rgba(86,84,133,0.9);
color: #fff;
font-weight: 300;
}
#form_customer_thread table table tr td,
.tab_customer_thread table tr td,
.table.customerThread-table tr td {
border-bottom: 1px solid #DEDEDE;
color: #000;
padding: 0 4px 0 6px;
}
#form_customer_thread table table tr td.text-bold{
font-weight: 600;
}
#form_customer_thread p.text-green-light{
color: #55b239;
}
#form_customer_thread p.text-rose-light{
color: #e36ea2;
}
#form_customer_thread table table tr td p {
margin: 0;
padding: 5px 0;
text-align: center;
}
#form_customer_thread table table tr td p.bg-green-light{
background: #C0E3B5;
}
#form_customer_thread table table tr td p.bg-rose-light{
background: rgba(226,110,162,0.2);
}
.tab_customer_thread .button {
background-color: rgba(86,84,133,0.7);
border: 1px solid #565485;
border-left: 1px solid rgba(86,84,133,0.6);
border-top: 1px solid rgba(86,84,133,0.6);
color: rgba(255,255,255,0.9);
padding: 3px;
}
.tab_customer_thread .button:hover {
background-color: #565485;
border: 1px solid rgba(86,84,133,0.6);
border-left: 1px solid #565485;
border-top: 1px solid #565485;
color: #fff;
padding: 3px;
}
.tab_customer_thread .button:focus{
background-color: rgba(86,84,133,0.6);
}

View File

@ -765,6 +765,19 @@ function orderOverwriteMessage(sl, text)
}
}
function savOverwriteMessage(sl, text, id_message)
{
var $zone = $('#txt_msg_'+id_message);
var sl_value = sl.options[sl.selectedIndex].value;
if (sl_value != '0')
{
if ($zone.val().length > 0 && !confirm(text))
return ;
$zone.val(sl_value);
}
}
function setCancelQuantity(itself, id_order_detail, quantity)
{
$('#cancelQuantity_' + id_order_detail).val($(itself).attr('checked') ? quantity : '');

View 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>';
}
}
}

View File

@ -8,7 +8,7 @@ class Reason
public $contact = array();
public $title = array();
public $versions = array();
public function __construct($id=NULL)
{
if($id !== NULL) {
@ -105,7 +105,7 @@ class Reason
if($this->id !== null) {
Db::getInstance()->Execute('
UPDATE `'._DB_PREFIX_.'support_reason` SET
`id_contact` = '.(int) $this->id_contact.'
`id_contact` = '.(int) $this->id_contact.',
`visible` = '.(int) $this->visible.'
WHERE `id_reason` = '.(int) $this->id.'
');
@ -167,7 +167,7 @@ class Reason
}
public function insertReasonCustomerThread($id_thread) {
if(!($result = Db::getInstance()->ExecuteS('
SELECT *
FROM `'._DB_PREFIX_.'support_reason_customerthread`

View File

@ -0,0 +1,41 @@
<?php
require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php');
global $cookie;
$langs = Language::getLanguages();
$lang = (int) $cookie->id_lang;
$isolang = Language::getIsoById($lang);
$errors = array();
if ($cookie->isLogged() && Tools::getValue('id_order')) {
$order = new Order((int)Tools::getValue('id_order'));
$link = new Link();
if (Validate::isLoadedObject($order)) {
$products = $order->getProducts();
$productList = '';
foreach ($products as $key => $product) {
$p = new Product((int)$product['product_id'], false, $lang);
if (isset($product['product_attribute_id']) AND (int)($product['product_attribute_id'])) {
$image = Db::getInstance()->getRow('
SELECT id_image
FROM '._DB_PREFIX_.'product_attribute_image
WHERE id_product_attribute = '.(int)($product['product_attribute_id']));
} elseif (isset($product['product_id']) AND (int)($product['product_id'])) {
$image = Db::getInstance()->getRow('
SELECT id_image
FROM '._DB_PREFIX_.'image
WHERE id_product = '.(int)($product['product_id']).' AND cover = 1');
}
$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>';
}
if(!empty($productList)) {
header('Content-Type: text/json');
die(json_encode(array("error"=> 'false',"result" => $productList)));
} else {
header('Content-Type: text/json');
die(json_encode(array("error"=> 'true')));
}
}
}

View File

@ -2,7 +2,7 @@
if (!defined('_PS_VERSION_'))
exit;
class Ant_Support_Form extends Module
class Ant_Support_Form extends Module
{
public function __construct()
@ -19,7 +19,7 @@ class Ant_Support_Form extends Module
$this->description = $this->l('Adding forms for cancellations and problemes, adding reasons for cancellation');
}
public function install()
public function install()
{
$query = '
@ -54,6 +54,17 @@ class Ant_Support_Form extends Module
if(!Db::getInstance()->Execute($query)) {
return false;
}
$query = '
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'support_product_customerthread` (
`id_product` int(11) NOT NULL,
`id_product_attribute` int(11) NOT NULL,
`id_customer_thread` int(11) NOT NULL,
PRIMARY KEY (`id_product`,`id_product_attribute`,`id_customer_thread`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
';
if(!Db::getInstance()->Execute($query)) {
return false;
}
if(!(parent::install())) {
return false;

View File

@ -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 .= '<option value="'.$key.'" '.((int)(Tools::getValue('id_order')) == $key ? 'selected' : '').' >'.$key.' -- '.$val.'</option>';
}
$orderedProductList = '';
foreach ($products as $key => $val) {
$orderedProductList .= '<option value="'.$key.'" '.((int)(Tools::getValue('id_product')) == $key ? 'selected' : '').' >'.$val.'</option>';
$orderList .= '<option value="'.$key.'" '.((int)(Tools::getValue('id_order')) == $key ? 'selected' : '').' >#'.$key.' - '.$val.'</option>';
}
$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');
@ -135,13 +126,13 @@ if (Tools::isSubmit('submitMessage')) {
}
if (!empty($contact->email))
{
/*if (Mail::Send((int)($cookie->id_lang), 'contact_form', Mail::l('Your message has been correctly sent'), array('{message}' => stripslashes($message)), $from)) {
if (Mail::Send((int)($cookie->id_lang), 'contact_form', Mail::l('Your message has been correctly sent'), array('{message}' => stripslashes($message)), $from)) {
$smarty->assign('confirmation', 1);
} else {
$errors[] = Tools::displayError('An error occurred while sending message.');
}
else
$errors[] = Tools::displayError('An error occurred while sending message.');*/
// local
$smarty->assign('confirmation', 1);
// $smarty->assign('confirmation', 1);
}
if ($contact->customer_service)
@ -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;
@ -195,9 +206,9 @@ if (Tools::isSubmit('submitMessage')) {
$cm->user_agent = $_SERVER['HTTP_USER_AGENT'];
if ($cm->add())
{
/*if (empty($contact->email)) {
if (empty($contact->email)) {
Mail::Send((int)($cookie->id_lang), 'contact_form', Mail::l('Your message has been correctly sent'), array('{message}' => stripslashes($message)), $from);
}*/
}
$smarty->assign('confirmation', 1);
}
else

View File

@ -34,7 +34,7 @@
{if !isset($customerThread.id_order) && isset($isLogged) && $isLogged == 1 && !empty($orderList)}
<p class="text">
<label for="id_order">{l s='Order ID' mod='ant_support_form'}</label>
<select name="id_order" ><option value="0">{l s='-- Choose --' mod='ant_support_form'}</option>{$orderList}</select>
<select name="id_order" id="id_order"><option value="0">{l s='-- Choose --' mod='ant_support_form'}</option>{$orderList}</select>
{elseif !isset($customerThread.id_order) && !isset($isLogged)}
<p class="text">
<label for="id_order">{l s='Order ID' mod='ant_support_form'}</label>
@ -50,15 +50,64 @@
</p>
{/if}
{if isset($isLogged) && $isLogged && isset($allow_product) && $allow_product}
{if !isset($customerThread.id_product) && !empty($orderedProductList)}
<p class="text">
<label for="id_product">{l s='Product' mod='ant_support_form'}</label>
<select name="id_product" style="width:300px;"><option value="0">{l s='-- Choose --'}</option>{$orderedProductList}</select>
</p>
{if !isset($customerThread.id_product)}
<div id="products_part" class="text" style="display:none;">
<label for="id_products">{l s='Product' mod='ant_support_form'}</label>
<div id="products">
</div>
</div>
{literal}<script>
$(function() {
if ($('#id_order').val()!= 0) {
var id_order = $('#id_order').val();
$.ajax({
type: 'GET',
url: '{/literal}{$base_dir_ssl}{literal}modules/ant_support_form/ajax_support.php',
dataType: 'json',
data: {
id_order : id_order,
token : static_token
},
success: function(jsonData) {
$("#products_part").hide();
$("#products").empty();
if(jsonData.error == "false") {
$("#products").append(jsonData.result);
$("#products_part").show();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to get order products \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
});
}
$('#id_order').change(function() {
var id_order = $(this).val();
$.ajax({
type: 'GET',
url: '{/literal}{$base_dir_ssl}{literal}modules/ant_support_form/ajax_support.php',
dataType: 'json',
data: {
id_order : id_order,
token : static_token
},
success: function(jsonData) {
$("#products_part").hide();
$("#products").empty();
if(jsonData.error == "false") {
$("#products").append(jsonData.result);
$("#products_part").show();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to get order products \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
});
});
});
</script>{/literal}
{elseif $customerThread.id_product > 0}
<p class="text">
<label for="id_product">{l s='Product' mod='ant_support_form'}</label>
<input type="text" name="id_product" id="id_product" value="{$customerThread.id_product|intval}" readonly="readonly" />
<input type="text" name="id_products[]" id="id_product" value="{$customerThread.id_product|intval}" readonly="readonly" />
</p>
{else}
<p class="text error cant-submit">

View File

@ -19,100 +19,48 @@ 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)) {
if(Db::getInstance()->getValue('
SELECT `id_carrier`
FROM `'._DB_PREFIX_.'carrier`
WHERE `id_carrier` = '.(int) $cart->id_carrier.'
AND `name` LIKE "%so colissimo%"
')) {
$socol = Db::getInstance()->getRow('
SELECT *
FROM `'._DB_PREFIX_.'socolissimo_delivery_info`
WHERE `id_cart` = '.(int) $cart->id.'
');
if($socol) {
$order_address = nl2br(preg_replace("/(\r\n){2,}/", "\r\n", implode("\r\n", array(
$socol['cefirstname'].' '.$socol['cename'],
$socol['cecompanyname'],
$socol['prfirstname'].' '.$socol['prname'],
$socol['prcompladress'],
$socol['pradress1'],
$socol['pradress2'],
$socol['pradress3'],
$socol['pradress4'],
$socol['przipcode'].' '.$socol['prtown'],
'FRANCE',
$socol['cephonenumber'],
!empty($socol['cedoorcode1'])? 'Code porte 1 : '.$socol['cedoorcode1']: '',
!empty($socol['cedoorcode2'])? 'Code porte 2 : '.$socol['cedoorcode2']: '',
$socol['cedeliveryinformation'],
))));
} else {
$order_address = nl2br(AddressFormat::generateAddress(new Address((int) $cart->id_address_delivery)));
}
} else {
$order_address = nl2br(AddressFormat::generateAddress(new Address((int) $cart->id_address_delivery)));
}
if ($cookie->id_lang == 3 && (int)$cart->id_carrier == 87) {
$carrier_name = "SEUR a domicilio";
} else {
$carrier_name = Db::getInstance()->getValue('
SELECT `name`
FROM `'._DB_PREFIX_.'carrier`
WHERE `id_carrier` = '.(int) $cart->id_carrier.'
');
}
$products_keys = array();
$products_delays = array();
$products = $cart->getProducts();
$i = 0;
foreach($products as $product) {
$products_keys[(int) $product['id_product']] = $i;
$i++;
}
// assign delay to Products
if (Module::isInstalled('privatesales_delay')) {
if (!class_exists('SaleDelay')) {
require_once _PS_ROOT_DIR_.'/modules/privatesales_delay/saledelay.php';
}
$delay_products = SaleDelay::associateDelay($products);
$delays = array_keys($delay_products);
$date = new DateTime();
$delivery_date = SaleDelay::getDeliveryDate($delays, null, $date, true);
foreach($delays as $delay) {
$row = Db::getInstance()->getRow('
SELECT l.`name`
FROM `'._DB_PREFIX_.'privatesale_delay_lang` l
WHERE l.`id_lang` = '.(int) $cookie->id_lang.'
AND l.`id_delay`='.(int)$delay.'
');
$delay_name = $row['name'];
break;
}
}
$data = $this->getOrderDetail($cart,$cookie->id_lang);
$smarty->assign(array(
'order_address' => $order_address,
'carrier_name' => $carrier_name,
'delay_name' => $delay_name,
'delivery_date' => (isset($delivery_date)?$delivery_date:null)
'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');
}
}
@ -120,4 +68,247 @@ class BlockOrderSummary extends Module {
public function hookRightColumn($params) {
return $this->hookLeftColumn($params);
}
public function hookRightColumnSav($params) {
global $cookie;
if(isset($params['order'])) {
$cart = new Cart((int)$params['order']->id_cart);
$data = $this->getOrderDetail($cart,(int)$cart->id_lang,$params['order']);
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.order-info{
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>";
$currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT')));
$currentState = OrderHistory::getLastOrderState((int)$params['order']->id);
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee));
echo '<div id="blockordersummary">
<div class="content">
<h4>'.$this->l('Summary of my order' ).' <a target="_blank" href="?tab=AdminOrders&id_order='.(int)$params['order']->id.'&vieworder&token='.$tokenOrders.'">(#'.(int)$params['order']->id.')</a></h4>
<div class="order-info">
<h5>'.$this->l('Order Status').'</h5>
<p>'.($currentState->id == 8?'<span class="anticon anticon-blocked"></span>':($currentState->id == 18?'<span class="anticon anticon-warning"></span>':'')).' <b>'.$currentState->name.'</b></p>
</div>
<div class="my-cart">
<h5>'.$this->l('My Cart').'</h5>
<ul>';
foreach ($cart->getProducts() as $key => $product) {
echo '<li>'.$product['quantity'].' x '.mb_strimwidth($product['name'], 0, 35, "...").' <span class="price">'.Tools::displayPrice($product['total_wt'],$currency).'</span></li>';
}
echo '</ul>
<p>'.$this->l('Products total').' <span class="price price_total">'.Tools::displayPrice($cart->getOrderTotal(TRUE,1),$currency).'</span></p>';
if ($cart->getOrderTotal(TRUE, 2) != 0){
echo '<p>'.$this->l('Discounts total').' <span class="price price_total">'.Tools::displayPrice($cart->getOrderTotal(TRUE,2),$currency).'</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">'.Tools::displayPrice($cart->getOrderTotal(TRUE, 5),$currency).'</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['date_start']->format('d/m/Y').'</strong> '.$this->l('et le').' <strong>'.$date['date_end']->format('d/m/Y').'</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">'.Tools::displayPrice($cart->getOrderTotal(TRUE),$currency).'</span></p>
</div>
</div>
</div>';
}
}
public function getOrderDetail($cart,$id_lang, $order = null){
if(Db::getInstance()->getValue('
SELECT `id_carrier`
FROM `'._DB_PREFIX_.'carrier`
WHERE `id_carrier` = '.(int) $cart->id_carrier.'
AND `name` LIKE "%so colissimo%"
')) {
$socol = Db::getInstance()->getRow('
SELECT *
FROM `'._DB_PREFIX_.'socolissimo_delivery_info`
WHERE `id_cart` = '.(int) $cart->id.'
');
if($socol) {
$order_address = nl2br(preg_replace("/(\r\n){2,}/", "\r\n", implode("\r\n", array(
$socol['cefirstname'].' '.$socol['cename'],
$socol['cecompanyname'],
$socol['prfirstname'].' '.$socol['prname'],
$socol['prcompladress'],
$socol['pradress1'],
$socol['pradress2'],
$socol['pradress3'],
$socol['pradress4'],
$socol['przipcode'].' '.$socol['prtown'],
'FRANCE',
$socol['cephonenumber'],
!empty($socol['cedoorcode1'])? 'Code porte 1 : '.$socol['cedoorcode1']: '',
!empty($socol['cedoorcode2'])? 'Code porte 2 : '.$socol['cedoorcode2']: '',
$socol['cedeliveryinformation'],
))));
} else {
$order_address = nl2br(AddressFormat::generateAddress(new Address((int) $cart->id_address_delivery)));
}
} else {
$order_address = nl2br(AddressFormat::generateAddress(new Address((int) $cart->id_address_delivery)));
}
if ($id_lang == 3 && (int)$cart->id_carrier == 87) {
$carrier_name = "SEUR a domicilio";
} else {
$carrier_name = Db::getInstance()->getValue('
SELECT `name`
FROM `'._DB_PREFIX_.'carrier`
WHERE `id_carrier` = '.(int) $cart->id_carrier.'
');
}
$products_keys = array();
$products_delays = array();
$products = $cart->getProducts();
$i = 0;
foreach($products as $product) {
$products_keys[(int) $product['id_product']] = $i;
$i++;
}
// assign delay to Products
if (Module::isInstalled('privatesales_delay')) {
if (!class_exists('SaleDelay')) {
require_once _PS_ROOT_DIR_.'/modules/privatesales_delay/saledelay.php';
}
$delay_products = SaleDelay::associateDelay($products);
$delays = array_keys($delay_products);
if ($order!=null) {
$date = new DateTime($order->date_add);
} else {
$date = new DateTime();
}
$delivery_date = SaleDelay::getDeliveryDate($delays, null, $date, true);
foreach($delays as $delay) {
$row = Db::getInstance()->getRow('
SELECT l.`name`
FROM `'._DB_PREFIX_.'privatesale_delay_lang` l
WHERE l.`id_lang` = '.(int) $id_lang.'
AND l.`id_delay`='.(int)$delay.'
');
$delay_name = $row['name'];
break;
}
}
return array(
'order_address' => $order_address,
'carrier_name' => $carrier_name,
'delay_name' => $delay_name,
'delivery_date' => (isset($delivery_date)?$delivery_date:null)
);
}
}

View File

@ -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}

View File

@ -5835,6 +5835,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;
}