Modern, fast, and user-friendly REST API and Python Desktop Application developed for PrestaShop e-commerce platform.
- Features
 - Technologies
 - Installation
 - Usage
 - API Documentation
 - Python Application
 - Security
 - Troubleshooting
 - Contributing
 - License
 
- β RESTful Architecture: Standard HTTP methods (GET, POST, PUT, DELETE)
 - β Product Management: Full CRUD operations
 - β Order Management: View orders and update status
 - β Secure: API Key authentication, IP restriction
 - β CORS Support: Cross-origin resource sharing
 - β JSON Format: All responses in standard JSON format
 - β Pagination: Automatic pagination for large datasets
 - β Filtering: Flexible search and filtering options
 - β SQL Optimization: High performance with direct SQL queries
 - β Error Handling: Detailed and clear error messages
 
- β Modern Interface: User-friendly GUI with Tkinter
 - β Product Management: Add, edit, delete, search products
 - β Order Management: View orders, update status
 - β Detailed View: View product and order details
 - β Context Menus: Right-click menus for quick access
 - β Async Operations: Non-blocking UI with threading
 - β Auto Connection Test: API status monitoring
 - β Multi-language: Supports internationalization
 
- PHP 7.2+
 - PrestaShop 1.7.x / 8.x
 - MySQL / MariaDB
 - Apache / Nginx
 
- Python 3.8+
 - Tkinter (GUI)
 - Requests (HTTP Client)
 - python-dotenv (Configuration)
 
- PrestaShop installed web server
 - PHP 7.2 or higher
 - Python 3.8 or higher
 - MySQL/MariaDB database
 
Create a folder in your PrestaShop root directory:
/your-prestashop/
  βββ prestapi/           # API folder
  β   βββ api.php
  β   βββ config.php
  β   βββ .htaccess
  β   βββ test.php
  β   βββ classes/
  β       βββ ApiHandler.php
  β       βββ Response.php
  β       βββ ProductManager.php
  β       βββ OrderManager.php
Open config.php and configure your settings:
<?php
// PrestaShop root directory
define('PS_ROOT_DIR', dirname(__FILE__) . '/../');
// Generate a secure API key
define('API_KEY', 'your_secret_api_key_here');
// Allowed IP addresses (empty array = public access)
define('ALLOWED_IPS', []); 
// Database settings
define('DB_SERVER', 'localhost');
define('DB_USER', 'your_db_user');
define('DB_PASSWD', 'your_db_password');
define('DB_NAME', 'your_db_name');
define('DB_PREFIX', 'ps_');
// API Settings
define('API_DEBUG', true);  // Development: true, Production: false
define('API_CORS_ENABLED', true);Open the test page in your browser:
https://yourstore.com/prestapi/test.php
or test the API directly:
https://yourstore.com/prestapi/api.php?resource=products&api_key=your_api_key
β If you get a successful response, PHP API is ready!
# Navigate to project directory
cd prestapi
# Install required packages
pip install -r requirements.txtEdit the config.env file:
# PrestaShop API Configuration
API_URL=https://yourstore.com/prestapi/api.php
API_KEY=your_secret_api_key_hereconfig.php)!
python app.pyβ Application opens and API connection is automatically tested!
List Products:
- Select "π¦ Products" from left menu
 - All products displayed in table
 
Search Products:
- Type product name in search box
 - Click "Search" button
 
Add New Product:
- Click "β New Product" button
 - Fill the form:
- Product Name (required)
 - Price (required)
 - Reference, EAN13, Stock Quantity
 - Short Description
 - Status (Active/Inactive)
 
 - Click "Save" button
 
Edit Product:
- Right-click on product β "βοΈ Edit"
 - or select product and click edit button
 
View Product Details:
- Double-click on product
 - or right-click β "ποΈ View Details"
 
Delete Product:
- Right-click β "ποΈ Delete" β Confirm
 
List Orders:
- Select "π Orders" from left menu
 - Recent orders displayed in table
 
View Order Details:
- Double-click on order
 - 3 tabs open:
- General Info: Order summary
 - Customer Info: Customer and address
 - Products: Products in order
 
 
Update Order Status:
- Right-click β "βοΈ Update Status"
 - Select new status:
- Awaiting Payment (1)
 - Payment Accepted (2)
 - Processing (3)
 - Shipped (4)
 - Delivered (5)
 - Canceled (6)
 - Refunded (7)
 
 - Click "Update" button
 
API key must be sent with all requests:
Method 1: Header (Recommended)
curl -H "X-API-Key: your_api_key" https://yourstore.com/prestapi/api.php?resource=productsMethod 2: Query String
curl https://yourstore.com/prestapi/api.php?resource=products&api_key=your_api_keyGET /api.php?resource=productsParameters:
page- Page number (default: 1)limit- Products per page (default: 50, max: 100)active- Status filter (0 or 1)category- Category IDsearch- Search in product name
Example:
curl -H "X-API-Key: your_api_key" \
  "https://yourstore.com/prestapi/api.php?resource=products&page=1&limit=10&search=tshirt"Response:
{
  "success": true,
  "message": "Products retrieved successfully",
  "data": {
    "items": [
      {
        "id_product": "1",
        "name": "Sample T-Shirt",
        "price": "29.99",
        "stock_quantity": "100",
        "active": "1",
        "price_formatted": "29.99 βΊ"
      }
    ],
    "pagination": {
      "total": 150,
      "page": 1,
      "limit": 10,
      "pages": 15
    }
  }
}GET /api.php?resource=products&id=1POST /api.php?resource=products
Content-Type: application/json
{
  "name": "New Product",
  "price": 49.99,
  "reference": "REF123",
  "quantity": 100,
  "active": 1
}PUT /api.php?resource=products&id=1
Content-Type: application/json
{
  "price": 59.99,
  "quantity": 150
}DELETE /api.php?resource=products&id=1GET /api.php?resource=ordersParameters:
page- Page numberlimit- Orders per pagecustomer- Customer IDstatus- Order statusdate_from- Start date (YYYY-MM-DD)date_to- End date (YYYY-MM-DD)
GET /api.php?resource=orders&id=1PUT /api.php?resource=orders&id=1
Content-Type: application/json
{
  "current_state": 3
}Success:
{
  "success": true,
  "message": "Operation successful",
  "data": { ... }
}Error:
{
  "success": false,
  "message": "Error message",
  "errors": null
}200- OK201- Created400- Bad Request401- Unauthorized (Invalid API key)403- Forbidden (IP restriction)404- Not Found500- Internal Server Error
Generate a strong API key:
// Generate random key with PHP
define('API_KEY', bin2hex(random_bytes(32)));Allow access only from specific IPs:
define('ALLOWED_IPS', [
    '192.168.1.100',  // Office
    '203.0.113.50'    // Server
]);Disable debug mode in production:
define('API_DEBUG', false);Problem: "Cannot connect to API"
Solution:
- Check URL in 
config.env - Verify API key is correct
 - Ensure server is accessible
 
Problem: "Kernel Container is not available"
Solution: β This issue is resolved! API no longer depends on PrestaShop Kernel.
Problem: SQL syntax error
Solution: Check database prefix (config.php β DB_PREFIX)
Problem: ModuleNotFoundError: No module named 'tkinter'
Solution:
Ubuntu/Debian:
sudo apt-get install python3-tkmacOS: Reinstall Python (includes Tkinter)
Windows: Ensure "tcl/tk" option is checked during Python installation
Problem: ModuleNotFoundError: No module named 'requests'
Solution:
pip install -r requirements.txtprestapi/
βββ π PHP API (Backend)
β   βββ api.php                 # Main endpoint
β   βββ config.php              # Configuration
β   βββ test.php                # Test interface
β   βββ .htaccess               # URL rewriting
β   βββ classes/
β       βββ ApiHandler.php      # Request handler
β       βββ Response.php        # Response handler
β       βββ ProductManager.php  # Product operations
β       βββ OrderManager.php    # Order operations
β
βββ π Python Desktop (Frontend)
β   βββ app.py                  # Main application
β   βββ api_client.py           # API client
β   βββ config.env              # Configuration
β   βββ requirements.txt        # Python dependencies
β
βββ π Documentation
    βββ README.md               # This file
    βββ README_PYTHON.md        # Python app details
- REST API
 - Product CRUD operations
 - Order management
 - Python desktop application
 - API security
 - Pagination and filtering
 - HTML sanitization
 - SQL optimization
 
- Category management
 - Customer management
 - Stock tracking
 - Bulk operations
 - Excel export
 - Charts and reports
 - Product image upload
 - Dark mode
 - Multi-language support
 - Real-time updates with WebSocket
 
We welcome contributions!
- Fork the repository
 - Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
 
This project is licensed under the MIT License. See LICENSE file for details.
PrestaShop API & Desktop Manager
- PrestaShop community
 - Python Tkinter developers
 - All contributors
 
For questions or suggestions, please open an issue.
- Modern and clean design
 - Colorful status indicators
 - Easy navigation
 
- Table view
 - Search functionality
 - Context menus
 - Quick editing
 
- Detailed order view
 - Customer information
 - Product list
 - Status updates
 
- Automatic API tests
 - Visual result display
 - Error details
 
# Clone repository
git clone https://github.com/yourusername/prestapi.git
# Install PHP API
cd prestapi
# Upload to PrestaShop server
# Install Python app
pip install -r requirements.txt
python app.py- Download latest release
 - Follow installation guide above
 - Configure 
config.phpandconfig.env - Run 
python app.py 
- Quick Search: Use product search for fast lookup
 - Context Menu: Right-click for quick operations
 - Double Click: View details quickly
 - Keyboard Shortcuts: Enter to save, Escape to cancel
 - Multi-select: Planned for future versions
 
- Fast API: Direct SQL queries for optimal performance
 - Efficient Pagination: Handle large datasets smoothly
 - Async Operations: Non-blocking UI operations
 - Optimized Queries: Minimized database calls
 
PS_ROOT_DIR- PrestaShop root directoryAPI_KEY- API authentication keyALLOWED_IPS- IP whitelistDB_PREFIX- Database table prefixAPI_DEBUG- Debug modeAPI_CORS_ENABLED- CORS support
API_URL- API endpoint URLAPI_KEY- Authentication key
Currently supports:
- Turkish (tr)
 - English (en)
 
Want to add more languages? Contributions welcome!
- PrestaShop 1.7+
 - PHP 7.2+
 - MySQL/MariaDB
 
- Python 3.8+
 - requests
 - python-dotenv
 - tkinter (included with Python)
 
# Future feature
api.bulk_update_products([
    {'id': 1, 'price': 29.99},
    {'id': 2, 'price': 39.99}
])// Future feature
$api->registerWebhook('order.created', 'https://yourapp.com/webhook');β If you like this project, please give it a star!
Made with β€οΈ for PrestaShop community