Changeset 3472463
- Timestamp:
- 03/02/2026 08:27:06 AM (4 weeks ago)
- Location:
- formdev/trunk
- Files:
-
- 5 edited
-
api/Formdev.php (modified) (2 diffs)
-
formdev.php (modified) (3 diffs)
-
include/theme.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
templates/single-product.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
formdev/trunk/api/Formdev.php
r3464133 r3472463 867 867 $meta_value = $data->idProduit; 868 868 869 // Debug pour idProduit 56 870 871 /* 872 if ($meta_value == 56) { 873 echo '<pre>'; 874 print_r($data); 875 echo '</pre>'; 876 die(); 877 } 878 */ 879 869 880 /* 870 881 echo $data->nomFormation; … … 988 999 update_post_meta($product_id, 'id_famille', $data->idFamille); 989 1000 990 // Ajouter les champs libres 1001 // Ajouter les champs libres (valeur + nom pour recherche par shortcode) 991 1002 if (!empty($data->formationChampsLibres)) { 992 1003 foreach ($data->formationChampsLibres as $champLibre) { 993 1004 update_post_meta($product_id, 'champ_libre_' . $champLibre->idChampsLibres, $champLibre->valeur); 1005 if (!empty($champLibre->champsLibres->nom)) { 1006 update_post_meta($product_id, 'champ_libre_nom_' . $champLibre->idChampsLibres, $champLibre->champsLibres->nom); 1007 } 994 1008 } 995 1009 } -
formdev/trunk/formdev.php
r3464133 r3472463 5 5 * Plugin URI: https://www.form-dev.fr 6 6 * Description: Synchroniser automatiquement les formations présentes dans votre CRM Formdev 7 * Version: 1.4. 57 * Version: 1.4.6 8 8 * Author: Formdev 9 9 * Author URI: https://app.form-dev.fr … … 16 16 // Définition de la version du plugin 17 17 if (!defined('FORMEDEV_VERSION')) { 18 define('FORMEDEV_VERSION', '1.4. 5');18 define('FORMEDEV_VERSION', '1.4.6'); 19 19 } 20 20 … … 2150 2150 } 2151 2151 2152 /** 2153 * Shortcode pour afficher la valeur d'un champ libre d'une formation par son nom. 2154 * Utilisation : [formdev_champ_libre nom="Formacode"] ou [formdev_champ_libre nom="Formacode" idproduit="56"] 2155 * - nom : nom du champ libre (ex. "Formacode"). Obligatoire. 2156 * - idproduit : idProduit FormDev (ex. 56). Optionnel : si absent, utilise le produit courant (page produit). 2157 */ 2158 add_shortcode('formdev_champ_libre', 'formdev_champ_libre_shortcode'); 2159 function formdev_champ_libre_shortcode($atts) { 2160 $atts = shortcode_atts(array( 2161 'nom' => '', 2162 'idproduit' => null, 2163 ), $atts); 2164 2165 $nom = trim((string) $atts['nom']); 2166 if ($nom === '') { 2167 return ''; 2168 } 2169 2170 global $wpdb; 2171 $product_id = null; 2172 2173 if (!empty($atts['idproduit'])) { 2174 $idproduit = absint($atts['idproduit']); 2175 $product_id = $wpdb->get_var($wpdb->prepare( 2176 "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = 'idProduit' AND meta_value = %s LIMIT 1", 2177 (string) $idproduit 2178 )); 2179 } else { 2180 $product_id = get_the_ID(); 2181 if (!$product_id || get_post_type($product_id) !== 'product') { 2182 return ''; 2183 } 2184 } 2185 2186 if (!$product_id) { 2187 return ''; 2188 } 2189 2190 $metas = get_post_meta($product_id); 2191 if (!is_array($metas)) { 2192 return ''; 2193 } 2194 2195 $id_champ = null; 2196 foreach ($metas as $key => $value) { 2197 if (strpos($key, 'champ_libre_nom_') === 0) { 2198 $val = is_array($value) ? end($value) : $value; 2199 if (trim((string) $val) === $nom) { 2200 $id_champ = substr($key, strlen('champ_libre_nom_')); 2201 break; 2202 } 2203 } 2204 } 2205 2206 if ($id_champ === null) { 2207 return ''; 2208 } 2209 2210 $valeur = get_post_meta($product_id, 'champ_libre_' . $id_champ, true); 2211 if ($valeur === '' || $valeur === false) { 2212 return ''; 2213 } 2214 2215 return wp_kses_post(formdev_clean_content_for_display(formdev_fdcontent($valeur))); 2216 } 2217 2152 2218 // Shortcode pour afficher le planning 2153 2219 add_shortcode('formdev_planning', 'formdev_planning_shortcode'); -
formdev/trunk/include/theme.php
r3300547 r3472463 52 52 <strong>Paramètres :</strong><br/><br/> 53 53 <code>[formdev categorie="50"]</code> -> Affiche les formations de la catégorie ayant pour identifiant 50 <i>(cf vos idenfiants ci-dessous)</i><br/><br/> 54 55 <strong>Shortcode champs libres :</strong><br/><br/> 56 <code>[formdev_champ_libre nom="Formacode"]</code> -> Affiche la valeur du champ libre « Formacode » pour la formation de la page produit courante.<br/><br/> 57 <code>[formdev_champ_libre nom="Formacode" idproduit="56"]</code> -> Affiche la valeur du champ libre « Formacode » pour la formation dont l'idProduit FormDev est 56.<br/><br/> 58 54 59 <strong>Liste des identifiants disponibles :</strong><br/><br/> 55 60 <?php -
formdev/trunk/readme.txt
r3464133 r3472463 5 5 Tested up to: 6.9.1 6 6 Requires PHP: 7.4 7 Stable tag: 1.4. 57 Stable tag: 1.4.6 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 68 68 69 69 == Changelog == 70 = 1.4.6 = 71 * shortcodes formdev_champ_libre and activation planning in formation 72 70 73 = 1.4.5 = 71 74 * fix conflict WooCommerce Analytics and CRON -
formdev/trunk/templates/single-product.php
r3460769 r3472463 233 233 echo '</section>'; 234 234 235 //echo do_shortcode('[formdev_planning idproduit="'.$datas['idProduit'].'" view="calendar"]');235 echo do_shortcode('[formdev_planning idproduit="'.$datas['idProduit'].'" view="calendar"]'); 236 236 237 237
Note: See TracChangeset
for help on using the changeset viewer.