category -> product association implemented

This commit is contained in:
echo committed 2025-02-16 20:02:41 +01:00
1 parent 0b8c5de8b0
commit c8bcfe6bd6
41 files changed
+2222 -703

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
<?php
if (!defined("_PS_VERSION_")) {
exit();
}
class EcomZoneApiTest
{
private $client;
public function __construct()
{
$this->client = new EcomZoneClient();
}
public function testProductFetch()
{
try {
// Get first page with one product
$result = $this->client->getCatalog(1, 1);
EcomZoneLogger::log("API Test Result", "INFO", [
"result" => $result,
]);
return $result;
} catch (Exception $e) {
EcomZoneLogger::log("API Test Failed", "ERROR", [
"error" => $e->getMessage(),
]);
throw $e;
}
}
public function getProducts($page = 1, $perPage = 10)
{
try {
$result = $this->client->getCatalog($page, $perPage);
return [
"products" => $result["data"] ?? [],
"total" => $result["total"] ?? 0,
"current_page" => $page,
"per_page" => $perPage,
];
} catch (Exception $e) {
EcomZoneLogger::log("Failed to get products", "ERROR", [
"error" => $e->getMessage(),
]);
throw $e;
}
}
}