2.7 KiB
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
-
Fixed
EcomZoneClient.phpMethods:- Updated
getCatalogto explicitly pass "GET" as the HTTP method - Updated
getProductto explicitly pass "GET" as the HTTP method
- Updated
-
Enhanced
makeApiRequestMethod:- Added validation to ensure the method parameter is always a string
- Added more detailed logging for debugging
-
Fixed API Request Calls:
- Updated all calls to
makeApiRequestto explicitly specify "GET" as the method
- Updated all calls to
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:
-
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
-
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:
- Use the standalone
api_test.phpscript which doesn't require PrestaShop configuration files - The regular
test_api.phpscript requires access to PrestaShop'sconfig/config.inc.phpandinit.phpfiles - Edit the paths in
test_api.phpif needed to point to your actual PrestaShop installation
Production Environment Testing
In a production environment:
- Copy the module to your PrestaShop modules directory
- Install the module through the PrestaShop admin panel
- Configure your API credentials in the module settings
- Run the
test_api.phpscript from within the module directory
How to Verify
- Run the standalone API test script:
php -f api_test.php - If the API connection is working, you should see product data from the EcomZone API
- Check the module logs in
/log/ecomzone.logfor 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)