# NGauge Magento Module

Magento integration module for the NGauge/Yii2 stack. The module provides a Magento REST client, order import workflow, and a backend configuration screen for store credentials and sync settings.

## Requirements

- PHP 8.4+
- Yii2 ~2.0
- Guzzle 7

## Install

```bash
cd NGauge_modules/ngauge-magento
composer install
```

## Configuration

The module reads its settings from `Yii::$app->params['plugins']['magento']` and writes local values to `backend/config/params-local.php`.

Use `backend/config/params-local.php.template` as the starting point for local environment values.

Key settings:

- `enabled` - enable or disable the integration
- `apiUrl` - Magento base URL
- `accessToken` - Magento integration token
- `adminUsername` / `adminPassword` - optional admin credentials
- `storeCode` - Magento store code
- `debug` - enable debug logging
- `useQueue` - queue-based import toggle
- `timeout` - HTTP timeout in seconds
- `productSyncFields` - monitored product fields

## Routes

- `/magento/config` - configuration page
- `/magento/orders` - orders UI
- `/magento/default/*` - module actions

## Files

- `src/Module.php` - module bootstrap and config loading
- `src/controllers/ConfigController.php` - config page controller
- `src/controllers/OrdersController.php` - orders UI controller
- `src/services/MagentoClient.php` - Magento REST client
- `src/jobs/ImportMagentoOrderJob.php` - queued order import job

## Development Notes

- `backend/config/params-local.php` is ignored by git and should stay environment-specific.
- `backend/config/params-local.php.template` is committed as a safe starter file.

## License

Proprietary.
