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

76,96 € KIZER Mini Bulldog Grey Micarta
188,95 € KIZER Mini Bulldog Grey Titanium
82,96 € KIZER Mini Bulldog Purple Aluminium
63,95 € KIZER Mini Harpoon Micarta
91,96 € KIZER Mini Momo Aluminium Micarta
286,00 € KIZER Mini MoMo Timascus Marble Carbon
240,00 € KIZER Mini MoMo Titanium Carbon 80´s
240,00 € KIZER Mini MoMo Titanium Carbon Gold
91,96 € KIZER Mini Mystic Burlap Micarta PEI
86,95 € KIZER Momo G10 Micarta
66,95 € Kizer Muskrat Micarta
65,95 € KIZER Parakeet Brown Micarta
75,95 € KIZER Parakeet Dark Grey
75,95 € KIZER Parakeet Green Aluminium
66,95 € KIZER Parakeet Green PEI
64,96 € KIZER Parakeet Silver
125,95 € KIZER Pioneer Nitro Aluminium & Micarta
125,95 € KIZER Pioneer Nitro Aluminium & Micarta
216,00 € KIZER Pioneer S35VN Blue Canyon & Titan
216,00 € KIZER Pioneer S35VN Blue Canyon & Titan
76,96 € KIZER Polaris Beige
96,95 € KIZER Polaris Black/Brown
76,96 € KIZER Polaris Green
96,95 € KIZER Polaris Grey/Brown
88,96 € KIZER Skinner Nitro-V Micarta
101,95 € KIZER Skinner Nitro-V PEI
78,95 € KIZER SMOLT 1063A1
78,95 € KIZER Smolt Black G10 & Micarta
182,95 € KIZER Sparrow Fat Caron Medusa
170,95 € KIZER Sparrow Marle Carbon Grey
107,95 € KIZER Spitfire Blue Canyon
241,00 € KIZER Spitfire Grey Carbon Fiber
66,95 € Kizer Task G10
80,95 € KIZER Tomb Nitro-V Black
80,95 € KIZER Tomb Nitro-V Damast G10
80,95 € KIZER Tomb Nitro-V Mkuruti Wood
80,95 € KIZER Tomb Nitro-V PEI
80,95 € KIZER Ursa Major Black G10
91,96 € KIZER Ursa Major Black Micarta
80,95 € KIZER Ursa Major Green G10
201,00 € KIZER VARATAS
78,95 € Kizer Varatas G10
91,96 € Kizer Varatas PEI
291,00 € KIZER Zero Black & Grey
355,00 € KMFS VANTAEDGE INTEGRAL
230,00 € LIONSTEEL ACHA Black Burlap
230,00 € LIONSTEEL ACHA Green Burlap
147,95 € LIONSTEEL AGO GREEN CANVAS
Ergebnisse 913 – 960 von 1572