2024-08-16
This commit is contained in:
parent
187aab9fb4
commit
fcdf367d31
307 changed files with 534 additions and 406 deletions
|
|
@ -7,42 +7,20 @@ declare(strict_types=1);
|
|||
|
||||
use Timber\Timber;
|
||||
|
||||
require_once __DIR__ . "/src/inc/TraitementInformations.php";
|
||||
|
||||
// Contexte et modèles
|
||||
$contexte = Timber::context();
|
||||
$modeles = ["boutique.twig"];
|
||||
|
||||
// Récupère les Produits
|
||||
$recupere_informations_produit = fn($produit) => [
|
||||
"id" => $produit->get_id(),
|
||||
"nom" => $produit->get_name(),
|
||||
"prix" => $produit->get_price(),
|
||||
"slug" => $produit->get_slug(),
|
||||
"premiere_photo_gauche" => wp_get_attachment_image(
|
||||
get_post_meta($post_id = $produit->get_id(), $key = "_photos_colonne_gauche|||0|value")[0],
|
||||
"full",
|
||||
false,
|
||||
["loading" => false],
|
||||
),
|
||||
"premiere_photo_droite" => wp_get_attachment_image(
|
||||
get_post_meta($post_id = $produit->get_id(), $key = "_photos_colonne_droite|||0|value")[0],
|
||||
"full",
|
||||
false,
|
||||
["loading" => false],
|
||||
),
|
||||
"url" => $produit->get_permalink(),
|
||||
];
|
||||
|
||||
// Informations brutes des Produits
|
||||
$informations_produits = wc_get_products([
|
||||
"orderby" => "date",
|
||||
"order" => "DESC",
|
||||
]);
|
||||
$produits = array_map($callback = $recupere_informations_produit, $array = $informations_produits);
|
||||
// Informations nécessaires pour la grille des Produits
|
||||
$produits = array_map($callback = "recupere_informations_produit_shop", $array = $informations_produits);
|
||||
$contexte["produits"] = $produits;
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($informations_produits);
|
||||
// print_r($produits);
|
||||
// echo "</pre>";
|
||||
|
||||
// Rendu
|
||||
Timber::render($filenames = $modeles, $data = $contexte);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue