next to implement automatic refetch via cron
This commit is contained in:
1 parent
2eef682859
commit
77f8d034aa
4 files changed
+40
-7
No files matched your search
@@ -76,20 +76,32 @@ class EcomZone extends Module
|
||||
try {
|
||||
$debugOutput .= "Starting product fetch...\n";
|
||||
|
||||
// Get first 10 products for testing
|
||||
$catalog = $this->api->getCatalog(10);
|
||||
// Get all products
|
||||
$catalog = $this->api->getCatalog(1000);
|
||||
|
||||
if (isset($catalog['data']) && is_array($catalog['data'])) {
|
||||
foreach ($catalog['data'] as $product) {
|
||||
$debugOutput .= sprintf("Fetching all products...\n");
|
||||
$totalProducts = count($catalog['data']);
|
||||
|
||||
// Show first 5 products as preview
|
||||
for ($i = 0; $i < min(5, $totalProducts); $i++) {
|
||||
$product = $catalog['data'][$i];
|
||||
$debugOutput .= sprintf(
|
||||
"Found product: %s - %s (Price: %s EUR, Stock: %s)\n",
|
||||
"Product %d/%d: %s - %s (Price: %s EUR, Stock: %s)\n",
|
||||
$i + 1,
|
||||
$totalProducts,
|
||||
$product['sku'],
|
||||
$product['product_name'],
|
||||
$product['product_price'],
|
||||
$product['stock']
|
||||
);
|
||||
}
|
||||
$debugOutput .= sprintf("\nTotal products fetched: %d\n", count($catalog['data']));
|
||||
|
||||
if ($totalProducts > 5) {
|
||||
$debugOutput .= "...\n"; // Indicate there are more products
|
||||
}
|
||||
|
||||
$debugOutput .= sprintf("\nTotal products fetched: %d\n", $totalProducts);
|
||||
} else {
|
||||
$debugOutput .= "No products found or invalid response format\n";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user