diff --git a/Plugin/Helper/Import/Product.php b/Plugin/Helper/Import/Product.php new file mode 100644 index 0000000..e3c3187 --- /dev/null +++ b/Plugin/Helper/Import/Product.php @@ -0,0 +1,60 @@ +codes)) { + $this->codes = explode(',', (string)$this->config->getValue('akeneo_connector/justbetter/important_attributes')); + } + + if (!count($this->codes)) { + return [$result, $tableSuffix, $family]; + } + + $stores = $this->storeHelper->getAllStores(); + $storeCodes = []; + foreach ($stores as $local => $affectedStores) { + foreach ($affectedStores as $affectedStore) { + $storeCodes[$affectedStore['lang'] . '-' . $affectedStore['channel_code']] = [ + $affectedStore['lang'], + $affectedStore['channel_code'] + ]; + } + } + + foreach ($this->codes as $code) { + if (array_key_exists($code, $result['values'])) { + continue; + } + $result['values'][$code] = [[ + 'locale' => null, + 'scope' => null, + 'data' => null, + ]]; + + foreach ($storeCodes as $store) { + $result['values'][$code][] = [ + 'locale' => $store[0], + 'scope' => $store[1], + 'data' => null, + ]; + } + } + + return [$result, $tableSuffix, $family]; + } +} diff --git a/README.md b/README.md index 99bbb02..49b09ad 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ These features can be enabled / disabled via an extra configuration section call | Feature | Description | |--------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Important Attributes | Select attributes that should always be added to the product tables even if all are empty, this fixes cases where you bulk empty attributes and it is not reflected in Magento. | Fix Configurable Urls | Replaces the variant product url with the original url + sku to keep them unique | | Tier Prices | 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 | | Set default value for required attributes | Set a default value for required attributes if the value is missing | diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 15d1929..bc58ec4 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -46,148 +46,154 @@ - + + Select the attributes that should always be imported even if empty. + Akeneo\Connector\Model\Source\Filters\Attribute + 1 + + Magento\Config\Model\Config\Source\Yesno Replaces configurable product urls with the original url + sku. (Default no) - Magento\Config\Model\Config\Source\Yesno Map specific Akeneo attribute code with a Magento Customer group. (Default no) - Magento\Config\Model\Config\Source\Yesno Skip inserting url path when category already exist. (Default no) - Magento\Config\Model\Config\Source\Yesno Manages akeneo codes and magento entity id's. (Default: no) - Magento\Config\Model\Config\Source\Yesno Imports new products from akeneo. (Default: yes) - Magento\Config\Model\Config\Source\Yesno Map Akeneo tax class codes to Magento tax class (Default: no) - Magento\Config\Model\Config\Source\Yesno Set all products from import to active. (Default: no) - Magento\Config\Model\Config\Source\Yesno Set manage stock on product always on (Default: no) - Magento\Config\Model\Config\Source\Yesno Set stock status to "In Stock" when backorders are allowed - Magento\Config\Model\Config\Source\Yesno Format Media name from "_" to "-" - Magento\Config\Model\Config\Source\Yesno Units are retrieved and put in the eav_attribute table for metric attributes (Default: no) - 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 - Magento\Config\Model\Config\Source\Yesno Set the value on the default store for required attributes that are scopable or localizable. (Default no) - - Magento\Config\Model\Config\Source\Yesno - Authentication token bearing required scopes. This token is required to authorize this app to send Slack messages. - Set your bot's user name. This is the name that will be displayed at the Slack messages. - Channel, private group, user or IM channel to send message to. Channels always start with #. Could be an encoded ID, or a name. - Slack api url. - - Magento\Config\Model\Config\Source\Yesno - Enter your email where you want to receive notifications about akeneo imports. - - - + + + +