Developer notes
Technical reference for developers who customize PcComponentes Marketplace Connector (Mirakl).
Add-on identity
Section titled “Add-on identity”| Item | Value |
|---|---|
| Add-on id | kv_pccomponentes |
| Function prefix | fn_kv_pccomponentes_ |
| Language variables | kv_pccomponentes.* |
| CSS scope | .kv-pccomponentes |
| PHP namespace | Tygh\Addons\KvPccomponentes |
| Preset | marketplace (generated by kv new --kind integration --class marketplace) |
Structure
Section titled “Structure”| Class | Role |
|---|---|
Client\BaseClient |
HTTP (cURL, TLS verification, timeouts), JSON, error mapping, masked logging |
Client\Api |
The Mirakl Seller API calls, one method per operation (operation ids in the comments), API key in the Authorization header, multipart upload for the import files, API URL check |
Drivers\Mirakl\Driver |
The Mirakl engine: implements Hub\DriverInterface (offers, stock, price, orders, shipping, returns) without naming an operator |
Drivers\Mirakl\Mapper |
Pure translation hub arrays <-> Mirakl fields (import files, error reports, orders, returns); unit tested with the OpenAPI examples |
Drivers\Mirakl\OperatorConfig |
Reads the operator file; OPERATOR names it |
Drivers\Mirakl\Operators\PcComponentes |
Everything specific to PcComponentes: markets and currencies, product id type, import style, “new” label, limits |
Hub\* |
The channel independent Marketplace Hub layer (mapping, price rules, stock buffer, sync, order import, statuses, shipments, returns) |
Accounts, Secret |
Credentials (test and live) sealed with AES-256-GCM; one account per store owner or per vendor. For Mirakl the account “id” is the API URL and the “secret” the API key |
Config, Access |
Settings, owner mode, who may see and manage what |
Queue, Jobs, JobException |
Job queue: back-off 5 min / 15 min / 1 h / 3 h / 12 h, per-job isolation, overlap lock |
Log |
Event log with masking, filters, CSV, retention |
Another Mirakl marketplace from the same engine
Section titled “Another Mirakl marketplace from the same engine”A marketplace on Mirakl (PcComponentes, Carrefour, Leroy Merlin, Decathlon and others) differs in a handful of facts. To build another connector: scaffold a new add-on, copy Drivers\Mirakl, add Operators\<Name>.php returning the array described in OperatorConfig (markets, currency, product id type, import style, labels, limits), set OperatorConfig::OPERATOR, and adjust the names and texts of the product. The API URL and key are always entered by the seller.
Database tables
Section titled “Database tables”| Table | Purpose |
|---|---|
?:kv_pccomponentes_accounts |
Credentials per company (secrets sealed), last connection check |
?:kv_pccomponentes_log |
Log |
?:kv_pccomponentes_jobs |
Queue |
?:kv_pccomponentes_product_map, ?:kv_pccomponentes_order_map, ?:kv_pccomponentes_category_map, ?:kv_pccomponentes_attr_map |
Product, order, category and offer field mapping |
?:kv_pccomponentes_returns, ?:kv_pccomponentes_options, ?:kv_pccomponentes_cache, ?:kv_pccomponentes_batches |
Returns, rules, reference data cache, import batches |
Hooks used
Section titled “Hooks used”See init.php (product save marks the mapping dirty, order status hooks) and the template hooks in design/backend/templates/addons/kv_pccomponentes/hooks/ (add-on settings page).
Test without the marketplace
Section titled “Test without the marketplace”The base URL can be overridden for tests in config.local.php (development only):
$config['kv_pccomponentes_base_url'] = 'http://127.0.0.1:11891';node tests/openapi/build-subset.mjs <openapi3.json>buildstests/openapi/mirakl-subset.jsonfrom the official Mirakl Seller OpenAPI file.php tests/unit.phpandphp tests/unit_mirakl.phprun the unit tests; the second records every request andnode tests/openapi/check.mjsvalidates them against the OpenAPI file.node tests/mock-server/server.js 11891starts a local Mirakl stand-in that validates every request against the same file;node tests/e2e/e2e.mjsruns the HTTP end-to-end test against it.
Template overrides
Section titled “Template overrides”Admin templates live in design/backend/templates/addons/kv_pccomponentes/. Do not edit them in a store; they are replaced on update.