For developers

Supplier imports (Sourcing module)

  • Tables:
    • supplier_feeds: source url | upload; url encrypted; file_path on the local disk; format; options (delimiter, item, path); mapping (Data\FeedField => column); attributes ({source, attribute_id}); rules (create, vat, update_cost, update_price, markup, rounding); schedule.
    • supplier_feed_dictionary: kind category | brand | value; attribute_id 0 unless value; source_value; target_id; ignored; seen.
    • supplier_products: feed, supplier_sku, variant_id, cost in the supplier's minor units and currency, supplier_stock, created_by_feed, last_seen_at.
    • supplier_feed_runs: status, counts, skipped reasons and examples, error.
  • Feeds\FeedFetcher:
    • HTTPS only, through Platform\Webhooks\SafeUrl, connecting to the checked address (CURLOPT_RESOLVE);
    • no redirects; a size limit while downloading (200 MB feeds, 10 MB images); to a temporary file.
  • Feeds\FeedReader flattens each product to column => text:
    • CSV: delimiter sniffed, BOM and Windows-1250 handled;
    • XML: streamed with XMLReader, LIBXML_NONET, no entity substitution; nested a/b, attributes @x, repeats joined with |;
    • JSON: up to 50 MB, list at a dotted path.
  • Actions\RunFeed:
    • Rows go in chunks of 200, matched by link, SKU, then GTIN (VariantDirectory::variantsByGtin()).
    • Existing variants get only cost (Inventory\Contracts\Costs::setManual(), RON via ExchangeRates::convert()) and price (CatalogImport::price(), rules permitting).
    • New ones are drafts through CatalogImport::product() (active: false), specifications() and image().
    • Dictionary words are matched on first sight through Catalog\Contracts\Taxonomy (brandNamed(), valueNamed(), unaccented) and CatalogBrowser::categoryOptions().
    • Descriptions lose script/style blocks and tags.
    • A failure records InvalidArgumentException messages; anything else is reported and shown generically.
  • Jobs\RunFeedJob (unique per feed), sourcing:run (hourly at :15, queues due feeds), Inventory\Contracts\Suppliers for the supplier list and currency.
  • Admin: SupplierFeedController (admin.sourcing.*, tabs, sample, run), DictionaryController, permission supplier_feeds.manage.

Tests: tests/Feature/Sourcing/SupplierFeedsTest.php.