Skip to content

Commit

Permalink
Merge pull request #4 from iMi-digital/master
Browse files Browse the repository at this point in the history
 #2 Allow importing of the custom link
  • Loading branch information
srenon authored Feb 28, 2019
2 parents c8f7ccd + 0ecb7a6 commit 8634432
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Plugin/CatalogImportExport/Model/Import/Product.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace MagePal\LinkProduct\Plugin\CatalogImportExport\Model\Import;

/**
* @see \Magento\CatalogImportExport\Model\Import\Product::getLinkNameToId
*/
class Product
{
/**
* REMARK: needs core patch https://github.com/magento/magento2/pull/21230/commits/0846e9aed7040659e7ce3e109eb91df3f5fdfb7e.patch
*
* @param \Magento\CatalogImportExport\Model\Import\Produc $subject
* @param $result
*
* @return mixed
*/
public function afterGetLinkNameToId(\Magento\CatalogImportExport\Model\Import\Product $subject, $result)
{
$result['_accessory_'] = \MagePal\LinkProduct\Model\Product\Link::LINK_TYPE_ACCESSORY;
return $result;
}

}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ Contribution
---
Want to contribute to this extension? The quickest way is to open a [pull request on GitHub](https://help.github.com/articles/using-pull-requests).

Importing via CSV or 3rd party extensions
---

To import via CSV, you need to have the [a patch applied to the core](https://github.com/magento/magento2/pull/21230/commits/0846e9aed7040659e7ce3e109eb91df3f5fdfb7e.patch) (until merged to Magento 2).

Support
---
Expand Down
4 changes: 4 additions & 0 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@
</argument>
</arguments>
</type>
<type name="\Magento\CatalogImportExport\Model\Import\Product">
<plugin name="addLinkType"
type="\MagePal\LinkProduct\Plugin\CatalogImportExport\Model\Import\Product"/>
</type>
</config>

0 comments on commit 8634432

Please sign in to comment.