ÿØÿà JFIF ` ` ÿþxØ
| Server IP : 109.234.164.53 / Your IP : 216.73.216.110 Web Server : Apache System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64 User : computer3 ( 1098) PHP Version : 7.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/computer3/litsolide.com/cp-admin/ |
Upload File : |
<?php
include_once('includes/header.php');
$id_volet ="21";
include('includes/volet.php');
/****************************/
if (isset($_GET['id'])) {
$id_client = $_GET['id'];
} else {
$id_client = $_POST['id_client'];
}
//****************************************************************************************//
//************************************ css pour mails ************************************//
//****************************************************************************************//
$thema = $GLOBALS['bdd']->query('SELECT * FROM info WHERE id = 1');
$resulta = $thema->fetchAll();
$fil = $resulta[0]['fil'] ;
$tfil = $resulta[0]['tfil'] ;
$shop_email_rappel = $resulta[0]['email_rappel'];
$shop_title = $resulta[0]['title'];
$url_shop = $resulta[0]['url'] ;
$conff = $GLOBALS['bdd']->query('SELECT Image_logo FROM configuration WHERE id = 1');
$resultas = $conff->fetchAll();
$Image_Logo = $resultas[0]['Image_logo'] ;
//////////////////////////////////////////////////////////// PAGINATION
require_once('pagination_fonction.php');
//////////////////////////////////////////////////////////// PAGINATION
// Suppression de la commande.
if (isset($_GET['del']))
{
$id = $_GET['del'];
$requete = $bdd->prepare("DELETE FROM orders WHERE id = :id");
$requete->execute(array('id' => $id));
$requete = $bdd->prepare("DELETE FROM orders_products WHERE id_order = :id");
$requete->execute(array('id' => $id));
/*
$requete = $bdd->prepare("DELETE FROM order_status WHERE id_order = :id");
$requete->execute(array('id' => $id));
*/
//////////////////////////////////////////////////////
}
// Mise ?jour du status de la commande
if (isset($_POST['insere_status']))
{
$sql = $bdd->prepare('INSERT INTO order_status(id_order, date_status, status)
VALUES (:order, :date_status, :status)');
$sql->execute(array('order' => $_POST['id'],
'date_status' => date('Y-m-d H:i:s'),
'status' => $_POST['status']));
$sql = $bdd->query('SELECT title, url, email_contact FROM info
WHERE id = 1');
$infos = $sql->fetch();
$sql = $bdd->prepare('SELECT id, date_insere, id_order, email FROM orders
WHERE id = :order');
$sql->execute(array('order' => $_POST['id']));
$order = $sql->fetch();
// Si module point actif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($fidel > 0) {
if ($_POST['status'] =='3') {
// Valeur du point
$GLOBALS['db_table']['points'] = 'points';
$GLOBALS['db_table']['orders'] = 'orders';
$GLOBALS['db_table']['customers'] = 'customers';
$idpointe = "1";
$requete = $bdd->query("SELECT * FROM " . $GLOBALS['db_table']['points'] . " WHERE id = " . $idpointe);
$po = $requete->fetch();
$valeur_point = $po['val_point'];
$remise_points = $po['remise'];
// Trouve num customer et total cde
$num_cde = $_POST['id'];
$requetecc = $bdd->query("SELECT customer,sub_total FROM " . $GLOBALS['db_table']['orders'] . " WHERE id = " . $num_cde);
$pocc = $requetecc->fetch();
$num_customer = $pocc['customer'];
$tot_ca = $pocc['sub_total'];
// Trouve solde de points client
$requetebb = $bdd->query("SELECT points FROM " . $GLOBALS['db_table']['customers'] . " WHERE id = " . $num_customer);
$pobb = $requetebb->fetch();
$solde_points = $pobb['points'];
// Points de la cde
$point_deduir = $tot_ca * $valeur_point;
$point_deduits = floor($point_deduir); // arrondi entier inferieur si virgule
// calcul le nouveau solde
$new_solde_points = $solde_points - $point_deduits;
if ($new_solde_points <0) {$new_solde_points ='0'; }
// enregistre les points dans cde
$qidd = $bdd->prepare("UPDATE " . $GLOBALS['db_table']['customers'] . "
SET points = :points WHERE id=:id");
$qidd->execute(array('points' => $new_solde_points,
'id' => $num_customer));
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
//////////////////////////////////////////////////////
if ($gesto > 0) {
if ($_POST['status'] =='3') {
$id_cde = $_POST['id'];
$status_cde = $_POST['status'];
include('debit_stock.php');
}
}
/////////////////////////////////////////////////////
$msg ='
<html lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>';
if ($emailo < 1) { $msg .='<img src="'.$url_shop.'/templates/shop/img/'.$Image_Logo.'" style="margin:10px; max-width:300px">';
} else {
$msg .='<img src="'.$url_shop.'/templates/shop/img/'.$Image_Logo.'" style="margin:10px;max-width:300px">';
}
$msg .='
<div style="background-color: #'.$fil.'; color:#'.$tfil.'; border-radius: 6px;">
<h3 style="font-size:20px; padding:10px;">Suivi de votre commande</h3>
</div>
<br />';
$msg .= '
Votre commmande du ' . strftime("%d/%m/%Y", strtotime($order['date_insere'])) . ' (Commande N. ' . $order['id_order'] . ' - ' . $order['id'] . ') a été mise à jour le ' . strftime("%d/%m/%Y à %Hh%M", time()) . '. <br /><br />Son nouveau statut est désormais <b>"';
switch ($_POST['status']) {
case '1':
$msg .= ''. $comm_1;
break;
case '2':
$msg .= ''. $comm_2;
break;
case '3':
$msg .= ''. $comm_3;
break;
default:
$msg .= ''. $comm_4;
break;
}
$msg .= '"</b>.<br />Vous pouvez suivre votre commande en cliquant ici : <a href="http://' . $infos['url'] . '/suivi-de-commande-' . $order['id_order'] . '">Suivi de ma commande</a>';
$msg .= '<br /><br /><b>'.$infos['title'].'</b> vous remercie de votre confiance.<br /><br /><br /><br />';
// Envoi message au client.
require('../includes/phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsMail();
$mail->AddReplyTo($shop_email_rappel, $shop_title);
$mail->AddAddress($order['email']);
$mail->SetFrom($shop_email_rappel, $shop_title);
$mail->Subject = "Suivi de votre commande depuis le site " . $shop_title;
$mail->MsgHTML($msg);
$mail->Send();
}
?>
<div class="container">
<div class="row">
<div class="span12">
<div class="page-header">
<h1>Liste des commandes client Num. : <?php echo$id_client; ?>
<div class="pull-right">
<a href="./comptes.php?debut=0" class="btn btn-primary"><i class="icon-arrow-left"></i> Retour Comptes Clients</a>
</div>
</h1>
</div>
</div>
</div>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span1 center">N.Ordre</th>
<th class="span1 center">N.Cde</th>
<th class="span2 center">Nom</th>
<th class="span2 center">Date</th>
<th class="span1 center">Etat</th>
<th class="span1 center">Total</th>
<th class="span1 center">Opérations</th>
</tr>
</thead>
<tbody>
<?php
$requete = $bdd->query("SELECT o.*, a.firstname, a.lastname, os.status FROM orders o
INNER JOIN address a
ON a.id = o.invoice_address
RIGHT JOIN order_status os
ON os.id_order = o.id
WHERE o.customer = $id_client AND os.date_status = (SELECT MAX(date_status) FROM order_status
WHERE id_order = o.id)
ORDER BY id DESC");
if ($row = $requete->fetch()) {
do {
?>
<tr>
<td class="span1 font12 center">
<b><?php echo stripcslashes($row['id']) ?></b>
</td>
<td class="span1 font12 center">
<b><?php echo stripcslashes($row['id_order']) ?></b>
</td>
<td class="span1 font12 center">
<b><?php echo stripcslashes($row['firstname']) ?> <?php echo stripcslashes($row['lastname']) ?></b>
</td>
<td class="span1 font12 center">
<b>
<?php
setlocale (LC_TIME, 'fr_FR.utf8','fra');
echo utf8_encode(strftime("%A %d-%m-%Y", strtotime($row['date_insere'])));
echo'<br />';
echo'<font color="#FF0000">' . $row['carrier'] .'</font>';
?>
</b>
</td>
<td class="span1 font12 center">
<b>
<?php
switch ($row['status']) {
case '1':
echo$comm_1;
break;
case '2':
echo$comm_2;
break;
case '3':
echo$comm_3;
break;
default:
echo$comm_4;
break;
}
?>
</b>
</td>
</td>
<td class="span1 font12 center">
<b><?php echo stripcslashes(number_format($row['total'], 2, ',', ' '))."€" ?> <br /><font color="#CC3300" size="2"><?php echo $row['txt_discount']; ?></font></b>
</td>
<td class="center">
<?php if ($row['status'] !== '3') { ?>
<a href="#" id="<?php echo $row['id']; ?>" data-toggle="modal" data-target="#edit_status_<?php echo $row['id']; ?>">
<img src="assets/img/edit.png" title="Editer le statut de la commande">
</a>
<?php } ?>
<a href="./details_compte_order.php?id=<?php echo $row['id']; ?>&id_client=<?php echo$id_client; ?>&debut=<?php echo $_GET['debut']; ?>">
<img src="assets/img/details.png" title="Détail de la commande">
</a>
<?php
/*
if ($row['status'] == '3') { ?>
<a href="./details_compte?del=<?php echo $row['id']; ?>&id_client=<?php echo $id_client; ?>" id="'.$id.'" onclick="return confirm('Êtes vous sur de vouloir supprimer cette commande ?');">
<img src="assets/img/delete.png" title="Supprimer la commande">
</a>
<?php }
*/
?>
</td>
</tr>
<?php
}while ($row = $requete->fetch());
} else {
echo 'Aucune commande a afficher !!!';
}
?>
</tbody>
</table>
</div>
<?php
$requete = $bdd->query("SELECT o.*, a.firstname, a.lastname, MAX(os.status) as status FROM orders o
INNER JOIN address a
ON a.id = o.invoice_address
RIGHT JOIN order_status os
ON os.id_order = o.id
GROUP BY o.id
ORDER BY date_insere DESC");
while ($row = $requete->fetch()) {
?>
<div class="modal hide fade" id="edit_status_<?php echo $row['id']; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" wi>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="edit_status_title_box">Edition du status de la commande</h3>
</div>
<form action="details_compte.php" method="POST">
<input type="hidden" name="id" value="<?php echo $row['id']; ?>">
<input type="hidden" name="id_client" value="<?php echo $id_client; ?>">
<div class="modal-body" id="edit_status_box_content">
<label for="status">Statut :</label>
<select name="status" data-placeholder="Veuillez s?ectionner le nouveau statut de la commande" id="status">
<option value="0"><?php echo$comm_4; ?></option>
<option value="1"><?php echo$comm_1; ?></option>
<option value="2"><?php echo$comm_2; ?></option>
<option value="3"><?php echo$comm_3; ?></option>
</select>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Fermer</button>
<input name="insere_status" type="submit" class="btn btn-primary" value="Enregistrer" />
</div>
</form>
</div>
<?
}
include_once('includes/footer.php');
?>