diff --git a/Console/Command/SetNotVisible.php b/Console/Command/SetNotVisible.php
new file mode 100644
index 0000000..ab7f4e2
--- /dev/null
+++ b/Console/Command/SetNotVisible.php
@@ -0,0 +1,37 @@
+job = $job;
+
+ parent::__construct($name);
+ }
+
+ protected function configure(): void
+ {
+ $this->setName('set:notvisible');
+ $this->setDescription('Set recently updated products to not visible');
+
+ parent::configure();
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output): void
+ {
+ $output->writeln('Starting');
+
+ $this->job->execute($output);
+
+ $output->writeln('Finished!');
+ }
+}
diff --git a/Data/FamilyOptions.php b/Data/FamilyOptions.php
new file mode 100644
index 0000000..23d1506
--- /dev/null
+++ b/Data/FamilyOptions.php
@@ -0,0 +1,27 @@
+collectionFactory = $collectionFactory;
+ }
+
+ public function toOptionArray(): array
+ {
+ return array_map(function ($set) {
+ return [
+ 'value' => $set->getData('attribute_set_id'),
+ 'label' => $set->getData('attribute_set_name')
+ ];
+ }, $this->collectionFactory->create()->getItems());
+ }
+}
\ No newline at end of file
diff --git a/Job/SetNotVisible.php b/Job/SetNotVisible.php
new file mode 100644
index 0000000..4c4e02b
--- /dev/null
+++ b/Job/SetNotVisible.php
@@ -0,0 +1,64 @@
+collectionFactory = $collectionFactory;
+ $this->config = $config;
+ $this->action = $action;
+ }
+
+ public function execute(OutputInterface $output = null): void
+ {
+ $products = $this->collectionFactory->create()
+ ->addFieldToFilter('attribute_set_id', ['in' => $this->getNotVisibleFamilies()])
+ ->addFieldToFilter('visibility', ['neq' => '1'])
+ ->getItems();
+
+ if (count($products) == 0) {
+ if ($output) {
+ $output->writeln('No updates necessary');
+ }
+ return;
+ }
+
+ if ($output) {
+ $output->writeln('Found ' . count($products) . ' products that should have visibility set to not visible individually');
+ }
+
+ $entityIds = array_map(function ($p) {
+ return $p->getEntityId();
+ }, $products);
+
+ $this->action->updateAttributes($entityIds, ['visibility' => '1'], 0);
+ }
+
+ protected function getNotVisibleFamilies(): array
+ {
+ return explode(
+ ',',
+ $this->config->getValue(static::CONFIG_PREFIX . static::NOT_VISIBLE_CONFIG_KEY)
+ );
+ }
+}
diff --git a/Observer/SetNotVisible.php b/Observer/SetNotVisible.php
new file mode 100644
index 0000000..186303b
--- /dev/null
+++ b/Observer/SetNotVisible.php
@@ -0,0 +1,22 @@
+job = $job;
+ }
+
+ public function execute(Observer $observer): void
+ {
+ $this->job->execute();
+ }
+}
diff --git a/README.md b/README.md
index 982bf90..590d9aa 100644
--- a/README.md
+++ b/README.md
@@ -15,9 +15,10 @@ The following features are included in the JustBetter Akeneo Bundle extension:
| MailNotificationCommand | Adds the possibility to receive e-mail notifications about akeneo imports. |
| AkeneoManager | Manual adjustment of akeneo codes vs magento entity id’s connector mapping. |
| SetTierPrices | Maps specific Akeneo attribute code with a Magento Customer group. This ensures that the tier prices from Akeneo are imported into Magento customer tier prices |
-| SetTaxClass | Map When you have multiple tax classes in Akeneo and want to use them in Magento. Akeneo tax class codes to Magento tax class - See confguration
-| ImportFinished | Fires an event for every job that is fully finished.
-| Metric Units | Sets Akeneo's metric unit in the eav_attribute
+| SetTaxClass | Map When you have multiple tax classes in Akeneo and want to use them in Magento. Akeneo tax class codes to Magento tax class - See confguration |
+| ImportFinished | Fires an event for every job that is fully finished. |
+| Metric Units | Sets Akeneo's metric unit in the eav_attribute |
+| Family - Not Visible Individually | Sets products in selected families to Not Visible Individually |
## Installation
- `composer require justbetter/magento2-akeneo-bundle`
@@ -50,6 +51,12 @@ You can run this from the command line using `bin/magento metric:import`
It is also automatically run after the attribute import
+## Family - Not Visible Individually
+If you need all products of a certain families to be set to not visible individually you can select those families.
+After each import this will run and set products to not visible.
+
+You can also run this from the command line using `bin/magento set:notvisible`
+
## Ideas, bugs or suggestions?
Would be awesome if you can submit an [issue](https://github.com/justbetter/magento2-akeneo-bundle/issues) or for kudos create a [pull request](https://github.com/justbetter/magento2-akeneo-bundle/pulls).
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index ddbcd73..b8f9214 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -99,7 +99,13 @@
What channel to use for metric conversions
-
+
+ JustBetter\AkeneoBundle\Data\FamilyOptions
+ When a family is selected here all of the products will get the status not visible individually
+
+ JustBetter\AkeneoBundle\Console\Command\ImportMetricUnits
+
+ JustBetter\AkeneoBundle\Console\Command\SetNotVisible
+
diff --git a/etc/events.xml b/etc/events.xml
index 484ca30..44053f3 100644
--- a/etc/events.xml
+++ b/etc/events.xml
@@ -2,4 +2,7 @@
+
+
+
\ No newline at end of file