# EcomZone PrestaShop Module - Troubleshooting ## Issue #1: 405 Method Not Allowed Error The module was encountering a 405 Method Not Allowed error with the message: "The ARRAY method is not supported for this route. Supported methods: GET, HEAD." ### Root Cause The issue was happening because the code was incorrectly passing parameters to the `makeRequest` method, causing the HTTP method to be set as an array instead of a string. ### Fixes Applied 1. **Fixed `EcomZoneClient.php` Methods**: - Updated `getCatalog` to explicitly pass "GET" as the HTTP method - Updated `getProduct` to explicitly pass "GET" as the HTTP method 2. **Enhanced `makeApiRequest` Method**: - Added validation to ensure the method parameter is always a string - Added more detailed logging for debugging 3. **Fixed API Request Calls**: - Updated all calls to `makeApiRequest` to explicitly specify "GET" as the method ## Issue #2: Missing cURL Extension The module was unable to make API requests because the PHP cURL extension was not installed. ### Fix Applied - Installed the PHP cURL extension using: `sudo apt-get install php-curl` ## Testing Tools Two testing tools have been created to verify API connectivity: 1. **api_test.php**: - A standalone script that tests API connectivity without requiring PrestaShop - Verifies that the API token is valid and can retrieve product data 2. **get_token.php**: - Retrieves the API token from the PrestaShop configuration or database - Useful for troubleshooting API authentication issues ## Development Environment Testing When testing in a development environment without a full PrestaShop installation: 1. Use the standalone `api_test.php` script which doesn't require PrestaShop configuration files 2. The regular `test_api.php` script requires access to PrestaShop's `config/config.inc.php` and `init.php` files 3. Edit the paths in `test_api.php` if needed to point to your actual PrestaShop installation ## Production Environment Testing In a production environment: 1. Copy the module to your PrestaShop modules directory 2. Install the module through the PrestaShop admin panel 3. Configure your API credentials in the module settings 4. Run the `test_api.php` script from within the module directory ## How to Verify 1. Run the standalone API test script: `php -f api_test.php` 2. If the API connection is working, you should see product data from the EcomZone API 3. Check the module logs in `/log/ecomzone.log` for any new error messages If you continue to experience issues, please check: - Your API token is valid and correctly configured - The API URL is correctly set to `https://dropship.ecomzone.eu/api` - Your web server has the required PHP extensions installed (cURL, JSON)