diff --git a/Plugin/Job/Product.php b/Plugin/Job/Product.php new file mode 100644 index 0000000..1fb2259 --- /dev/null +++ b/Plugin/Job/Product.php @@ -0,0 +1,36 @@ +scopeConfig->getValue(self::PRODUCTS_FILTERS_EXCLUDED_FAMILIES); + } + + public function afterGetFamiliesToImport( + AkeneoProduct $subject, + array $families + ): array { + $familiesToExclude = explode(',', $this->getFamiliesToExport()); + + if (!$families || $families[0] === '') { + $families = array_values($this->familyFilter->getFamilies() ?? []); + } + + return array_diff($families, $familiesToExclude); + } +} \ No newline at end of file diff --git a/README.md b/README.md index f1bd037..5519505 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ These features can be enabled / disabled via an extra configuration section call | Unset Website when empty Product Attribute Mapping | When enabled this will unset the website from the product when a required attribute has no specific value. For example when the Name attribute in Akeneo is empty for the associated website | | Slack Akeneo import notifications | Setup Slack notifications of Akeneo imports | | Import finished events | Fires an event for every job that is fully finished | | +| Exclude Families from Import | Allows you to exclude specific families from being imported from Akeneo. _(Stores > Configuration > Catalog > Akeneo Connector > JustBetter Akeneo)_ | | ## Installation ``` diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 05efd4a..ad41491 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -174,6 +174,26 @@ + + + + + Akeneo\Connector\Model\Source\Filters\Family + +
+ Import Logic Explanation:
+
    +
  • "Families to exclude" is empty: Only the families selected in "Families to import" will be imported.
  • +
  • "Families to import" is empty: All families will be imported, except those selected in "Families to exclude".
  • +
  • Both selections are empty: All families will be imported.
  • +
]]> +
+ + standard + + 1 +
+
diff --git a/etc/di.xml b/etc/di.xml index 60a8d8e..1030544 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -24,6 +24,10 @@ + + + +