# ahs-qvc

QVC API integration extension for Yii2.

## Overview

This module provides integration with the QVC API for product data synchronisation within the NGauge platform. It registers itself as a Yii2 extension and hooks into the NGauge products system to expose QVC-specific product attributes.

## Requirements

- PHP >= 8.4
- Yii2 ~2.0.0
- Guzzle HTTP ~7.0

## Installation

Add the repository to your project's `composer.json`:

```json
{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://dev.azure.com/PortalPeopleUK/NGauge_Modules/_git/ahs-qvc"
        }
    ]
}
```

Then install via Composer:

```bash
composer require portalpeople/ahs-qvc
```

## Configuration

Add the module to your application params (`params.php` or `params-local.php`):

```php
'plugins' => [
    'qvc' => [
        'apiUrl' => 'https://api.qvc.com',
        'debug'  => false,
    ],
],
```

Register the module in your application config (`main.php`):

```php
'modules' => [
    'qvc' => [
        'class' => \PortalPeople\qvc\Module::class,
    ],
],
'bootstrap' => ['qvc'],
```

## Features

- **Product Attributes** – Exposes QVC-specific product attributes (`id`, `name`, `qty`, `haulierid`) via the NGauge dynamic product model system.
- **Auto-bootstrap** – Registers itself during the Yii2 bootstrap phase and attaches to the NGauge products event pipeline automatically.
- **Data Loading** – Loads and persists QVC product data alongside the core NGauge product record.

## Module Structure

```
ahs-qvc/
├── composer.json
└── src/
    ├── Module.php                      # Main module / bootstrap class
    └── models/
        └── products/
            └── Qvc.php                 # QVC product attributes model
```

## Events

| Event | Description |
|---|---|
| `products-set-data-types` | Registers `qvc` as a product data type |
| `products-after-DataLoad-qvc` | Returns the `Qvc` model class for data loading |

## Support

- **Issues**: https://dev.azure.com/PortalPeopleUK/NGauge_Modules/_workitems
- **Source**: https://dev.azure.com/PortalPeopleUK/NGauge_Modules/_git/ahs-qvc

## License

MIT © [Portal People](https://www.PortalPeople.uk)
