private function runHelloCashPull(&$messages) { if (!defined('HELLOCASH_SYNC_IN_PROGRESS')) { define('HELLOCASH_SYNC_IN_PROGRESS', true); } $token = trim($this->params->get('api_token', '')); if (empty($token)) { $messages[] = "FEHLER: Kein API-Token konfiguriert."; return; } $db = JFactory::getDbo(); // 1. Auto-Mapping ausführen $this->runBulkAutoMapping($token, $db, $messages); // 2. Alle Mappings aus der DB laden (product_id => hellocash_id) $query = $db->getQuery(true) ->select(array($db->quoteName('product_id'), $db->quoteName('hellocash_id'))) ->from($db->quoteName('#__hikashop_hellocash_map')); $db->setQuery($query); $mappings = $db->loadObjectList(); if (empty($mappings)) { $messages[] = "Keine verknüpften Artikel vorhanden."; return; } $hcToHikaMap = array(); foreach ($mappings as $m) { $hcToHikaMap[(int)$m->hellocash_id] = (int)$m->product_id; } $updatedCount = 0; $headers = array("Authorization: Bearer " . $token, "Accept: application/json"); // 3. Bestände seitenweise von helloCash abrufen (100 Artikel pro Request) for ($page = 1; $page <= 25; $page++) { $url = "https://api.hellocash.business/api/v2/articles?limit=100&page=" . $page; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode == 429) { usleep(1500000); $page--; continue; } if ($httpCode != 200 || empty($response)) { break; } $data = json_decode($response, true); $articles = isset($data['data']) ? $data['data'] : (is_array($data) ? $data : array()); if (empty($articles)) { break; } foreach ($articles as $art) { $hcId = isset($art['id']) ? (int)$art['id'] : 0; if ($hcId <= 0 || !isset($hcToHikaMap[$hcId])) { continue; } $stock = null; if (isset($art['stocks'])) $stock = (int)$art['stocks']; elseif (isset($art['stock'])) $stock = (int)$art['stock']; if ($stock !== null) { $pId = $hcToHikaMap[$hcId]; $updateQuery = $db->getQuery(true) ->update($db->quoteName('#__hikashop_product')) ->set($db->quoteName('product_quantity') . ' = ' . $stock) ->where($db->quoteName('product_id') . ' = ' . $pId); $db->setQuery($updateQuery); try { $db->execute(); $updatedCount++; } catch (Exception $e) {} } } if (count($articles) < 100) { break; } usleep(100000); } // Kompakte Erfolgsmeldung ohne unendliche Einzelausgaben $messages[] = "SYNC FERTIG: Insgesamt " . $updatedCount . " Artikelbestände von helloCash nach HikaShop synchronisiert."; } BÖKER

BÖKER

20,95 € HULTAFORS Overstrike Guard
215,00 € HULTAFORS PREMIUM Axt ÄBY Wald
133,96 € HULTAFORS PREMIUM Axt AGELSJÖN
162,95 € HULTAFORS PREMIUM Axt EKELUND
140,95 € HULTAFORS PREMIUM Axt HULTAN
155,95 € HULTAFORS PREMIUM Axt QVARFOT
155,95 € HULTAFORS PREMIUM Axt STALBERG
177,95 € HULTAFORS PREMIUM HULT Spaltaxt
461,00 € HULTAFORS PREMIUM WETTERHALL Wurfaxt
159,95 € HULTAFORS Spaltaxt
83,95 € HULTAFORS Trekkingbeil
228,00 € HULTAFORS Wettkampf AXT
101,95 € HULTAFORS Zimmermannsbeil
44,95 € IBEX 100 THERMO-BUCHENHOLZ
17,95 € K25 BALISONG TRAINER
21,95 € K25 FIXED BLADE TRAINER RED
19,96 € K25 POCKET KNIFE TRAINER
64,96 € K25 THUNDER I DESERT
67,96 € KALASHNIKOV BOXCUTTER
298,00 € KARESUANDO BUSHC. AXE METSÄMIES HÄTÄ M
328,00 € KARESUANDO PÄLTSA MASERBIRKE
1.048,00 € KARESUANDO PESSINKI
324,00 € KARESUANDO UNNA ÀKSU BRUN
324,00 € KARESUANDO UNNA ÀKSU NATUR
260,00 € KERSHAW AUTO LAUNCH 18
263,00 € KERSHAW BEL AIR
263,00 € KERSHAW BEL AIR BLACK
320,00 € KERSHAW BEL AIR Black
263,00 € KERSHAW BEL AIR CLIP POINT MICARTA
72,95 € KERSHAW BRAWLER SERRATED
57,95 € KERSHAW CONDUIT SERRATED
86,95 € KERSHAW CYBERNET
57,95 € KERSHAW Flitch
72,95 € KERSHAW FUNXION EMT
300,00 € KERSHAW IRIDIUM Reverse Tanto Titanium
109,96 € KERSHAW MINI IRIDIUM
39,95 € KERSHAW OUTFIELD
57,95 € KERSHAW OUTRIGHT
58,96 € KERSHAW OUTRIGHT BLACK
58,96 € KERSHAW OUTRIGHT BLK SERRATED
125,95 € KERSHAW REMNANT
73,96 € KERSHAW RUNOFF
73,96 € KERSHAW SEQUENCE
57,95 € KERSHAW SHORELINE SERRATED
216,00 € KIZER Ara Brittany Blue
381,00 € KIZER Ara CPM Cruwaer
203,00 € KIZER Ara Gold Flake
254,00 € KIZER Ara Purple Snowflake
Ergebnisse 817 – 864 von 1572