• File: mandat_minute.php
  • Full Path: /home/dealkatnwc/www/wp-custom/mandat_minute.php
  • Date Modified: 02/13/2019 1:25 PM
  • File size: 4.11 KB
  • MIME-type: text/html
  • Charset: utf-8
<style>header.entry-header{display: none;}</style>
<style>.asteriskField{color: red;} .input-group{margin: 5px;} .input-group-addon{width: 40%;text-align: left;} </style>

<?php
if (!( isset($_POST['deal_id']) )) {echo "<script>document.location.href='".get_bloginfo('url')."/404.php/?erreur=1';</script>";}
if (!( is_user_logged_in() ))  {echo "<script>document.location.href='".get_bloginfo('url')."/404.php/?erreur=2';</script>";}
if (get_post_type( $_POST['deal_id'] ) != 'deal')  {echo "<script>document.location.href='".get_bloginfo('url')."/404.php/?erreur=3';</script>";}
if (get_post_meta( $_POST['deal_id'], 'wpcf-date-d-expiration', true ) < time())  {echo "<script>document.location.href='".get_bloginfo('url')."/404.php/?erreur=4';</script>";}

global $current_user;
get_currentuserinfo();

$titre = get_the_title($_POST['deal_id']);
$prix_promo = get_post_meta( $_POST['deal_id'], 'wpcf-prix-promo', true );
?>
<h1>Votre commande</h1>

<table class="table table-bordered">
    <thead>
        <tr>
            <th width="25%">Produit</th>
            <th width="50%">Offre</th>
            <th width="10%">Quantité</th>
            <th width="15%">Prix</th>
        </tr>
    </thead>
	
    <tbody>
        <tr>
            <td>
			   <div class="img-hover" scope="row">
				<?php echo '<img src="'.wp_get_attachment_url( get_post_thumbnail_id($_POST['deal_id']) ).'" class="img-responsive" alt="">';?>	                  		
			    </div>
			</td>
            <td><a href="<?php  echo get_page_link($_POST['deal_id']);?>" target="_blanc"><?php echo $titre;?></a></td>
            <td><?php echo $_POST['quantite']; ?></td>
            <td><?php echo $prix_promo;?><sup>DT</sup></td>
            
        </tr>
    </tbody>

	<tbody>
		<tr class="text-center">
			<th scope="row" colspan="3" class="text-center">Total</th>
			<td ><b><?php echo $prix_promo * $_POST['quantite'] ;?></b><sup>DT</sup></td>
		</tr>
	</tbody>	
</table>	
<?php
////on insérer dans la commande 
global $wpdb;
$orderID=time();				 
$test = false;
 // tester que le numéro de cmd est unique
while($test == false)
{$nb = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}coupons WHERE code_cmd = '".$orderID."' ");if ($nb==0) {$test = true;} else {$orderID++;}}

$wpdb->insert($wpdb->prefix.'coupons', array(  'id' => NULL,
												'code_cmd' => $orderID,
												'deal_id' => $_POST['deal_id'],
												'id_vendeur' => 0,
												'dealer_nom' => $_POST["dealer_nom"],
												'dealer_prenom' => $_POST["dealer_prenom"],
												'dealer_tel' => $_POST["dealer_tel"],
												'dealer_sex' => $current_user->gender,
												'dealer_gouv' => $current_user->gouvernorat,
												'dealer_email' => $_POST["dealer_email"],
												'date_coupon' => $orderID,
												'quantite' => $_POST["quantite"],
												'etat' => 8,
												'mailing' => 0,
												'recu' => 0),
										array( '%d', '%d', '%d','%d', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' ) );

 
////////
?>

<div class="alert alert-info" role="alert">
<p>Votre N° Commande: <b><?php echo $orderID; ?></b></p>
<p><?php echo $_POST['dealer_prenom']; ?>!  Vous devez vous rendre dans un bureau de poste Tunisienne, payer la mandat minute (<?php echo $prix_promo * $_POST['quantite'] ;?></b><sup>DT</sup>).</p>
<p>Enfin, Merci de nous  transmettre <b> Le code secret</b> du mandat ainsi que votre <b>N°de Commande</b> Par : </p>
<ul>
<li>&nbsp;<i class="fa fa-mobile" aria-hidden="true"></i>&nbsp;SMS : 96 46 56 66</li>
<li>&nbsp;<i class="fa fa-envelope-o" aria-hidden="true"></i>&nbsp;Mail : sav@dealka.tn</li>
<li>&nbsp;<i class="fa fa-facebook-official" aria-hidden="true"></i>&nbsp;Facebook : <a target="_blanc" href="https://www.facebook.com/dealka.tn/">Notre page</a></li>
<li>&nbsp;<i class="fa fa-headphones" aria-hidden="true"></i>&nbsp;Facebook : <a target="_blanc" href="https://www.facebook.com/profile.php?id=100012928089899">Conseillère Dealka</a></li>
</ul>
<p>Pour plus d'information, contactez 96 46 56 66 / 79 218 968.</p>
</div>
<center>
 <img src="<?php echo get_template_directory_uri(); ?>/images/mandatminute.png" class="img-responsive"  alt="">
</center>