Plugin Directory

Changeset 3412254


Ignore:
Timestamp:
12/05/2025 02:11:10 PM (3 months ago)
Author:
gothamdev
Message:

ready for 6.9
OffersV2

Location:
gothamazon/trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • gothamazon/trunk/eco_asin.php

    r2682465 r3412254  
    5555    $payload.=" ],";
    5656    $payload.=" \"Resources\": [";
    57     $payload.="  \"Offers.Listings.Price\"";
     57    $payload.="  \"OffersV2.Listings.Price\"";
    5858    $payload.=" ],";
    5959    $payload.=" \"PartnerTag\": \"$amazontrackingcode\",";
     
    9696    // Detection du flux vide //
    9797    $padreponskaps = json_decode($response, true);
    98     $items = isset($padreponskaps['ItemsResult']['Items'][0]['Offers']['Listings'][0]['Price']['Amount']) ? $padreponskaps['ItemsResult']['Items'][0]['Offers']['Listings'][0]['Price']['Amount'] : NULL;
     98    $items = isset($padreponskaps['ItemsResult']['Items'][0]['OffersV2']['Listings'][0]['Price']['Money']['Amount'])
     99        ? $padreponskaps['ItemsResult']['Items'][0]['OffersV2']['Listings'][0]['Price']['Money']['Amount']
     100        : NULL;
     101
    99102   
    100103    if (!is_null($items)) { // Si le flux marche et nous renvoie donc un item
     
    123126            $payload.=" \"ItemCount\": 1,";
    124127            $payload.=" \"Resources\": [";
    125             $payload.="  \"Offers.Listings.Price\"";
     128            $payload.="  \"OffersV2.Listings.Price\"";
    126129            $payload.=" ],";
    127130            $payload.=" \"Availability\": \"Available\",";
     
    134137            $payload.=" \"Marketplace\": \"www.$marketplace_w\"";
    135138            $payload.="}";
     139
    136140            $host="webservices.$marketplace_w";
    137141            $uriPath="/paapi5/searchitems";
  • gothamazon/trunk/gotham_boutique.php

    r3234959 r3412254  
    692692           
    693693            if ($boodisplayprice == "oui") {
    694                
    695                 $payload.=",  \"Offers.Listings.Price\"";
    696                 if ($use_prixbarre == "oui") {
    697                    
    698                     $payload.=",  \"Offers.Listings.Promotions\"";
    699                     $payload.=",  \"Offers.Listings.SavingBasis\"";
    700                    
    701                 }
    702                
    703             }
    704            
    705             $payload .= ",  \"Offers.Listings.DeliveryInfo.IsPrimeEligible\""; 
    706             $payload .= ",  \"Offers.Listings.DeliveryInfo.IsFreeShippingEligible\"";
     694                           
     695                $payload.=",  \"OffersV2.Listings.Price\"";
     696           
     697            }
     698           
     699            $payload.=",  \"OffersV2.Listings.Availability\"";
     700            $payload.=",  \"OffersV2.Listings.Condition\"";
     701            $payload.=",  \"OffersV2.Listings.DealDetails\"";  // ✅ Bonus deals
     702            $payload.=",  \"OffersV2.Listings.IsBuyBoxWinner\"";
     703            $payload.=",  \"OffersV2.Listings.MerchantInfo\"";
     704            $payload.=",  \"OffersV2.Listings.Type\"";         // ✅ Type d'offre
     705            $payload.=",  \"Offers.Listings.DeliveryInfo.IsPrimeEligible\"";
     706            $payload.=",  \"Offers.Listings.DeliveryInfo.IsFreeShippingEligible\"";     
    707707           
    708708            $payload.=" ],";
     
    820820           
    821821            if ($boodisplayprice == "oui") {
    822                
    823                 $payload.=",  \"Offers.Listings.Price\"";
    824                 if ($use_prixbarre == "oui") {
    825                    
    826                     $payload.=",  \"Offers.Listings.Promotions\"";
    827                     $payload.=",  \"Offers.Listings.SavingBasis\"";
    828                    
    829                 }
    830                
    831             }
    832            
    833             $payload .= ",  \"Offers.Listings.DeliveryInfo.IsPrimeEligible\""; 
    834             $payload .= ",  \"Offers.Listings.DeliveryInfo.IsFreeShippingEligible\"";
    835            
     822                           
     823                $payload.=",  \"OffersV2.Listings.Price\"";
     824                           
     825            }
     826            $payload.=",  \"OffersV2.Listings.Availability\"";
     827            $payload.=",  \"OffersV2.Listings.Condition\"";
     828            $payload.=",  \"OffersV2.Listings.DealDetails\"";  // ✅ Bonus deals
     829            $payload.=",  \"OffersV2.Listings.IsBuyBoxWinner\"";
     830            $payload.=",  \"OffersV2.Listings.MerchantInfo\"";
     831            $payload.=",  \"OffersV2.Listings.Type\"";         // ✅ Type d'offre
     832            $payload.=",  \"Offers.Listings.DeliveryInfo.IsPrimeEligible\"";
     833            $payload.=",  \"Offers.Listings.DeliveryInfo.IsFreeShippingEligible\"";
    836834            $payload.=" ],";
    837835            $payload.=" \"Availability\": \"Available\",";
     
    12261224            //
    12271225
    1228             if ($boodisplayprice == "oui") {
    1229                
    1230                 $price = isset($item['Offers']['Listings'][0]['Price']['Amount']) ? $item['Offers']['Listings'][0]['Price']['Amount'] : NULL;
    1231                 $prixnumerik = isset($item['Offers']['Listings'][0]['Price']['Amount']) ? $item['Offers']['Listings'][0]['Price']['Amount'] : NULL;
    1232                 $economierealisee = isset($item['Offers']['Listings'][0]['Price']['Savings']['Amount']) ? $item['Offers']['Listings'][0]['Price']['Savings']['Amount'] : NULL;
    1233        
    1234                 // Module Special Price
    1235                
    1236                 if (is_null($price)) { // Si pas de prix
    1237                
    1238                     $price = "Special";
    1239                     $display_devise = ""; // on enlève le sigle €/$
    1240                    
     1226               
     1227                           
     1228            // On récupère proprement le premier listing pour les régies legacy
     1229            $listing = isset($item['Offers']['Listings'][0]) ? $item['Offers']['Listings'][0] : null;
     1230
     1231            // ===============================
     1232            //  GESTION DU PRIX + PRIX BARRÉ
     1233            // ===============================
     1234            $price             = null;
     1235            $prixnumerik       = null;
     1236            $economierealisee  = null;
     1237            $calculduprixdebaz = null;
     1238            $pourcentrealise   = null;
     1239            $leprixstrike      = '';
     1240            $mkstriker         = '';
     1241
     1242            if ($boodisplayprice == 'oui') {
     1243
     1244                // -----------------------------
     1245                //  CAS 1 : AMAZON → OFFERS V2
     1246                // -----------------------------
     1247                if ($kel_api_utiliser === 'amazon' && isset($item['OffersV2']['Listings'][0]['Price'])) {
     1248
     1249                    $priceNode = $item['OffersV2']['Listings'][0]['Price'];
     1250
     1251                    // Prix actuel
     1252                    if (isset($priceNode['Money']['Amount'])) {
     1253                        $prixnumerik = (float) $priceNode['Money']['Amount'];
     1254                    } elseif (isset($priceNode['Amount'])) {
     1255                        $prixnumerik = (float) $priceNode['Amount'];
     1256                    }
     1257
     1258                    // Économie (Savings)
     1259                    if (isset($priceNode['Savings'])) {
     1260                        $savingsNode = $priceNode['Savings'];
     1261
     1262                        if (isset($savingsNode['Money']['Amount'])) {
     1263                            $economierealisee = (float) $savingsNode['Money']['Amount'];
     1264                        } elseif (isset($savingsNode['Amount'])) {
     1265                            $economierealisee = (float) $savingsNode['Amount'];
     1266                        }
     1267
     1268                        if (isset($savingsNode['Percentage'])) {
     1269                            $pourcentrealise = (float) $savingsNode['Percentage'];
     1270                        }
     1271                    }
     1272
     1273                    // Prix de base (SavingBasis) → prix barré
     1274                    if (isset($priceNode['SavingBasis'])) {
     1275                        $savingBasis = $priceNode['SavingBasis'];
     1276
     1277                        if (isset($savingBasis['Money']['Amount'])) {
     1278                            $prix_de_base2k22 = (float) $savingBasis['Money']['Amount'];
     1279                        } elseif (isset($savingBasis['Amount'])) {
     1280                            $prix_de_base2k22 = (float) $savingBasis['Amount'];
     1281                        }
     1282
     1283                        if (!empty($prix_de_base2k22)) {
     1284                            $calculduprixdebaz = $prix_de_base2k22;
     1285                        } elseif (!empty($prixnumerik) && !empty($economierealisee)) {
     1286                            $calculduprixdebaz = $prixnumerik + $economierealisee;
     1287                        }
     1288                    }
     1289
     1290                // ----------------------------------------
     1291                //  CAS 2 : AUTRES RÉGIES → ANCIEN SCHÉMA
     1292                // ----------------------------------------
    12411293                } else {
    12421294
    1243                     $price = str_replace(',', "",$price);
    1244                     //$price = number_format($price, 2, ',', ' ');
    1245                     $price = number_format((float)$price, 2, ',', ' ');
     1295                    if ($listing && isset($listing['Price'])) {
     1296                        $legacyPriceNode = $listing['Price'];
     1297
     1298                        // Prix actuel
     1299                        if (isset($legacyPriceNode['Money']['Amount'])) {
     1300                            $prixnumerik = (float) $legacyPriceNode['Money']['Amount'];
     1301                        } elseif (isset($legacyPriceNode['Amount'])) {
     1302                            $prixnumerik = (float) $legacyPriceNode['Amount'];
     1303                        } elseif (isset($legacyPriceNode['DisplayAmount'])) {
     1304                            // On tente de parser un "159,99 €" → 159.99
     1305                            $raw = preg_replace('/[^\d\.,]/', '', $legacyPriceNode['DisplayAmount']);
     1306                            // On enlève les séparateurs de milliers et on garde le séparateur décimal
     1307                            // Exemple : "1 299,99" ou "1.299,99" → "1299,99"
     1308                            $raw = str_replace(' ', '', $raw);
     1309                            $raw = preg_replace('/\.(?=\d{3}(?:\D|$))/', '', $raw);
     1310                            $raw = str_replace(',', '.', $raw);
     1311                            $prixnumerik = (float) $raw;
     1312                        }
     1313
     1314                        // Savings éventuels (structure type PAAPI v5 / GTZ)
     1315                        if (isset($legacyPriceNode['Savings'])) {
     1316                            $legacySavings = $legacyPriceNode['Savings'];
     1317
     1318                            if (isset($legacySavings['Money']['Amount'])) {
     1319                                $economierealisee = (float) $legacySavings['Money']['Amount'];
     1320                            } elseif (isset($legacySavings['Amount'])) {
     1321                                $economierealisee = (float) $legacySavings['Amount'];
     1322                            }
     1323
     1324                            if (isset($legacySavings['Percentage'])) {
     1325                                $pourcentrealise = (float) $legacySavings['Percentage'];
     1326                            }
     1327                        }
     1328
     1329                        // Prix de base (SavingBasis) pour le prix barré
     1330                        if (isset($legacyPriceNode['SavingBasis'])) {
     1331                            $legacySavingBasis = $legacyPriceNode['SavingBasis'];
     1332
     1333                            if (isset($legacySavingBasis['Money']['Amount'])) {
     1334                                $prix_de_base2k22 = (float) $legacySavingBasis['Money']['Amount'];
     1335                            } elseif (isset($legacySavingBasis['Amount'])) {
     1336                                $prix_de_base2k22 = (float) $legacySavingBasis['Amount'];
     1337                            }
     1338
     1339                            if (!empty($prix_de_base2k22)) {
     1340                                $calculduprixdebaz = $prix_de_base2k22;
     1341                            } elseif (!empty($prixnumerik) && !empty($economierealisee)) {
     1342                                $calculduprixdebaz = $prixnumerik + $economierealisee;
     1343                            }
     1344                        }
     1345                    }
     1346                }
     1347
     1348                // ----------------------
     1349                //  FORMATAGE DU PRIX
     1350                // ----------------------
     1351                if (!empty($prixnumerik)) {
     1352                    $price          = number_format((float) $prixnumerik, 2, ',', ' ');
    12461353                    $display_devise = $store_my_devise;
    1247                    
    1248                 }
    1249 
    1250                 if ($use_prixbarre == "oui") {
    1251 
    1252                     if ((!is_null($economierealisee)) AND ($economierealisee != 0) AND ($economierealisee != "")) {
    1253    
    1254                         $pourcentrealise = isset($item['Offers']['Listings'][0]['Price']['Savings']['Percentage']) ? $item['Offers']['Listings'][0]['Price']['Savings']['Percentage'] : NULL;
    1255                         $prix_de_base2k22 = isset($item['Offers']['Listings'][0]['SavingBasis']['Amount']) ? $item['Offers']['Listings'][0]['SavingBasis']['Amount'] : NULL;
    1256                        
    1257                         if ((!is_null($prix_de_base2k22)) AND ($prix_de_base2k22 != 0)) {
    1258                        
    1259                             $calculduprixdebaz = $prix_de_base2k22;
    1260                             $calculduprixdebaz = str_replace(',', "",$calculduprixdebaz);
    1261                             $calculduprixdebaz = number_format($calculduprixdebaz, 2, ',', ' ');
    1262                        
    1263                         } else {
    1264                        
    1265                             $calculduprixdebaz = $prixnumerik + $economierealisee;
    1266                             $calculduprixdebaz = number_format($calculduprixdebaz, 2, ',', ' ');
    1267                        
    1268                         }
    1269                    
    1270                         $leprixstrike = "<strike>$calculduprixdebaz $display_devise</strike>";
    1271                        
    1272                         if ($sidebardesign == 'full') {
    1273                            
    1274                             $mkstriker="style='line-height:16px;'";
    1275                            
    1276                         } else {
    1277                            
    1278                             $mkstriker="style='width:100%;padding:0;'";
    1279                            
    1280                         }
    1281                     }
    1282                 }
    1283             }
    1284            
     1354                } else {
     1355                    // Aucun prix récupéré → "Special"
     1356                    $price          = "";
     1357                    $display_devise = "";
     1358                }
     1359
     1360                // ----------------------
     1361                //  PRIX BARRÉ (OPTION)
     1362                // ----------------------
     1363                if (
     1364                    $use_prixbarre == "oui"
     1365                    && !empty($calculduprixdebaz)
     1366                    && !empty($economierealisee)
     1367                ) {
     1368                    $calculduprixdebaz = str_replace(',', '', $calculduprixdebaz);
     1369                    $calculduprixdebaz = number_format((float) $calculduprixdebaz, 2, ',', ' ');
     1370                    $mkstriker         = "data-has-strike='1'";
     1371                    $leprixstrike      = "<span class='priceold'><strike>$calculduprixdebaz $display_devise</strike></span>";
     1372
     1373                    // Si pas de % fourni, on le calcule
     1374                    if ((empty($pourcentrealise) || $pourcentrealise == 0) && !empty($prixnumerik) && !empty($economierealisee) && ($prixnumerik + $economierealisee) > 0) {
     1375                        $pourcentrealise = round(($economierealisee / ($prixnumerik + $economierealisee)) * 100);
     1376                    }
     1377                }
     1378            }
     1379
     1380
     1381
    12851382            if ($cloaking == 'oui') {
    12861383               
     
    13221419           
    13231420            /* Module Highlight */
    1324             $ssj_highlight = isset($item['Offers']['Listings'][0]['Price']['Savings']['Amount']) ? $item['Offers']['Listings'][0]['Price']['Savings']['Amount'] : NULL;
     1421            $ssj_highlight = isset($item['OffersV2']['Listings'][0]['Price']['Savings']['Money']['Amount'])
     1422                ? $item['OffersV2']['Listings'][0]['Price']['Savings']['Money']['Amount']
     1423                : NULL;
     1424
    13251425            if ((!is_null($ssj_highlight)) AND ($ssj_highlight != 0) AND ($ssj_highlight != "")) {
    1326            
     1426                       
    13271427                $output.="<li class='kmh'>";
    1328            
     1428                       
    13291429            } else {
    1330                
     1430                           
    13311431                $output.="<li>";
    1332            
     1432                       
    13331433            }
    13341434            /* ! Module Highlight */
     
    13451445           
    13461446            $gestiondeprime = "";
    1347             $eligibleprime = isset($item['Offers']['Listings'][0]['DeliveryInfo']['IsPrimeEligible']) && $item['Offers']['Listings'][0]['DeliveryInfo']['IsPrimeEligible'] ? true : NULL;
    1348             $eligiblefreeship = isset($item['Offers']['Listings'][0]['DeliveryInfo']['IsFreeShippingEligible']) && $item['Offers']['Listings'][0]['DeliveryInfo']['IsFreeShippingEligible'] ? true : NULL;
     1447            $eligibleprime = ($listing && !empty($listing['DeliveryInfo']['IsPrimeEligible'])) ? true : null;
     1448            $eligiblefreeship = ($listing && !empty($listing['DeliveryInfo']['IsFreeShippingEligible'])) ? true : null;
     1449
    13491450           
    13501451            if ($eligibleprime && $gothamazon_option_amaprime == "oui" && $gtz_tokyo4 != "oui" && $kel_api_utiliser == "amazon") {
     
    14471548            }
    14481549           
    1449             $output.="<span class='storeitemcta $cuzhprice_css'><span class='eyecandyoptim'><span>Voir</span>";
     1550            $output.="<span class='storeitemcta $cuzhprice_css'><span class='eyecandyoptim'><span>Ouvrir</span>";
    14501551            $output.="</span></span></span></$kelbalise></li>";
    14511552            $compteur++;
  • gothamazon/trunk/gotham_inline_asin.php

    r3234959 r3412254  
    332332                        $payload.=" ],";
    333333                        $payload.=" \"Resources\": [";
    334                         $payload.="  \"Offers.Listings.Price\"";
     334                        // MIGRATION OFFERSV2
     335                        $payload.="  \"OffersV2.Listings.Price\"";
    335336                        $payload.=" ],";
    336337                        $payload.=" \"PartnerTag\": \"$amazontrackingcode\",";
     
    373374                        // Detection du flux vide //
    374375                        $padreponskaps = json_decode($response, true);
    375                         $items = isset($padreponskaps['ItemsResult']['Items'][0]['Offers']['Listings'][0]['Price']['DisplayAmount']) ? $padreponskaps['ItemsResult']['Items'][0]['Offers']['Listings'][0]['Price']['DisplayAmount'] : NULL;
     376
     377                        $priceNode = isset($padreponskaps['ItemsResult']['Items'][0]['OffersV2']['Listings'][0]['Price'])
     378                            ? $padreponskaps['ItemsResult']['Items'][0]['OffersV2']['Listings'][0]['Price']
     379                            : NULL;
     380
     381                        $items = NULL;
     382                        if (!is_null($priceNode)) {
     383                            if (isset($priceNode['Money']['DisplayAmount'])) {
     384                                $items = $priceNode['Money']['DisplayAmount'];
     385                            } elseif (isset($priceNode['DisplayAmount'])) {
     386                                $items = $priceNode['DisplayAmount'];
     387                            } elseif (isset($priceNode['Money']['Amount'])) {
     388                                $items = number_format((float)$priceNode['Money']['Amount'], 2, ',', ' ');
     389                            } elseif (isset($priceNode['Amount'])) {
     390                                $items = number_format((float)$priceNode['Amount'], 2, ',', ' ');
     391                            }
     392                        }
    376393
    377394                        if (!is_null($items)) { // Si le flux marche et nous renvoie donc un item
     
    452469                                $payload.=" \"ItemCount\": 1,";
    453470                                $payload.=" \"Resources\": [";
    454                                 $payload.="  \"Offers.Listings.Price\"";
     471                                // MIGRATION OFFERSV2
     472                                $payload.="  \"OffersV2.Listings.Price\"";
    455473                                $payload.=" ],";
    456474                                $payload.=" \"Availability\": \"Available\",";
     
    614632               
    615633                    // Si le fichier existe et (qu'il a dépassé la durée de vie du cache OU qu'il est vide)
    616                     unlink ($dynamixcache); // On l'efface
     634                    unlink($dynamixcache); // On l'efface
    617635                   
    618636            }
     
    635653                $payload.=" ],";
    636654                $payload.=" \"Resources\": [";
    637                 $payload.="  \"Offers.Listings.Price\"";
     655                // MIGRATION OFFERSV2
     656                $payload.="  \"OffersV2.Listings.Price\"";
    638657                $payload.=" ],";
    639658                $payload.=" \"PartnerTag\": \"$amazontrackingcode\",";
     
    674693            $output="";
    675694           
    676             // Detection du flux vide //
     695            // Detection du flux vide + extraction du prix DisplayAmount (OFFERS V2)
    677696            $padreponskaps = json_decode($response, true);
    678             $items = isset($padreponskaps['ItemsResult']['Items'][0]['Offers']['Listings'][0]['Price']['DisplayAmount']) ? $padreponskaps['ItemsResult']['Items'][0]['Offers']['Listings'][0]['Price']['DisplayAmount'] : NULL;
     697
     698            $priceNode = isset($padreponskaps['ItemsResult']['Items'][0]['OffersV2']['Listings'][0]['Price'])
     699                ? $padreponskaps['ItemsResult']['Items'][0]['OffersV2']['Listings'][0]['Price']
     700                : NULL;
     701
     702            $items = NULL;
     703            if (!is_null($priceNode)) {
     704                if (isset($priceNode['Money']['DisplayAmount'])) {
     705                    $items = $priceNode['Money']['DisplayAmount'];
     706                } elseif (isset($priceNode['DisplayAmount'])) {
     707                    $items = $priceNode['DisplayAmount'];
     708                } elseif (isset($priceNode['Money']['Amount'])) {
     709                    $items = number_format((float)$priceNode['Money']['Amount'], 2, ',', ' ');
     710                } elseif (isset($priceNode['Amount'])) {
     711                    $items = number_format((float)$priceNode['Amount'], 2, ',', ' ');
     712                }
     713            }
    679714           
    680715            if (!is_null($items)) { // Si le flux marche et nous renvoie donc un item
     
    760795        }
    761796       
    762         if ($sidebardesign == 'sidebar') {
    763    
    764             $bug_log_current_url = "ZZsidebar";
    765 
    766         } elseif (is_archive()) {
     797        // Version simplifiée pour inline (on ne joue pas avec $sidebardesign ici)
     798        if (is_archive()) {
    767799           
    768800            $term = get_queried_object();
  • gothamazon/trunk/gotham_inline_text.php

    r3234959 r3412254  
    409409                $payload.=" \"ItemCount\": 1,";
    410410                $payload.=" \"Resources\": [";
    411                 $payload.="  \"Offers.Listings.Price\"";
     411                $payload.="  \"OffersV2.Listings.Price\"";
    412412                $payload.=" ],";
    413413                $payload.=" \"Availability\": \"Available\",";
     
    632632                }
    633633               
    634                 $price = isset($item['Offers']['Listings'][0]['Price']['Amount']) ? $item['Offers']['Listings'][0]['Price']['Amount']: NULL;
    635                
    636                 if (($inlineprice == "oui") AND (!is_null($price))) {
    637                                
    638                     $price = str_replace(',', "",$price);
    639                     //$price = number_format($price, 2, ',', ' ');
    640                     $price = number_format((float)$price, 2, ',', ' ');         
    641                    
    642                     $price = $price." $ladevise";
    643                    
    644                 }
     634                // === RÉCUPÉRATION DU PRIX (AMAZON OFFERS V2 / AUTRES RÉGIES LEGACY) ===
     635                $price = NULL;
     636
     637                if ($kel_api_utiliser === 'amazon') {
     638                    // ----- CAS AMAZON : OFFERS V2 -----
     639                    $priceNode = isset($item['OffersV2']['Listings'][0]['Price'])
     640                        ? $item['OffersV2']['Listings'][0]['Price']
     641                        : NULL;
     642
     643                    if (!is_null($priceNode)) {
     644                        if (isset($priceNode['Money']['Amount'])) {
     645                            // Format OFFERS V2 classique
     646                            $price = $priceNode['Money']['Amount'];
     647                        } elseif (isset($priceNode['Amount'])) {
     648                            // Cas dégradé éventuel
     649                            $price = $priceNode['Amount'];
     650                        } elseif (isset($priceNode['Money']['DisplayAmount'])) {
     651                            // Fallback : on essaie d'extraire le nombre depuis "20,01 €"
     652                            $raw = preg_replace('/[^\d,\.]/', '', $priceNode['Money']['DisplayAmount']);
     653                            $raw = str_replace(',', '.', $raw);
     654                            $price = is_numeric($raw) ? (float)$raw : NULL;
     655                        } elseif (isset($priceNode['DisplayAmount'])) {
     656                            $raw = preg_replace('/[^\d,\.]/', '', $priceNode['DisplayAmount']);
     657                            $raw = str_replace(',', '.', $raw);
     658                            $price = is_numeric($raw) ? (float)$raw : NULL;
     659                        }
     660                    }
     661
     662                    // Fallback extrême : si jamais OffersV2 est KO, on tente l'ancien schéma Offers.Listings
     663                    if (is_null($price) && isset($item['Offers']['Listings'][0]['Price']['Amount'])) {
     664                        $price = $item['Offers']['Listings'][0]['Price']['Amount'];
     665                    }
     666
     667                } else {
     668                    // ----- CAS AUTRES RÉGIES : ANCIEN SCHÉMA OFFERS -----
     669                    $legacyPriceNode = isset($item['Offers']['Listings'][0]['Price'])
     670                        ? $item['Offers']['Listings'][0]['Price']
     671                        : NULL;
     672
     673                    if (!is_null($legacyPriceNode)) {
     674                        if (isset($legacyPriceNode['Money']['Amount'])) {
     675                            $price = $legacyPriceNode['Money']['Amount'];
     676                        } elseif (isset($legacyPriceNode['Amount'])) {
     677                            $price = $legacyPriceNode['Amount'];
     678                        } elseif (isset($legacyPriceNode['DisplayAmount'])) {
     679                            // Exemple "159,99 €"
     680                            $raw = preg_replace('/[^\d,\.]/', '', $legacyPriceNode['DisplayAmount']);
     681                            $raw = str_replace(',', '.', $raw);
     682                            $price = is_numeric($raw) ? (float)$raw : NULL;
     683                        }
     684                    }
     685                }
     686
     687                // Formatage final pour l'affichage inline
     688                if ($inlineprice == "oui" && !is_null($price)) {
     689                    $price = str_replace(',', '', (string)$price);
     690                    $price = number_format((float)$price, 2, ',', ' ');
     691                    $price = $price . " " . $ladevise;
     692                }
     693
    645694               
    646695                if ($cloaking == 'oui') {
  • gothamazon/trunk/gotham_spotlight_asin.php

    r3234084 r3412254  
    251251            $payload.=",  \"ItemInfo.Title\"";
    252252        }
    253        
    254         // if ($boodisplayprice == 'oui') { Provoque un Bug Inexpliqué
    255             $payload.=",  \"Offers.Listings.Price\"";
    256             $payload.=",  \"Offers.Listings.Promotions\"";
    257             $payload.=",  \"Offers.Listings.SavingBasis\"";
    258 
    259         //}
    260        
    261         $payload .= ",  \"Offers.Listings.DeliveryInfo.IsPrimeEligible\""; 
    262         $payload .= ",  \"Offers.Listings.DeliveryInfo.IsFreeShippingEligible\"";
     253
     254        $payload.=",  \"OffersV2.Listings.Price\"";
     255        $payload .= ",  \"OffersV2.Listings.Availability\"";
     256        $payload .= ",  \"OffersV2.Listings.Condition\"";
     257        $payload.=",  \"OffersV2.Listings.DealDetails\"";  // ✅ Bonus deals
     258        $payload .= ",  \"OffersV2.Listings.MerchantInfo\"";
     259        $payload .= ",  \"OffersV2.Listings.IsBuyBoxWinner\"";
     260        $payload.=",  \"OffersV2.Listings.Type\"";         // ✅ Type d'offre
     261        $payload.=",  \"Offers.Listings.DeliveryInfo.IsPrimeEligible\"";
     262        $payload.=",  \"Offers.Listings.DeliveryInfo.IsFreeShippingEligible\"";
    263263           
    264264        $payload.=" ],";
     
    301301        // Detection du flux vide //
    302302        $padreponskaps = json_decode($response, true);
    303         $items = isset($padreponskaps['ItemsResult']['Items'][0]['Offers']['Listings'][0]['Price']['Amount']) ? $padreponskaps['ItemsResult']['Items'][0]['Offers']['Listings'][0]['Price']['Amount'] : NULL ; // On cherche l'existence d'un prix ce qui signifie qu'un article est en vente et pas indisponible
     303        // On cherche l'existence d'un prix sur OffersV2
     304        $items = NULL;
     305        if (isset($padreponskaps['ItemsResult']['Items'][0]['OffersV2']['Listings'][0]['Price']['Money']['Amount'])) {
     306            $items = $padreponskaps['ItemsResult']['Items'][0]['OffersV2']['Listings'][0]['Price']['Money']['Amount'];
     307        } elseif (isset($padreponskaps['ItemsResult']['Items'][0]['OffersV2']['Listings'][0]['Price']['Amount'])) {
     308            // fallback au cas où Money ne serait pas présent
     309            $items = $padreponskaps['ItemsResult']['Items'][0]['OffersV2']['Listings'][0]['Price']['Amount'];
     310        }
     311
    304312       
    305313       
     
    474482           
    475483       
    476             // Gestion du Prix
     484
     485            // Gestion du Prix (OFFERS V2)
    477486            if ($boodisplayprice == 'oui') {
    478487               
    479                 $price = $item['Offers']['Listings'][0]['Price']['Amount'] ? $item['Offers']['Listings'][0]['Price']['Amount'] : NULL;
    480                 $prixnumerik = isset($item['Offers']['Listings'][0]['Price']['Amount']) ? $item['Offers']['Listings'][0]['Price']['Amount'] : NULL;
    481                 $economierealisee = isset($item['Offers']['Listings'][0]['Price']['Savings']['Amount']) ? $item['Offers']['Listings'][0]['Price']['Savings']['Amount'] : NULL;
     488                $priceNode = isset($item['OffersV2']['Listings'][0]['Price'])
     489                    ? $item['OffersV2']['Listings'][0]['Price']
     490                    : NULL;
     491
     492                $price = NULL;
     493                $prixnumerik = NULL;
     494                $economierealisee = NULL;
     495                $calculduprixdebaz = NULL;
     496                $pourcentrealise = NULL;
     497
     498                if (!is_null($priceNode)) {
     499
     500                    // Prix actuel
     501                    if (isset($priceNode['Money']['Amount'])) {
     502                        $prixnumerik = (float)$priceNode['Money']['Amount'];
     503                    } elseif (isset($priceNode['Amount'])) {
     504                        $prixnumerik = (float)$priceNode['Amount'];
     505                    }
     506
     507                    // Remise (Savings)
     508                    if (isset($priceNode['Savings'])) {
     509                        $savingsNode = $priceNode['Savings'];
     510
     511                        if (isset($savingsNode['Money']['Amount'])) {
     512                            $economierealisee = (float)$savingsNode['Money']['Amount'];
     513                        } elseif (isset($savingsNode['Amount'])) {
     514                            $economierealisee = (float)$savingsNode['Amount'];
     515                        }
     516
     517                        if (isset($savingsNode['Percentage'])) {
     518                            $pourcentrealise = (float)$savingsNode['Percentage'];
     519                        }
     520                    }
     521
     522                    $price = $prixnumerik;
     523                }
    482524               
    483525                // Module Special Price
    484                
    485526                if (is_null($price)) { // Si pas de prix
    486                
    487527                    $price = "Special";
    488528                    $display_devise = ""; // on enlève le sigle €/$
    489                    
    490529                } else {
    491                    
    492                     $price = str_replace(',', "",$price);
    493                     //$price = number_format($price, 2, ',', ' ');
     530                    $price = str_replace(',', "", $price);
    494531                    $price = number_format((float)$price, 2, ',', ' ');     
    495532                    $display_devise = $store_my_devise;
    496                    
    497533                }
    498534               
    499535                if ($use_prixbarre == "oui") {
    500                                        
     536                   
    501537                    if ((!is_null($economierealisee)) AND ($economierealisee != 0) AND ($economierealisee != "")) {
    502                        
    503                         $prix_de_base2k22 = isset($item['Offers']['Listings'][0]['SavingBasis']['Amount']) ? $item['Offers']['Listings'][0]['SavingBasis']['Amount'] : NULL;
    504                         $pourcentrealise = isset($item['Offers']['Listings'][0]['Price']['Savings']['Percentage']) ? $item['Offers']['Listings'][0]['Price']['Savings']['Percentage'] : NULL;
    505                        
     538
     539                        // Prix de base via SavingBasis si dispo
     540                        $prix_de_base2k22 = NULL;
     541                        if (isset($priceNode['SavingBasis'])) {
     542                            $savingBasis = $priceNode['SavingBasis'];
     543
     544                            if (isset($savingBasis['Money']['Amount'])) {
     545                                $prix_de_base2k22 = (float)$savingBasis['Money']['Amount'];
     546                            } elseif (isset($savingBasis['Amount'])) {
     547                                $prix_de_base2k22 = (float)$savingBasis['Amount'];
     548                            }
     549                        }
     550
    506551                        if ((!is_null($prix_de_base2k22)) AND ($prix_de_base2k22 != 0)) {
    507552                       
    508553                            $calculduprixdebaz = $prix_de_base2k22;
    509                             $calculduprixdebaz = str_replace(',', "",$calculduprixdebaz);
    510                             $calculduprixdebaz = number_format($calculduprixdebaz, 2, ',', ' ');
    511                        
    512                         } else {
     554                       
     555                        } elseif (!is_null($prixnumerik)) {
    513556                       
    514557                            $calculduprixdebaz = $prixnumerik + $economierealisee;
    515                             $calculduprixdebaz = number_format($calculduprixdebaz, 2, ',', ' ');
    516558                       
    517559                        }
     560
     561                        if (!is_null($calculduprixdebaz)) {
     562                            $calculduprixdebaz = str_replace(',', "", $calculduprixdebaz);
     563                            $calculduprixdebaz = number_format((float)$calculduprixdebaz, 2, ',', ' ');
     564                        }
     565
     566                        // Si pas de % fourni par l'API, on le calcule
     567                        if ((is_null($pourcentrealise) || $pourcentrealise == 0)
     568                            && !is_null($prixnumerik)
     569                            && !is_null($economierealisee)
     570                            && ($prixnumerik + $economierealisee) > 0) {
     571
     572                            $pourcentrealise = round( ($economierealisee / ($prixnumerik + $economierealisee)) * 100 );
     573                        }
    518574                   
    519575                    }
     
    522578               
    523579            }
     580
    524581
    525582           
    526583            // Amazon Prime
    527584            $logoduprime = "";
    528            
     585            $listing = isset($item['Offers']['Listings'][0]) ? $item['Offers']['Listings'][0] : null;
    529586            if (($gothamazon_option_amaprime == "oui") AND ($gtz_tokyo4 != "oui")) {
    530587                   
    531588                $urldulogoprime = "$plugins_url/gothamazon/img/prime.png";
    532589               
    533                 $eligibleprime = isset($item['Offers']['Listings'][0]['DeliveryInfo']['IsPrimeEligible']) && $item['Offers']['Listings'][0]['DeliveryInfo']['IsPrimeEligible'] ? true : NULL;
    534                 $eligiblefreeship = isset($item['Offers']['Listings'][0]['DeliveryInfo']['IsFreeShippingEligible']) && $item['Offers']['Listings'][0]['DeliveryInfo']['IsFreeShippingEligible'] ? true : NULL;
     590                $gestiondeprime = "";
     591                $eligibleprime = ($listing && !empty($listing['DeliveryInfo']['IsPrimeEligible'])) ? true : null;
     592                $eligiblefreeship = ($listing && !empty($listing['DeliveryInfo']['IsFreeShippingEligible'])) ? true : null;
     593
    535594               
    536595                if ($eligibleprime) {
  • gothamazon/trunk/gotham_spotlight_keyword.php

    r3234959 r3412254  
    484484           
    485485            if ($boodisplayprice == 'oui') {
    486                 $payload.=",  \"Offers.Listings.Price\"";
    487                 if ($use_prixbarre == "oui") {
    488                     $payload.=",  \"Offers.Listings.Promotions\"";
    489                     $payload.=",  \"Offers.Listings.SavingBasis\"";
    490                 }
    491             }
    492            
    493             $payload .= ",  \"Offers.Listings.DeliveryInfo.IsPrimeEligible\""; 
    494             $payload .= ",  \"Offers.Listings.DeliveryInfo.IsFreeShippingEligible\"";
     486                $payload.=",  \"OffersV2.Listings.Price\"";
     487            }
     488
     489        $payload .= ",  \"OffersV2.Listings.Availability\"";
     490        $payload .= ",  \"OffersV2.Listings.Condition\"";
     491        $payload.=",  \"OffersV2.Listings.DealDetails\"";  // ✅ Bonus deals
     492        $payload .= ",  \"OffersV2.Listings.MerchantInfo\"";
     493        $payload .= ",  \"OffersV2.Listings.IsBuyBoxWinner\"";
     494        $payload.=",  \"OffersV2.Listings.Type\"";         // ✅ Type d'offre
     495        $payload.=",  \"Offers.Listings.DeliveryInfo.IsPrimeEligible\"";
     496            $payload.=",  \"Offers.Listings.DeliveryInfo.IsFreeShippingEligible\"";
    495497       
    496498            $payload.=" ],";
     
    790792           
    791793            // Gestion du Prix
     794       
    792795            if ($boodisplayprice == 'oui') {
    793                
    794                 $price = isset($item['Offers']['Listings'][0]['Price']['Amount']) ? $item['Offers']['Listings'][0]['Price']['Amount'] : NULL;
    795                 $prixnumerik = isset($item['Offers']['Listings'][0]['Price']['Amount']) ? $item['Offers']['Listings'][0]['Price']['Amount'] : NULL;
    796                 $economierealisee = isset($item['Offers']['Listings'][0]['Price']['Savings']['Amount']) ? $item['Offers']['Listings'][0]['Price']['Savings']['Amount'] : NULL;
    797                
    798                 // Module Special Price
    799                
    800                 if (is_null($price)) { // Si pas de prix
    801                
    802                     $price = "Special";
    803                     $display_devise = ""; // on enlève le sigle €/$
    804                    
     796
     797                // ----- CAS AMAZON : OFFERS V2 -----
     798                if ($kel_api_utiliser == "amazon") {
     799
     800                    $priceNode = isset($item['OffersV2']['Listings'][0]['Price'])
     801                        ? $item['OffersV2']['Listings'][0]['Price']
     802                        : NULL;
     803
     804                    $price = NULL;
     805                    $prixnumerik = NULL;
     806                    $economierealisee = NULL;
     807                    $calculduprixdebaz = NULL;
     808                    $pourcentrealise = NULL;
     809
     810                    if (!is_null($priceNode)) {
     811
     812                        // Prix actuel
     813                        if (isset($priceNode['Money']['Amount'])) {
     814                            $prixnumerik = (float)$priceNode['Money']['Amount'];
     815                        } elseif (isset($priceNode['Amount'])) {
     816                            $prixnumerik = (float)$priceNode['Amount'];
     817                        }
     818
     819                        // Remise (Savings)
     820                        if (isset($priceNode['Savings'])) {
     821                            $savingsNode = $priceNode['Savings'];
     822
     823                            if (isset($savingsNode['Money']['Amount'])) {
     824                                $economierealisee = (float)$savingsNode['Money']['Amount'];
     825                            } elseif (isset($savingsNode['Amount'])) {
     826                                $economierealisee = (float)$savingsNode['Amount'];
     827                            }
     828
     829                            if (isset($savingsNode['Percentage'])) {
     830                                $pourcentrealise = (float)$savingsNode['Percentage'];
     831                            }
     832                        }
     833
     834                        $price = $prixnumerik;
     835                    }
     836
     837                    // Module Special Price
     838                    if (is_null($price)) { // Si pas de prix
     839                        $price = "Special";
     840                        $display_devise = ""; // on enlève le sigle €/$
     841                    } else {
     842                        $price = str_replace(',', "", $price);
     843                        $price = number_format((float)$price, 2, ',', ' ');
     844                        $display_devise = $store_my_devise;
     845                    }
     846
     847                    if ($use_prixbarre == "oui") {
     848
     849                        if ((!is_null($economierealisee)) AND ($economierealisee != 0) AND ($economierealisee != "")) {
     850
     851                            // Prix de base via SavingBasis si dispo
     852                            $prix_de_base2k22 = NULL;
     853                            if (isset($priceNode['SavingBasis'])) {
     854                                $savingBasis = $priceNode['SavingBasis'];
     855
     856                                if (isset($savingBasis['Money']['Amount'])) {
     857                                    $prix_de_base2k22 = (float)$savingBasis['Money']['Amount'];
     858                                } elseif (isset($savingBasis['Amount'])) {
     859                                    $prix_de_base2k22 = (float)$savingBasis['Amount'];
     860                                }
     861                            }
     862
     863                            if ((!is_null($prix_de_base2k22)) AND ($prix_de_base2k22 != 0)) {
     864
     865                                $calculduprixdebaz = $prix_de_base2k22;
     866
     867                            } elseif (!is_null($prixnumerik)) {
     868
     869                                $calculduprixdebaz = $prixnumerik + $economierealisee;
     870
     871                            }
     872
     873                            if (!is_null($calculduprixdebaz)) {
     874                                $calculduprixdebaz = str_replace(',', "", $calculduprixdebaz);
     875                                $calculduprixdebaz = number_format((float)$calculduprixdebaz, 2, ',', ' ');
     876                            }
     877
     878                            // Si pas de % fourni, on le recalcule proprement
     879                            if ((is_null($pourcentrealise) || $pourcentrealise == 0)
     880                                && !is_null($prixnumerik)
     881                                && !is_null($economierealisee)
     882                                && ($prixnumerik + $economierealisee) > 0) {
     883
     884                                $pourcentrealise = round(($economierealisee / ($prixnumerik + $economierealisee)) * 100);
     885                            }
     886
     887                        }
     888
     889                    }
     890
     891                // ----- AUTRES APIs : on garde l'ancien comportement (Offers) -----
    805892                } else {
    806                    
    807                     $price = str_replace(',', "",$price);
    808                     //$price = number_format($price, 2, ',', ' ');
    809                     $price = number_format((float)$price, 2, ',', ' ');     
    810                     $display_devise = $store_my_devise;
    811                    
    812                 }
    813                
    814                 if ($use_prixbarre == "oui") {
    815                                        
    816                     if ((!is_null($economierealisee)) AND ($economierealisee != 0) AND ($economierealisee != "")) {
    817                        
    818                         $prix_de_base2k22 = isset($item['Offers']['Listings'][0]['SavingBasis']['Amount']) ? $item['Offers']['Listings'][0]['SavingBasis']['Amount'] : NULL;
    819                         $pourcentrealise = isset($item['Offers']['Listings'][0]['Price']['Savings']['Percentage']) ? $item['Offers']['Listings'][0]['Price']['Savings']['Percentage'] : NULL;
    820                        
    821                         if ((!is_null($prix_de_base2k22)) AND ($prix_de_base2k22 != 0)) {
    822                        
    823                             $calculduprixdebaz = $prix_de_base2k22;
    824                             $calculduprixdebaz = str_replace(',', "",$calculduprixdebaz);
    825                             $calculduprixdebaz = number_format($calculduprixdebaz, 2, ',', ' ');
    826                        
    827                         } else {
    828 
    829                             $calculduprixdebaz = $prixnumerik + $economierealisee;
    830                             $calculduprixdebaz = number_format($calculduprixdebaz, 2, ',', ' ');
     893
     894                    $price = isset($item['Offers']['Listings'][0]['Price']['Amount']) ? $item['Offers']['Listings'][0]['Price']['Amount'] : NULL;
     895                    $prixnumerik = isset($item['Offers']['Listings'][0]['Price']['Amount']) ? $item['Offers']['Listings'][0]['Price']['Amount'] : NULL;
     896                    $economierealisee = isset($item['Offers']['Listings'][0]['Price']['Savings']['Amount']) ? $item['Offers']['Listings'][0]['Price']['Savings']['Amount'] : NULL;
     897                   
     898                    // Module Special Price
     899                    if (is_null($price)) { // Si pas de prix
     900                        $price = "Special";
     901                        $display_devise = ""; // on enlève le sigle €/$
     902                    } else {
     903                        $price = str_replace(',', "", $price);
     904                        $price = number_format((float)$price, 2, ',', ' ');
     905                        $display_devise = $store_my_devise;
     906                    }
     907                   
     908                    if ($use_prixbarre == "oui") {
     909                                           
     910                        if ((!is_null($economierealisee)) AND ($economierealisee != 0) AND ($economierealisee != "")) {
     911                           
     912                            $prix_de_base2k22 = isset($item['Offers']['Listings'][0]['SavingBasis']['Amount']) ? $item['Offers']['Listings'][0]['SavingBasis']['Amount'] : NULL;
     913                            $pourcentrealise = isset($item['Offers']['Listings'][0]['Price']['Savings']['Percentage']) ? $item['Offers']['Listings'][0]['Price']['Savings']['Percentage'] : NULL;
     914                           
     915                            if ((!is_null($prix_de_base2k22)) AND ($prix_de_base2k22 != 0)) {
     916                           
     917                                $calculduprixdebaz = $prix_de_base2k22;
     918                                $calculduprixdebaz = str_replace(',', "",$calculduprixdebaz);
     919                                $calculduprixdebaz = number_format($calculduprixdebaz, 2, ',', ' ');
     920                           
     921                            } else {
     922
     923                                $calculduprixdebaz = $prixnumerik + $economierealisee;
     924                                $calculduprixdebaz = number_format($calculduprixdebaz, 2, ',', ' ');
     925                           
     926                            }
    831927                       
    832928                        }
    833                    
    834                     }
    835                    
    836                 }
    837                
    838             }
    839            
    840            
     929                       
     930                    }
     931
     932                } // fin else autre API
     933
     934            }
     935
     936
    841937            // Amazon Prime
    842938            $logoduprime = "";
    843            
     939            $listing = isset($item['Offers']['Listings'][0]) ? $item['Offers']['Listings'][0] : null;
    844940            if (($gothamazon_option_amaprime == "oui") AND ($gtz_tokyo4 != "oui") AND ($kel_api_utiliser == "amazon")) {
    845941                   
    846942                $urldulogoprime = "$plugins_url/gothamazon/img/prime.png";
    847943               
    848                 $eligibleprime = isset($item['Offers']['Listings'][0]['DeliveryInfo']['IsPrimeEligible']) && $item['Offers']['Listings'][0]['DeliveryInfo']['IsPrimeEligible'] ? true : NULL;
    849                 $eligiblefreeship = isset($item['Offers']['Listings'][0]['DeliveryInfo']['IsFreeShippingEligible']) && $item['Offers']['Listings'][0]['DeliveryInfo']['IsFreeShippingEligible'] ? true : NULL;
     944                $gestiondeprime = "";
     945                $eligibleprime = ($listing && !empty($listing['DeliveryInfo']['IsPrimeEligible'])) ? true : null;
     946                $eligiblefreeship = ($listing && !empty($listing['DeliveryInfo']['IsFreeShippingEligible'])) ? true : null;
    850947               
    851948                if ($eligibleprime) {
  • gothamazon/trunk/gothamzone.php

    r3363174 r3412254  
    44 * Plugin URI:        https://gothamazon.com
    55 * Description:       Parse Amazon Product Advertising API Feed in 30 seconds
    6  * Version:           3.4.5
     6 * Version:           3.5.0
    77 * Requires PHP:      7.4
    88 * Author:            Kapsule Network
     
    857857
    858858                    .storeitemprice strike {
    859                         color: '.$gothamazon_option_color_price_bg.';
     859                        background:red;
     860                        color: white;
    860861                        white-space: nowrap;
    861862                        font-size: 80%;
     863                        display:block;
    862864                    }
    863865
     
    955957
    956958                    ul.smartstoresidebar li .ficheproduit span.storeitemprice strike {
    957                         color: '.$gothamazon_option_color_price_bg.';
    958                         background: white;
     959                        color: white;
     960                        background: red;
    959961                        white-space: nowrap;
     962                        display:block;
    960963                    }
    961964
     
    11171120                        width: 100%;
    11181121                        white-space: nowrap;
     1122                        display:block;
     1123                        color:red;
     1124                        background:white;
    11191125                    }
    11201126                    .blob {
     
    23102316                $imgducsshey = "$plugins_url/gothamazon/img/";
    23112317                ?>
    2312                 <td colspan="2"><textarea style="width:100%;height:400px;">/* Gothamazon AMP CSS Version 1.0 */ ul.smartstore{background:#fff;list-style:none;font-family:arial;font-size:13px;border:1px solid #eee;padding: 16px;border-radius:4px;margin:20px 0;display:inline-block;}ul.smartstore a .blob,ul.smartstore a .storeitemtitle{text-decoration:none}ul.izishop92 li{margin:3px 1%;margin-top:3px;list-style:none;padding:0;width:48%;border-radius:3px;display:inline-block}ul.smartstore .gothamrate{margin:5px 0 0;float:none;display:inline-block;width:100px;padding:0}ul.izishop92 .gothamrate{text-align:center;width:100%}ul.smartstore li .ficheproduit span.storeitemfoo{display:block;background:#e9fbeb;width:100%;float:left;border-radius:4px;padding:5px 0;text-align:center}ul.izishop92 li .ficheproduit span.storeitemprice{display:inline-block;color:#fff;font-weight:700;font-size:20px;width:100%;padding:5px 0;border-radius:8px;background:<?php echo $gothamazon_option_color_price_bg; ?>;font-style:italic;text-align:center;margin-bottom:5px}ul.smartstoresidebar li .ficheproduit span.storeitemprice strike, ul.smartstore li .ficheproduit span.storeitemprice strike{color:<?php echo $gothamazon_option_color_price_bg; ?>;background:#fff;white-space:nowrap;float:left;text-align:center;width:100%;font-size:14px}ul.smartstore li .ficheproduit span.storeitemcta{text-align:center;color:#fff;width:80%;border-radius:3px;float:none;margin:2% auto;font-weight:700;padding:4px;display:block;background:<?php echo $gothamazon_option_color_cta; ?>}ul.smartstorespotlight li .ficheproduit span.storeitemcta{font-size:26px}.blob{font-size:12px;text-align:center;display:block;margin:20px 0;color:#000}.elprime{width:90px;display:inline-block;float:right}.elfreeshpping{font-size: 10px;text-transform: uppercase;font-weight: bold;padding: 10px 0;display: block;background: yellow;  color: red;text-align:center;}.elfreeshppingspotlight{font-size: 12px;text-transform: uppercase;font-weight: bold;padding: 10px 20px 10px 0;display: block;background: yellow;  color: red;text-align:right;}ul.smartstore li .ficheproduit .vaiamage span{float:left;margin:0;border:1px solid #eee;object-fit:cover;width:32.5%;max-height:100px}.smartstorespotlight .storeitemtitle{font-size:12px;text-align:center;font-weight:700;display:block;clear:both;margin:20px 0;float:left;width:100%}.izishop92 .storeitemtitle{font-size:12px;text-align:center;font-weight:700;text-decoration:none;display:block;clear:both;height:20px;line-height:20px;overflow:hidden}.smartstorelegal{font-size:11px;text-align:center;font-family:arial;line-height:12px;}.pricepromo{font-size:160%;font-family:arial;background-color:<?php echo $gothamazon_option_color_price_bg; ?>;color:#fff;transform:rotate(-1deg);width:100%;display:block;font-style:italic;font-weight:1000;padding:5px 0;text-align:center}.uaresmart{background:#226ab5;color:#fff;display:inline-block;width:100%;padding:3px 0;border-radius:4px;text-align:center}.uaresmart strong,.uaresmart u{color:#fff}ul.smartstorespotlight .bleft,ul.smartstorespotlight .bright{display:block} ul.smartstore li a.ficheproduit.kamesen span.imgkra amp-img{height:160px;display:block;overflow:hidden;}ul.smartstore li a.ficheproduit.kamesen span.imgkra amp-img img{height:160px;overflow:hidden;object-fit:contain}ul.goth_indexboutique{list-style:none;padding:0;margin:0;display:inline-block;width:100%}ul.goth_indexboutique li{list-style:none;width:48%;padding:1%;margin:.5%;display:inline-flex;background:#fff;text-align:center;border-radius:3px}ul.goth_indexboutique li a{width:100%}ul.goth_indexboutique li a amp-img{width:100%;object-fit:contain;height:150px;padding:15px;overflow:hidden}ul.goth_indexboutique li a amp-img img{height:150px;overflow:hidden;object-fit:contain}ul.goth_indexboutique li a span{background:#fff;display:block;color:#000;text-align:center;text-transform:uppercase;font-weight:700;margin:0 auto;width:100%;padding:0 10px}.gtz_amacompliant{background:#181818; color:#eee;text-align:center;padding:5px;font-size:12px;}.gtz_amz {display:block;float:none;text-align:right;}.izishop92 .gtz_amz {text-align:center;}.gtz_amz img {width:auto;max-width:100%;display:initial;}.ama_itxtlink::before{background:url("<?php echo $imgducsshey; ?>ama_icon.png") no-repeat left center transparent;position:relative;z-index:100000;left:0;top:0;background-size:100% 100%;line-height:12px;width:12px;height:12px;display:inline-block;margin-right:2px;margin-left:2px;content:"\0000a0";opacity:0.8;}.ssjinstinct ul {display: flex;overflow-x: scroll;border-radius:0;scroll-snap-type: x mandatory;}.ssjinstinct ul li { flex-grow: 1;flex-shrink: 0;flex-basis: 230px;}.ssjinstinct ul li.samba {width: 100%;margin:0 5px;background: transparent;  padding: 0;border-radius: 8px;}.ssjinstinct ul li.jonlok {width: 100%;padding: 0;margin: 0;}.ssjinstinct ul li .bim_blokprod {border-radius:0;} .ssjinstinct ul::-webkit-scrollbar {height: 26px;background-color: #181818;}.ssjinstinct ul::-webkit-scrollbar-thumb {background-color: #ff5a5f;border-top: 4px solid#181818; border-bottom: 4px solid #181818;}@media only screen and (max-width:1024px) {.gtz_amz {text-align:center;}}.newrules24 {position:absolute;top:24px;left:2px;width: auto;}ul.smartstore li {position:relative;}.gtz-info-icon {position: relative;cursor: pointer;}.gtz-info-icon:hover .gtz-tooltip,.gtz-info-icon:focus .gtz-tooltip {visibility: visible;opacity: 1;}.gtz-tooltip {   visibility: hidden;width: 120px; background-color: black;color: white;text-align: center;padding: 5px 0;border-radius: 6px;position: absolute;z-index: 1;bottom: 100%;left: 50%;margin-left: -60px;opacity: 0;transition: opacity 0.5s;}.gtz-tooltip::after{content: "";position: absolute;top: 100%;left: 50%;margin-left: -5px;border-width: 5px;border-style: solid;border-color: black transparent transparent transparent;}.pixanchor .gtz-tooltip {position:relative;padding: 5px 10px;}.small_sous_cta{font-size: 10px;font-family: arial; position:absolute;bottom: -15px; right: 0;background: white;border: 1px solid;padding: 1px 5px;opacity: 0.8;border-radius: 3px;} {/* ! Gothamazon AMP CSS */</textarea></td>
     2318                <td colspan="2"><textarea style="width:100%;height:400px;">/* Gothamazon AMP CSS Version 1.0 */ ul.smartstore{background:#fff;list-style:none;font-family:arial;font-size:13px;border:1px solid #eee;padding: 16px;border-radius:4px;margin:20px 0;display:inline-block;}ul.smartstore a .blob,ul.smartstore a .storeitemtitle{text-decoration:none}ul.izishop92 li{margin:3px 1%;margin-top:3px;list-style:none;padding:0;width:48%;border-radius:3px;display:inline-block}ul.smartstore .gothamrate{margin:5px 0 0;float:none;display:inline-block;width:100px;padding:0}ul.izishop92 .gothamrate{text-align:center;width:100%}ul.smartstore li .ficheproduit span.storeitemfoo{display:block;background:#e9fbeb;width:100%;float:left;border-radius:4px;padding:5px 0;text-align:center}ul.izishop92 li .ficheproduit span.storeitemprice{display:inline-block;color:#fff;font-weight:700;font-size:20px;width:100%;padding:5px 0;border-radius:8px;background:<?php echo $gothamazon_option_color_price_bg; ?>;font-style:italic;text-align:center;margin-bottom:5px}ul.smartstoresidebar li .ficheproduit span.storeitemprice strike, ul.smartstore li .ficheproduit span.storeitemprice strike{color:white;background:red;white-space:nowrap;float:left;text-align:center;width:100%;font-size:14px}ul.smartstore li .ficheproduit span.storeitemcta{text-align:center;color:#fff;width:80%;border-radius:3px;float:none;margin:2% auto;font-weight:700;padding:4px;display:block;background:<?php echo $gothamazon_option_color_cta; ?>}ul.smartstorespotlight li .ficheproduit span.storeitemcta{font-size:26px}.blob{font-size:12px;text-align:center;display:block;margin:20px 0;color:#000}.elprime{width:90px;display:inline-block;float:right}.elfreeshpping{font-size: 10px;text-transform: uppercase;font-weight: bold;padding: 10px 0;display: block;background: yellow;  color: red;text-align:center;}.elfreeshppingspotlight{font-size: 12px;text-transform: uppercase;font-weight: bold;padding: 10px 20px 10px 0;display: block;background: yellow;  color: red;text-align:right;}ul.smartstore li .ficheproduit .vaiamage span{float:left;margin:0;border:1px solid #eee;object-fit:cover;width:32.5%;max-height:100px}.smartstorespotlight .storeitemtitle{font-size:12px;text-align:center;font-weight:700;display:block;clear:both;margin:20px 0;float:left;width:100%}.izishop92 .storeitemtitle{font-size:12px;text-align:center;font-weight:700;text-decoration:none;display:block;clear:both;height:20px;line-height:20px;overflow:hidden}.smartstorelegal{font-size:11px;text-align:center;font-family:arial;line-height:12px;}.pricepromo{font-size:160%;font-family:arial;background-color:<?php echo $gothamazon_option_color_price_bg; ?>;color:#fff;transform:rotate(-1deg);width:100%;display:block;font-style:italic;font-weight:1000;padding:5px 0;text-align:center}.uaresmart{background:#226ab5;color:#fff;display:inline-block;width:100%;padding:3px 0;border-radius:4px;text-align:center}.uaresmart strong,.uaresmart u{color:#fff}ul.smartstorespotlight .bleft,ul.smartstorespotlight .bright{display:block} ul.smartstore li a.ficheproduit.kamesen span.imgkra amp-img{height:160px;display:block;overflow:hidden;}ul.smartstore li a.ficheproduit.kamesen span.imgkra amp-img img{height:160px;overflow:hidden;object-fit:contain}ul.goth_indexboutique{list-style:none;padding:0;margin:0;display:inline-block;width:100%}ul.goth_indexboutique li{list-style:none;width:48%;padding:1%;margin:.5%;display:inline-flex;background:#fff;text-align:center;border-radius:3px}ul.goth_indexboutique li a{width:100%}ul.goth_indexboutique li a amp-img{width:100%;object-fit:contain;height:150px;padding:15px;overflow:hidden}ul.goth_indexboutique li a amp-img img{height:150px;overflow:hidden;object-fit:contain}ul.goth_indexboutique li a span{background:#fff;display:block;color:#000;text-align:center;text-transform:uppercase;font-weight:700;margin:0 auto;width:100%;padding:0 10px}.gtz_amacompliant{background:#181818; color:#eee;text-align:center;padding:5px;font-size:12px;}.gtz_amz {display:block;float:none;text-align:right;}.izishop92 .gtz_amz {text-align:center;}.gtz_amz img {width:auto;max-width:100%;display:initial;}.ama_itxtlink::before{background:url("<?php echo $imgducsshey; ?>ama_icon.png") no-repeat left center transparent;position:relative;z-index:100000;left:0;top:0;background-size:100% 100%;line-height:12px;width:12px;height:12px;display:inline-block;margin-right:2px;margin-left:2px;content:"\0000a0";opacity:0.8;}.ssjinstinct ul {display: flex;overflow-x: scroll;border-radius:0;scroll-snap-type: x mandatory;}.ssjinstinct ul li { flex-grow: 1;flex-shrink: 0;flex-basis: 230px;}.ssjinstinct ul li.samba {width: 100%;margin:0 5px;background: transparent;  padding: 0;border-radius: 8px;}.ssjinstinct ul li.jonlok {width: 100%;padding: 0;margin: 0;}.ssjinstinct ul li .bim_blokprod {border-radius:0;} .ssjinstinct ul::-webkit-scrollbar {height: 26px;background-color: #181818;}.ssjinstinct ul::-webkit-scrollbar-thumb {background-color: #ff5a5f;border-top: 4px solid#181818; border-bottom: 4px solid #181818;}@media only screen and (max-width:1024px) {.gtz_amz {text-align:center;}}.newrules24 {position:absolute;top:24px;left:2px;width: auto;}ul.smartstore li {position:relative;}.gtz-info-icon {position: relative;cursor: pointer;}.gtz-info-icon:hover .gtz-tooltip,.gtz-info-icon:focus .gtz-tooltip {visibility: visible;opacity: 1;}.gtz-tooltip {   visibility: hidden;width: 120px; background-color: black;color: white;text-align: center;padding: 5px 0;border-radius: 6px;position: absolute;z-index: 1;bottom: 100%;left: 50%;margin-left: -60px;opacity: 0;transition: opacity 0.5s;}.gtz-tooltip::after{content: "";position: absolute;top: 100%;left: 50%;margin-left: -5px;border-width: 5px;border-style: solid;border-color: black transparent transparent transparent;}.pixanchor .gtz-tooltip {position:relative;padding: 5px 10px;}.small_sous_cta{font-size: 10px;font-family: arial; position:absolute;bottom: -15px; right: 0;background: white;border: 1px solid;padding: 1px 5px;opacity: 0.8;border-radius: 3px;} {/* ! Gothamazon AMP CSS */</textarea></td>
    23132319             </tr>
    23142320             
  • gothamazon/trunk/js/obf.js

    r3235993 r3412254  
    1 function handleKamesenClick(event) {
    2      const target = event.target.closest('.kamesen');
    3         if (!target || !target.hasAttribute("datasin")) return;
    4 
    5         event.preventDefault(); // Empêcher le comportement par défaut du navigateur
    6         const encodedUrl = target.getAttribute("datasin");
    7         const url = decodeURIComponent(window.atob(encodedUrl));
    8 
    9         const newWindow = window.open(url, '_blank');
    10         if (newWindow) newWindow.focus();
    11 }
    12 
    13 function handleKamesenContextMenu(event) {
     1function openKamesenLink(event) {
    142    const target = event.target.closest('.kamesen');
    153    if (!target || !target.hasAttribute("datasin")) return;
    164
     5    // Bloque comportement par défaut + autres handlers
    176    event.preventDefault();
     7    event.stopPropagation();
     8    if (event.stopImmediatePropagation) event.stopImmediatePropagation();
     9
    1810    const encodedUrl = target.getAttribute("datasin");
    1911    const url = decodeURIComponent(window.atob(encodedUrl));
    2012
    21     window.open(url, '_blank');
     13    const newWindow = window.open(url, '_blank', 'noopener');
     14    if (newWindow) newWindow.focus();
    2215}
    2316
    24 // ✅ Ajout d'un écouteur pour détecter le clic molette
    25 function handleKamesenMiddleClick(event) {
    26     if (event.button === 1) { // Bouton molette détecté
    27         const target = event.target.closest('.kamesen');
    28         if (!target || !target.hasAttribute("datasin")) return;
    29 
    30         event.preventDefault(); // Empêcher le comportement par défaut du navigateur
    31         const encodedUrl = target.getAttribute("datasin");
    32         const url = decodeURIComponent(window.atob(encodedUrl));
    33 
    34         const newWindow = window.open(url, '_blank');
    35         if (newWindow) newWindow.focus();
    36     }
    37 }
    38 
     17// On passe `true` pour capter l'évènement en *capture* (avant les autres handlers en bubbling)
    3918document.addEventListener("DOMContentLoaded", function() {
    4019    if (window.disableSameInRocketPromo) {
     
    4221        return;
    4322    }
    44     window.disableSameInRocketPromo = true;
    45    
     23    window.disableSameInRocketPromo = true;
     24
    4625    console.log("✅ GTZ Kamesen activé.");
    47     document.addEventListener("click", handleKamesenClick);
    48     document.addEventListener("contextmenu", handleKamesenContextMenu);
    49     document.addEventListener("mousedown", handleKamesenMiddleClick);
     26
     27    document.addEventListener("click", openKamesenLink, true); // phase de capture
     28
     29    document.addEventListener("mousedown", function(e) {
     30        if (e.button === 1) openKamesenLink(e);
     31    }, true);
     32
     33    document.addEventListener("contextmenu", function(e) {
     34        openKamesenLink(e);
     35        e.preventDefault(); // pour ne pas afficher le menu contextuel si tu veux
     36    }, true);
    5037});
  • gothamazon/trunk/readme.txt

    r3363174 r3412254  
    44Tags: amazon affiliate, affiliate, affiliation, amazon, ecommerce, amazon product api
    55
    6 Stable tag: 3.4.5
    7 
    8 Tested up to: 6.8.2
     6Stable tag: 3.5.0
     7
     8Tested up to: 6.9
    99Requires at least: 6.0
    1010Requires PHP: 7.4.0
     
    180180== Changelog ==
    181181
     182= 3.5 =
     183
     184- Migration to OffersV2
     185
    182186= 3.4.5 =
    183187
Note: See TracChangeset for help on using the changeset viewer.