I'm trying to write a custom importer for products, as they need to take a CSV in a particular format from our customers supplier.
When it's finished it'll remove and then readd all product variations for a single product.
However I seam to be running into a bit of a wall getting Magento to accept it an run any code.
My code is based on this tutorial: http://www.blogtreat.com/how-to-import-csv-file-to-custom-module-table-in-magento-2/
The error is "The input entity code is not equal to entity adapter code."
Import.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_ImportExport:etc/import.xsd"> <entity name="catalog_product" label="Route1Import" model="KyeEtherton\RouteImport\Model\Import\RouteImport" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Basic" /> </config>
And RouteImport.php
/** * Entity type code getter. * * @return string */ public function getEntityTypeCode() { $this->logger->info("Report Entity Type Code: "); return 'catalog_product'; }
Does anyone know what it is that I'm missing?
Hi kye,
I think your di is wrong it should be:
<preference for="Magento\CatalogImportExport\Model\Import\Product" type="Vendor\Module\Model\Import\DataflowProfiles" />
Hope it helps!
Hello Arifcs,
What DI? Where would I put that code?
In your extension KyeEtherton_RouteImport, put the di.xml in etc folder.
Thanks
That's likely to be the issue, there wasn't one of them in the tutorial that I linked to. It's possible that something was missed in that as it's only about importing and not about writing modules.
I don't have a di.xml file, as there wasn't one in the tutorial, or in the Magento2.3 guide to writing modules. So I have no idea what they are. Sorry.
Also to note, this is a separate importer, I'm not trying to replace the current one.
Still not managed to have any luck on this.
If anyone can help I'm happy to pay a fee to get this fixed.
My telegram is etherkye.