Files
bilety.brzezovka.pl/templates/tickets/order-confirm.php
Jacek Pyziak 9de042946a feat(01-purchase-data-layer): add post-payment purchase data layer
Phase 1 complete:

- move purchase event to order confirmation after successful payment

- add backend purchase payload builder for transaction and ticket lines

- remove premature purchase push from przelewy24 redirect view
2026-04-19 20:32:38 +02:00

197 lines
7.2 KiB
PHP

<?php
$purchaseDataLayerJson = null;
if (is_array($this->purchase_data_layer ?? null)) {
$purchaseDataLayerJson = json_encode(
$this->purchase_data_layer,
JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_INVALID_UTF8_SUBSTITUTE
);
}
?>
<?php if($purchaseDataLayerJson) : ?>
<script type="text/javascript">
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ ecommerce: null });
window.dataLayer.push(<?= $purchaseDataLayerJson; ?>);
</script>
<?php endif; ?>
<?php if($this->order_successful === true) : ?>
<script type="text/javascript">
$.alert({
icon: 'fa-regular fa-face-smile-beam',
title: 'Zamówienie jest złożone',
content: 'Dziękujemy za złożenia zamówienia.',
typeAnimated: true,
animation: 'scale',
closeAnimation: 'scale',
autoClose: 'confirm|10000',
bgOpacity: '0.5',
type: 'green',
theme: 'modern',
columnClass: 'col-md-6 col-md-offset-3',
buttons: {
confirm: {
text: 'Zamknij',
btnClass: 'btn-green btn-alert',
keys: ['enter'],
action: function() {}
}
}
});
</script>
<?php endif; ?>
<?php if($this->order_fail === true) : ?>
<script type="text/javascript">
$.alert({
icon: 'fa-solid fa-circle-exclamation',
title: 'Błąd',
content: 'Wystąpił błąd podczas przetwarzania zamówienia.',
typeAnimated: true,
animation: 'scale',
closeAnimation: 'scale',
autoClose: 'confirm|10000',
bgOpacity: '0.5',
type: 'red',
theme: 'modern',
columnClass: 'col-md-6 col-md-offset-3',
buttons: {
confirm: {
text: 'Zamknij',
btnClass: 'btn-red btn-alert',
keys: ['enter'],
action: function() {}
}
}
});
</script>
<?php endif; ?>
<?php
$orderData = $this->order;
?>
<div id="basket_page">
<div class="basket_content">
<div class="container">
<div class="box_01">
<table>
<tr>
<th>
<h3>BILETY</h3>
</th>
<th>
<h3>CENA</h3>
</th>
<th>
<h3>WARTOŚĆ</h3>
</th>
</tr>
<?php foreach ($orderData['tickets'] as $key => $value) : ?>
<tr>
<td><?= $value['name']; ?> ( x <?= $value["quantity"]; ?>)</td>
<td><?= $value['price']; ?> zł</td>
<td><?= $value['price'] * $value["quantity"]; ?> zł</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<div class="box_02">
<div class="form_data">
<div class="row">
<div class="col-lg-8 col-md-8 col-xs-12 basket_user_data">
<div class="basket_user_data__wrapper">
<h2>TWOJE DANE</h2>
<div class="form-group row mb-lg-2">
<label for="name" class="col-lg-4 col-form-label">Imię*</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="name" name="name" disabled
value="<?= $orderData['name']; ?>">
</div>
</div>
<div class="form-group row mb-lg-2">
<label for="surname" class="col-lg-4 col-form-label">Nazwisko*</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="surname" name="surname" disabled
value="<?= $orderData['surname']; ?>">
</div>
</div>
<div class="form-group row mb-lg-2">
<label for="email" class="col-lg-4 col-form-label">Email*</label>
<div class="col-lg-8">
<input type="email" class="form-control" id="email" name="email" disabled
value="<?= $orderData['email']; ?>">
</div>
</div>
<div class="form-group row mb-lg-2">
<label for="zip_code" class="col-lg-4 col-form-label">Kod pocztowy*</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="zip_code" name="zip_code" disabled
value="<?= $orderData['zip_code']; ?>">
</div>
</div>
<div class="form-group row mb-lg-2">
<label for="city" class="col-lg-4 col-form-label">Miejscowość*</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="city" name="city" disabled
value="<?= $orderData['city']; ?>">
</div>
</div>
<? if(!empty($orderData['gift_address'])) : ?>
<div class="form-group row mb-lg-2" id="gift_address_box">
<label for="gift_address" class="col-lg-4 col-form-label">Dane do wysyłki biletu prezentowego*</label>
<div class="col-lg-8">
<textarea rows="5" type="text" class="form-control" id="gift_address" name="gift_address" disabled><?= $orderData['gift_address']; ?></textarea>
</div>
</div>
<? endif; ?>
<div class="form-group row mb-lg-2">
<label for="vat" class="col-lg-4 form-check-label"><strong>Chcę otrzymać fakturę VAT</strong></label>
<div class="col-lg-8">
<input type="checkbox" class="form-check-input" id="vat" <?= $orderData['vat'] ? 'checked' : ""; ?> name="vat" disabled>
</div>
</div>
<?php if($orderData['vat']) : ?>
<div class="form-group row mb-lg-2">
<label for="company_name" class="col-lg-4 col-form-label">Nazwa firmy</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="company_name" name="company_name" disabled value="<?= $orderData['company_name']; ?>">
</div>
</div>
<div class="form-group row mb-lg-2">
<label for="nip" class="col-lg-4 col-form-label">NIP</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="nip" name="nip" disabled value="<?= $orderData['nip']; ?>">
</div>
</div>
<?php endif; ?>
</div>
</div>
<div class="col-lg-4 col-md-4 col-xs-12 basket_summary">
<div class="basket_summary__wrapper">
<h2>Suma:</h2>
<p><?= $orderData["order_price"]; ?> zł</p>
<hr>
<h2>Status:</h2>
<?php if($orderData["payment_status"]) : ?>
<p class="c_green">Zapłacono</p>
<img
src="https://bilety.brzezovka.pl/orders/<?= $orderData['hash'][0]; ?>/<?= $orderData['hash'][1]; ?>/<?= $orderData['hash']; ?>.png">
<?php else: ?>
<p class="c_red">Nie zapłacono</p>
<a href="/tickets/przelewy24/order=<?= $orderData['hash']; ?>" class="buy-btn">Powtórz transakcję</a>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>