Files
ms1inscription-v5/panier_checkout.inc.php
2026-05-13 09:43:32 -04:00

329 lines
16 KiB
PHP

<?php
global $vPaypal_devise,$objDatabase, $tabEvenement, $vblnEnvironementDev, $strLangue, $vDomaine, $strCode, $vPaypaladv,$vPaypaladv_SANDBOX;
// MSIN-3855
require_once "paypal_advanced/PaypalCheckout.class.php";
$tabTotal = fxTotalPanier($_SESSION['no_panier'], $strLangue);
// récupérer le mode de paiement choisi
$intPaiement = fxGetPanierPaiement($_SESSION['no_panier']);
// Valide les rabais auto
//fxSetRabaisauto('add', $_SESSION['no_panier'], $tabEvenement, $strLangue);
fxSetRabaisauto2('add', $_SESSION['no_panier'], $tabEvenement, $strLangue);
// récupérer les options disponibles pour cet évènement
$tabOptions = fxGetOptions($tabEvenement['general']['eve_id'], $_SESSION['no_panier']);
if ($strLangue == 'fr')
$strPage = 'panier';
else
$strPage = 'cart';
?>
<div>
<?php
if ($tabOptions != null) {
?>
<div id="options">
<div class="titre"><?php afficheTexte('options_paiment'); ?></div>
<form action="<?php echo $vDomaine; ?>/<?php echo $strPage; ?>/checkout/<?php echo $strCode; ?>"
id="frm_options" name="frm_options" method="post">
<?php
for ($intCtr = 1; $intCtr <= count($tabOptions); $intCtr++) {
?>
<label class="form"><span></span></label>
<p>
<input type="radio" id="option_<?php echo $tabOptions[$intCtr]['opt_id']; ?>" name="opt_id"
value="<?php echo $tabOptions[$intCtr]['opt_id']; ?>"
class="chk_input"<?php if ($intCtr == 1) { ?> checked="checked" <?php } ?>>
<label class="chk_label"
for="option_<?php echo $tabOptions[$intCtr]['opt_id']; ?>"><?php echo fxUnescape($tabOptions[$intCtr]['opt_nom_' . $strLangue]) . ' / ' . fxShowPrix($tabOptions[$intCtr]['opt_prix'], $strLangue, 1); ?></label>
<img class="tooltip" src="<?php echo $vDomaine; ?>/images/information.png"
title="<?php echo htmlspecialchars(fxUnescape($tabOptions[$intCtr]['opt_description_' . $strLangue]) . "<b>" . fxShowDate(fxUnescape($tabOptions[$intCtr]['opt_date_limite_paiement']), $strLangue) . "</b>."); ?>"/>
</p>
<br>
<?php
}
?>
<label class="form"><span></span></label>
<button class="btn btn-primary rounded-0" type="submit" id="btn_options"
name="btn_options"><?php afficheTexte('checkout_btn_options'); ?></button>
</form>
</div>
<?php
}
if (isset($tabEvenement) && intval($tabEvenement['general']['eve_gratuit']) != 1) { // si l'événement n'est pas gratuite, afficher le bloc rabais
?>
<div class="row">
<div class="col-12 col-md-8 col-lg-6">
<div class="card box_participant mb-3">
<div class="card-header">
<h2><?php afficheTexte('code_rabais'); ?></h2>
</div>
<div class="card-body">
<form class="form-inline mb-2"
action="<?php echo $vDomaine; ?>/<?php echo $strPage; ?>/checkout/<?php echo $strCode; ?>"
id="frm_rabais" name="frm_rabais" method="post">
<input type="hidden" name="form_action"
value="<?php echo urlencode(base64_encode('rabais')); ?>">
<label class="sr-only" for="rab_code"><?php afficheTexte('code_rabais'); ?> :</label>
<input class="form-control mb-2 mr-2" type="text" id="rab_code" name="rab_code"
maxlength="30" placeholder="CODE">
<button class="btn btn-primary rounded-0 mb-2" type="submit" id="btn_rabais"
name="btn_rabais"><?php afficheTexte('checkout_btn_rabais'); ?></button>
</form>
<div class="alert alert-info">
<i class="fa fa-info-circle mr-2" aria-hidden="true"></i>
<?php afficheTexte('code_rabais_details'); ?>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
<div class="mb-3" id="panier">
<?php echo fxShowPanier($_SESSION['no_panier'], 0, 'web', 0, $strLangue); ?>
</div>
<div class="row">
<?php
if (!isset($_SESSION['com_id'])) {
$tabParticipants = fxGetPanierParticipants($_SESSION['no_panier']);
$sqlParticipantAcheteur = "SELECT par_id FROM inscriptions_panier_acheteurs WHERE no_panier = '" . $objDatabase->fxEscape($_SESSION['no_panier']) . "'";
$intParticipantAcheteur = $objDatabase->fxGetVar($sqlParticipantAcheteur);
if (count($tabParticipants) > 1) {
?>
<div class="col-12 col-md-6 mb-3">
<div class="card box_participant h-100">
<div class="card-header">
<h2><?php afficheTexte('facturation_adresse'); ?></h2>
</div>
<div class="card-body">
<p><?php afficheTexte('panier_login_fastcheckout_txte'); ?></p>
<?php
foreach ($tabParticipants as $key => $value) {
if ($value['par_id'] == $intParticipantAcheteur)
$memcheck = ' checked="checked"';
else
$memcheck = "";
?>
<div class="form-check">
<input class="form-check-input" type="radio" name="acheteur"
id="chk_acheteur_<?php echo $key; ?>"
value="<?php echo $value['par_id']; ?>"<?php echo $memcheck; ?>>
<label class="form-check-label" for="chk_acheteur_<?php echo $key; ?>">
<?php echo $value['nom']; ?>
</label>
</div>
<?php
}
?>
</div>
</div>
</div>
<?php
}
}
?>
<div class="col-12 col-md-6 mb-3">
<div class="card box_participant h-100">
<div class="card-header">
<h2><?php afficheTexte('panier_login_titre_address'); ?></h2>
</div>
<div class="card-body">
<address class="mb-2" id="adresse_acheteur">
<?php echo fxShowAddress($_SESSION['no_panier'], 'cart', $strLangue); ?>
</address>
<?php
if ($tabEvenement['general']['eve_logged'] != 1) {
?>
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine . '/' . $strPage; ?>/acheteur/<?php echo $tabEvenement['general']['eve_label_url'] ?>"><?php afficheTexte('facturation_changer_add') ?></a>
<?php
}
?>
</div>
</div>
</div>
<div class="col-12 col-md-6 mb-3">
<?php // valide si evenement obligation compte
if (isset($tabEvenement) && $tabEvenement['general']['eve_checkout_login'] == "1") {
?>
<div class="card box_participant h-100">
<div class="card-header">
<h2><?php afficheTexte('auto_compte') ?></h2>
</div>
<?php
if (isset($_SESSION['com_id'])) {
?>
<div class="card-body">
<div class="card-text mb-3"><?php afficheTexte('text_compte_logged'); ?></div>
<div class="card-text">
<strong><?php echo $_SESSION['com_info']['com_prenom']; ?></strong><br>
(<?php echo $_SESSION['com_info']['com_courriel']; ?>)
</div>
</div>
<?php
} else {
?>
<div class="card-body">
<div class="card-text">
<?php afficheTexte('text_compte'); ?>
</div>
<div class="card-text">
<form class="form-inline"
action="<?php echo $vDomaine; ?>/<?php if ($strLangue == 'fr') { ?>compte<?php } else { ?>account<?php } ?>"
id="frm_login_checkout" name="frm_login_checkout" method="post">
<div class="connect">
<input type="hidden" name="form_action"
value="<?php echo urlencode(base64_encode('login')); ?>">
<input type="text" name="txt_login"
placeholder="<?php afficheTexte('gauche_placeholder_login', 1, 1, 1); ?>"
class="form-control mb-2 mr-2 login_<?php echo $strLangue; ?>">
<input type="password" name="txt_password"
placeholder="<?php afficheTexte('gauche_placeholder_password', 1, 1, 1); ?>"
class="form-control mb-2 mr-2 password_<?php echo $strLangue; ?>">
<button class="btn btn-primary rounded-0 mb-2 mr-2" type="submit"
name="btn_login"><?php afficheTexte('gauche_login_btn', 1, 0); ?></button>
</div>
<a class="btn btn-primary rounded-pill"
href="<?php echo $vDomaine; ?>/<?php if ($strLangue == 'fr') { ?>compte<?php } else { ?>account<?php } ?>/nouveau"><?php afficheTexte('gauche_creer_un_nouveau_compte', 1, 1, 1); ?></a>
</form>
</div>
</div>
<?php
}
?>
</div>
<?php
}
?>
</div>
</div>
<br>
<?php
// MSIN-3855
// ajouter switch pour paypaladvance
if ($vPaypaladv) {
$mem_redirect = "/paiement_redirect.php";
} else {
$mem_redirect = "/paiement_redirect.php";
}
?>
<form action="<?php echo $vDomaine . $mem_redirect; ?>" id="frm_panier" name="frm_panier" method="post">
<input type="hidden" id="g-recaptcha-response" name="g-recaptcha-response">
<div class="row mb-3">
<div class="col-12">
<div class="card box_participant">
<div class="card-header">
<h2><?php afficheTexte('termes_titre') ?></h2>
</div>
<div class="card-body">
<?php
$arrTermes = fxGetTermes($tabEvenement['general']['eve_id'], $_SESSION['no_panier'], false, $strLangue);
//$arrTermesMem = fxGetTermes($tabEvenement['general']['eve_id'], $_SESSION['no_panier'], true, $strLangue);
echo $arrTermes['html'];// . $arrTermesMem['html'];
$strTermesModal = $arrTermes['modal'];// . $arrTermesMem['modal'];
$arrTermesModalButtons = $arrTermes['buttons'];//array_merge($arrTermes['buttons'], $arrTermesMem['buttons']);
?>
</div>
</div>
</div>
</div>
<?php
// MSIN-3855
// ajouter switch pour paypaladvance
if ($vPaypaladv) {
echo fxShowBlocPaiementpaypaladvance($tabEvenement, $tabTotal['total'], $strLangue);
} else {
echo fxShowBlocPaiement($tabEvenement, $tabTotal['total'], $strLangue);
} ?>
</form>
<div class="row text-center">
<div class="col-12 col-lg-4">
<button type="button" id="btn_prev" name="btn_prev" class="btn btn-primary rounded-0 mb-2">
<i class="fa fa-chevron-circle-left mr-2" aria-hidden="true"></i>
<?php afficheTexte('checkout_btn_prev'); ?>
</button>
</div>
<div class="col-12 col-lg-4">
<button type="button" id="btn_cancel" name="btn_cancel" class="btn btn-secondary rounded-0 mb-2">
<i class="fa fa-times mr-2"></i>
<?php afficheTexte('checkout_btn_cancel'); ?>
</button>
</div>
<div class="col-12 col-lg-4">
<?php
$strDisabled = $strCheckoutLogin = $strDisabledpaypal = '';
if (isset($tabEvenement) && $tabEvenement['general']['eve_checkout_login'] == "1" && !isset($_SESSION['com_id'])) {
$strDisabled = ' disabled';
$strDisabledpaypal = 'pointer-events: none; opacity: 0.5;';
if ($strLangue == 'fr') {
$strPageCompte = 'compte';
} else {
$strPageCompte = 'account';
}
$strCheckoutLogin = '
<div class="mb-2">
' . afficheTexte('checkout_compte_obligatoire', 0) . '
</div>
<div class="mb-2">
<a href="' . $vDomaine . '/' . $strPageCompte . '/nouveau">' . afficheTexte('gauche_creer_un_nouveau_compte', 0, 1, 1) . '</a>
</div>
';
}
if ($tabTotal['total'] > 0) {
if ($vPaypaladv) {
?>
<button type="button" id="card-field-submit-button" name="card-field-submit-button"
class="btn btn-primary rounded-0 mb-2"<?php echo $strDisabled; ?>>
<i class="fa fa-credit-card mr-2" aria-hidden="true"></i>
<?php afficheTexte('checkout_btn_checkout');
?>
</button>
<div id="paypal-button-container" style="<?php echo $strDisabledpaypal; ?>"></div>
<?php }else{
?>
<button type="button" id="btn_checkout" name="btn_checkout"
class="btn btn-primary rounded-0 mb-2"<?php echo $strDisabled; ?>>
<i class="fa fa-credit-card mr-2" aria-hidden="true"></i>
<?php afficheTexte('checkout_btn_checkout');
?>
</button>
<?php }
} else {
?>
<button type="button" id="btn_checkout" name="btn_checkout"
class="btn btn-primary rounded-0 mb-2"<?php echo $strDisabled; ?>>
<i class="fa fa-cart-arrow-down mr-2" aria-hidden="true"></i>
<?php afficheTexte('checkout_btn_checkout_gratuit');
?>
</button>
<?php
}
echo $strCheckoutLogin; ?>
</div>
</div>
</div>