2024-11-11
This commit is contained in:
parent
bc03c49f82
commit
b6ab6b3229
12 changed files with 359 additions and 44 deletions
1
web/app/db.php
Symbolic link
1
web/app/db.php
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/var/www/html/web/app/plugins/query-monitor/wp-content/db.php
|
||||
|
|
@ -166,6 +166,10 @@ function retire_tailles_image_par_defaut($sizes) {
|
|||
add_filter("intermediate_image_sizes", "retire_tailles_image_par_defaut", 10, 1);
|
||||
add_filter("big_image_size_threshold", "__return_false");
|
||||
|
||||
// Désactive la mise à jour automatique des traductions
|
||||
add_filter("async_update_translation", "__return_false");
|
||||
add_filter("auto_update_translation", "__return_false");
|
||||
|
||||
/**
|
||||
* WooCommerce
|
||||
*/
|
||||
|
|
|
|||
59
web/app/themes/haiku-atelier-2024/page-test.php
Normal file
59
web/app/themes/haiku-atelier-2024/page-test.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
/**
|
||||
* La route pour la préparation du paiement via Stripe ("Checkout")
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
header("Content-Type: application/json; charset=utf-8");
|
||||
|
||||
/** @var WC_Session_Handler */
|
||||
$session = WC()->session;
|
||||
/** @var bool */
|
||||
$has_session = $session->has_session();
|
||||
/** @var string */
|
||||
$url_accueil = get_page_link(get_page_by_path("home")->ID);
|
||||
|
||||
// Retourne une 403 si l'Utilisateur n'a pas de session WooCommerce
|
||||
if (!$has_session) {
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
$reponse = ["success" => "false", "status" => "unauthorized"];
|
||||
echo json_encode($reponse);
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var bool */
|
||||
$panier_vide = WC()->cart->is_empty();
|
||||
|
||||
// Redirige à la page d'accueil si le Panier est vide
|
||||
if ($panier_vide) {
|
||||
header("Location: $url_accueil");
|
||||
return;
|
||||
}
|
||||
|
||||
$stripeSecretKey =
|
||||
"sk_test_51D0BbTIKBol0AhpgZcc9rRTZoHVQ7oF1xzUTmIa37X5XbJeuYPQ35FB1hBA7WOdDuiEN6i6s5EjDNZEWPkVMlb5M00mGPcksTf";
|
||||
\Stripe\Stripe::setApiKey($stripeSecretKey);
|
||||
$stripe_checkout_session = \Stripe\Checkout\Session::create([
|
||||
"mode" => "payment",
|
||||
// "line_items" => [
|
||||
// [
|
||||
// "price_data" => [
|
||||
// "currency" => "EUR",
|
||||
// "product_data" => [
|
||||
// "name" => "Bracelet",
|
||||
// ],
|
||||
// "unit_amount" => 100,
|
||||
// ],
|
||||
// "quantity" => 2,
|
||||
// ],
|
||||
// ],
|
||||
"success_url" => $url_accueil,
|
||||
"cancel_url" => $url_accueil,
|
||||
]);
|
||||
echo json_encode($stripe_checkout_session);
|
||||
|
||||
// header("HTTP/1.1 303 See Other");
|
||||
// header("Location: " . $stripe_checkout_session->url);
|
||||
|
||||
exit();
|
||||
|
|
@ -64,7 +64,7 @@ class StarterSite extends Site {
|
|||
|
||||
return (object) [
|
||||
"nom" => $page->post_title ?? "",
|
||||
"lien" => get_page_link($page->ID),
|
||||
"lien" => get_page_link($page?->ID),
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@
|
|||
</nav>
|
||||
|
||||
{# Bouton « Panier » avec l'indicateur de quantité de Produits #}
|
||||
<section class="compte-panier" hidden>
|
||||
<section class="compte-panier">
|
||||
<a
|
||||
class="lien-bouton"
|
||||
data-contient-articles="{{ articles_presents }}"
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@
|
|||
<p class="selecteur-produit__prix">{{ produit.prix }}€</p>
|
||||
</section>
|
||||
|
||||
<section class="actions-produit" hidden>
|
||||
<section class="actions-produit">
|
||||
<button
|
||||
class="bouton-case-pleine"
|
||||
disabled
|
||||
|
|
|
|||
BIN
web/app/uploads/2024/11/HADOU-BOP-300x300.jpg
Normal file
BIN
web/app/uploads/2024/11/HADOU-BOP-300x300.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
Loading…
Add table
Add a link
Reference in a new issue