For arlanix/product-feed 1.0.0
Extend the module
This page is for the PHP developer who needs a feed to do something the admin cannot set up: a platform the module does not know, a value worked out by your own code, a file format or a destination of your own. Each extension point is a di.xml item or an XML file in a module of yours; nothing in the Arlanix modules is edited.
Where each one runs
A feed's rows go through these steps, in this order:
- Row transformers change, leave out or split the built product rows. See Row transformers.
- The mapping fills each field of a row from its source: an attribute, a resolver or a template.
- A dictionary, when the row names one, translates the value.
- Modifiers change the value on its way out.
- A writer writes the rows as a file, for a channel that publishes a file.
- A channel delivers the file, or sends the rows one by one.
The field catalog of the feed's type sits beside all of this: it gives Copy from the platform's fields and their defaults, and checks the rows for the platform's limits.
Choose an extension point
| You want | Use | Page |
|---|---|---|
| A platform the module does not list, or a change to a field of one it does | A field catalog in etc/feed_catalog.xml |
Field catalogs |
| A value no attribute holds, worked out per product | A resolver, in ResolverPool |
Resolvers |
| A change to a value that a modifier chip can apply on any row | A modifier, in ModifierPool |
Modifiers |
| A file format other than CSV, TSV, XML, JSON and JSON Lines | A writer, in WriterPool |
Writers |
| A destination other than the store and SFTP, or a platform API | A channel, in ChannelPool |
Channels |
| One row per pack size, a price from your ERP, a product one market must not see | A row transformer, in RowTransformerPool |
Row transformers |
What every extension point has in common
Your module declares the Arlanix module it extends in its etc/module.xml, so its di.xml and feed_catalog.xml are read after the Arlanix ones:
<module name="Vendor_Module">
<sequence>
<module name="Arlanix_Feed"/>
</sequence>
</module>
ResolverPool, ChannelPool, RowTransformerPool and etc/feed_catalog.xml belong to Arlanix_Feed; WriterPool and ModifierPool belong to Arlanix_Core, which Arlanix_Feed depends on.
Each pool takes its members by name in di.xml. The name is what a feed stores: the alias of a resolver, the name of a modifier, the alias of a format or the type of a channel. Keep it once a store uses it: a feed that names something no installed module registers stops with a message that names it.
A pool refuses an item that does not implement its interface when it is built, at the first request that uses it, with a message that names the item and the interface it has to implement. ChannelPool is the exception: an item whose channel is not a ChannelInterface counts as no channel at all, and its feeds are skipped with no installed module provides its channel.
After adding or changing an item, run the following in the Magento root:
bin/magento setup:upgrade
bin/magento cache:clean config
In production mode, also run bin/magento setup:di:compile.