Compare commits

..

No commits in common. "1aa64a7396cf1bcbb0f3fc8f953c5cded4724b86" and "2d66529c9a5bd05722674de160612a413b7c4f53" have entirely different histories.

11 changed files with 44 additions and 181 deletions

View file

@ -1237,31 +1237,21 @@ body.is-fullscreen {
border-top: var(--border-light);
}
}
[data-template=thanks] .thanks-page {
min-height: 60vh;
display: flex;
align-items: center;
justify-content: center;
padding: calc(var(--spacing) * 4) var(--spacing);
}
[data-template=thanks] .thanks-content {
text-align: center;
max-width: 600px;
}
[data-template=thanks] .thanks-content h1 {
font-size: var(--fs-x-big);
margin-bottom: calc(var(--spacing) * 2);
}
[data-template=thanks] .thanks-content .thanks-message {
font-size: var(--fs-big);
margin-bottom: calc(var(--spacing) * 3);
line-height: 1.6;
}
[data-template=thanks] .thanks-content .thanks-message p {
margin-bottom: var(--spacing);
}
[data-template=thanks] .thanks-content .thanks-actions {
[data-template=thanks] .p__baseline-big {
margin-top: calc(var(--spacing) * 3);
margin-bottom: calc(var(--spacing) * 3);
}
[data-template=thanks] .p__baseline {
text-align: left;
max-width: 800px;
margin: var(--spacing) auto;
}
[data-template=thanks] .p__baseline a {
color: var(--color-accent);
text-decoration: none;
}
[data-template=thanks] .p__baseline a:hover {
text-decoration: underline;
}
[data-template=thanks] #site-footer {
border-top: none;

File diff suppressed because one or more lines are too long

View file

@ -1,38 +1,29 @@
[data-template="thanks"] {
.thanks-page {
min-height: 60vh;
display: flex;
align-items: center;
justify-content: center;
padding: calc(var(--spacing) * 4) var(--spacing);
}
[data-template="thanks"]{
.p__baseline-big {
margin-top: calc(var(--spacing) * 3);
margin-bottom: calc(var(--spacing) * 3);
// font-size: var(--fs-x-big);
}
.p__baseline {
// font-size: var(--fs-big);
text-align: left;
max-width: 800px;
margin: var(--spacing) auto;
.thanks-content {
text-align: center;
max-width: 600px;
h1 {
font-size: var(--fs-x-big);
margin-bottom: calc(var(--spacing) * 2);
a{
color: var(--color-accent);
text-decoration: none;
&:hover{
text-decoration: underline;
}
}
}
.thanks-message {
font-size: var(--fs-big);
margin-bottom: calc(var(--spacing) * 3);
line-height: 1.6;
#site-footer{
border-top: none;
margin-top: calc(var(--spacing) * 4);
p {
margin-bottom: var(--spacing);
}
}
.thanks-actions {
margin-top: calc(var(--spacing) * 3);
}
}
#site-footer {
border-top: none;
margin-top: calc(var(--spacing) * 4);
}
}
}

View file

@ -4,13 +4,6 @@ window.SnipcartSettings = {
loadStrategy: 'on-user-interaction',
};
// Redirection après paiement réussi
document.addEventListener('snipcart.ready', function() {
Snipcart.execute('bind', 'order.completed', function(order) {
window.location.href = '/thanks?order=' + order.token;
});
});
(() => {
var c, d;
(d = (c = window.SnipcartSettings).version) != null || (c.version = '3.0');

View file

@ -1,9 +0,0 @@
Title: Merci pour votre commande
----
Text:
Votre commande a été confirmée ! Vous allez recevoir un email de confirmation sous peu.
Merci pour votre achat.

View file

@ -1,9 +0,0 @@
Title: Thank you for your order
----
Text:
Your order has been confirmed! You will receive a confirmation email shortly.
Thank you for your purchase.

View file

@ -33,9 +33,6 @@ tabs:
fr: Partagé entre les versions FR et EN
translate: false
width: 1/4
space:
type: gap
width: 2/4
weight:
label:
en: Weight (g)
@ -48,42 +45,6 @@ tabs:
fr: Poids en grammes pour le calcul de la livraison
translate: false
width: 1/4
length:
label:
en: Length (cm)
fr: Longueur (cm)
type: number
min: 0
default: 0
help:
en: Package length in centimeters
fr: Longueur du colis en centimètres
translate: false
width: 1/4
width:
label:
en: Width (cm)
fr: Largeur (cm)
type: number
min: 0
default: 0
help:
en: Package width in centimeters
fr: Largeur du colis en centimètres
translate: false
width: 1/4
height:
label:
en: Height (cm)
fr: Hauteur (cm)
type: number
min: 0
default: 0
help:
en: Package height in centimeters
fr: Hauteur du colis en centimètres
translate: false
width: 1/4
description:
label: Description panier
type: writer

View file

@ -1,16 +0,0 @@
title:
en: Thank you
fr: Merci
icon: check
tabs:
content:
label:
en: Content
fr: Contenu
fields:
text:
label:
en: Message
fr: Message
type: writer

View file

@ -106,15 +106,12 @@ return [
$order = $event['content'] ?? null;
if ($order && isset($order['items'])) {
// Impersonate pour avoir les permissions d'écriture
kirby()->impersonate('kirby');
foreach ($order['items'] as $item) {
$productId = $item['id'] ?? null;
$quantity = $item['quantity'] ?? 0;
if ($productId && $quantity > 0) {
// Trouver le produit par son slug
// Trouver le produit par son snipcartId
$products = site()->index()->filterBy('intendedTemplate', 'product');
foreach ($products as $product) {
@ -123,16 +120,12 @@ return [
$currentStock = (int) $product->stock()->value();
$newStock = max(0, $currentStock - $quantity);
// Mettre à jour le stock
try {
$product->update([
'stock' => $newStock
]);
} catch (Exception $e) {
// Log l'erreur mais continue le traitement
error_log('Webhook stock update error: ' . $e->getMessage());
}
// Mettre à jour le stock dans toutes les langues
$product->update([
'stock' => $newStock
]);
kirby()->impersonate('kirby');
break;
}
}

View file

@ -47,9 +47,6 @@
data-item-name="<?= $page->title()->html() ?>"
data-item-shippable="true"
data-item-weight="<?= $page->weight()->or(0) ?>"
data-item-length="<?= $page->length()->or(0) ?>"
data-item-width="<?= $page->width()->or(0) ?>"
data-item-height="<?= $page->height()->or(0) ?>"
<?php
if($page->hasOptions()->toBool() && $page->optionValues()->isNotEmpty()):
$values = $page->optionValues()->split(',');

View file

@ -1,28 +0,0 @@
<?php snippet('header', ['title' => $page->title()]) ?>
<main>
<section class="thanks-page">
<div class="thanks-content">
<h1><?= $page->title()->html() ?></h1>
<?php if($page->text()->isNotEmpty()): ?>
<div class="thanks-message">
<?= $page->text()->kt() ?>
</div>
<?php endif ?>
<div class="thanks-actions">
<a href="<?= $site->homePage()->url() ?>" class="btn__default">
<span class="icon">
<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="m9.474 5.209s-4.501 4.505-6.254 6.259c-.147.146-.22.338-.22.53s.073.384.22.53c1.752 1.754 6.252 6.257 6.252 6.257.145.145.336.217.527.217.191 0 .383-.072.53-.221.293-.293.294-.766.004-1.057l-4.976-4.976h14.692c.414 0 .75-.336.75-.75s-.336-.75-.75-.75h-14.692l4.978-4.979c.289-.289.287-.761-.006-1.054-.147-.147-.339-.221-.53-.221-.191 0-.38.071-.525.215z" fill-rule="nonzero" />
</svg>
</span>
<div class="txt"><?= t('backToShop', 'Retour à la boutique') ?></div>
</a>
</div>
</div>
</section>
</main>
<?php snippet('footer') ?>