diff --git a/Model/Setup/SubProcessor/TaxSubProcessor.php b/Model/Setup/SubProcessor/TaxSubProcessor.php index 74e5833..3206599 100644 --- a/Model/Setup/SubProcessor/TaxSubProcessor.php +++ b/Model/Setup/SubProcessor/TaxSubProcessor.php @@ -14,6 +14,7 @@ use Magento\Store\Model\StoreManagerInterface; use Magento\Tax\Api\Data\TaxRuleInterfaceFactory; use Magento\Tax\Api\TaxRuleRepositoryInterface; +use Magento\Eav\Setup\EavSetup; /** * Class TaxSubProcessor @@ -68,14 +69,21 @@ class TaxSubProcessor extends AbstractSubProcessor private $magesetupConfig; /** - * @param WriterInterface $configWriter + * @var \Magento\Eav\Setup\EavSetup + */ + protected $eavSetup; + + /** + * TaxSubProcessor constructor. + * @param WriterInterface $configWriter * @param \Magento\Framework\App\ResourceConnection $resource - * @param StoreManagerInterface $storeManager - * @param TaxRuleRepositoryInterface $ruleService - * @param TaxRuleInterfaceFactory $taxRuleDataObjectFactory - * @param ProductCollectionFactory $productCollectionFactory - * @param CustomerGroupCollectionFactory $customerGroupCollectionFactory - * @param \FireGento\MageSetup\Model\System\Config $magesetupConfig + * @param StoreManagerInterface $storeManager + * @param TaxRuleRepositoryInterface $ruleService + * @param TaxRuleInterfaceFactory $taxRuleDataObjectFactory + * @param ProductCollectionFactory $productCollectionFactory + * @param CustomerGroupCollectionFactory $customerGroupCollectionFactory + * @param \FireGento\MageSetup\Model\System\Config $magesetupConfig + * @param \Magento\Eav\Setup\EavSetup $eavSetup */ public function __construct( WriterInterface $configWriter, @@ -85,8 +93,10 @@ public function __construct( TaxRuleInterfaceFactory $taxRuleDataObjectFactory, ProductCollectionFactory $productCollectionFactory, CustomerGroupCollectionFactory $customerGroupCollectionFactory, - \FireGento\MageSetup\Model\System\Config $magesetupConfig + \FireGento\MageSetup\Model\System\Config $magesetupConfig, + EavSetup $eavSetup ) { + $this->eavSetup = $eavSetup; $this->resource = $resource; $this->connection = $resource->getConnection('write'); $this->storeManager = $storeManager; @@ -262,11 +272,8 @@ private function saveTaxClassRelations($taxClasses) $productCollection = $this->productCollectionFactory->create()->addAttributeToSelect('url_key'); foreach ($productCollection as $product) { /** @var Product $product */ - - $product->setData('tax_class_id', $productTaxClassId); - try { - $product->save(); + $this->eavSetup->updateAttribute(4, $product->getId(), 'tax_class_id', $productTaxClassId, null); } catch (\Exception $e) { echo __('Error by product with sku "' . $product->getSku() . '": ' . $e->getMessage() . "\n"); } diff --git a/Plugin/Email/Model/Source/Variables.php b/Plugin/Email/Model/Source/Variables.php index f84151c..a7513c1 100644 --- a/Plugin/Email/Model/Source/Variables.php +++ b/Plugin/Email/Model/Source/Variables.php @@ -2,9 +2,10 @@ /** * Copyright © 2016 FireGento e.V. * See LICENSE.md bundled with this module for license details. + * + * Can be removed after Magento 2.2 EOL */ namespace FireGento\MageSetup\Plugin\Email\Model\Source; - /** * Class Variables * @@ -18,7 +19,6 @@ class Variables * @var array */ private $additionalConfigVariables = []; - /** * Constructor */ @@ -78,7 +78,6 @@ public function __construct() ['value' => 'general/imprint/clearing', 'label' => __('Clearing')], ]; } - /** * Returns additional config config variables * @@ -88,7 +87,6 @@ public function getAdditionalConfigVariables() { return $this->additionalConfigVariables; } - /** * Return available config variables * @@ -102,4 +100,4 @@ public function afterGetData(\Magento\Email\Model\Source\Variables $subject, $re { return array_merge($result, $this->getAdditionalConfigVariables()); } -} +} \ No newline at end of file diff --git a/README.md b/README.md index 8014c1e..1ac00ac 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,8 @@ Missing your country? Please open a pull request with the necessary configuratio Requirements ------------ -- PHP >= 5.6 -- Magento >= 2.0.12 +- PHP >= 7.1 +- Magento >= 2.2.* Installation ------------ @@ -33,8 +33,7 @@ Installation Please go to the Magento2 root directory and run the following commands in the shell: ``` -composer config repositories.firegento_magesetup vcs git@github.com:firegento/firegento-magesetup2.git -composer require firegento/magesetup2:dev-develop +composer require firegento/magesetup2 bin/magento module:enable FireGento_MageSetup bin/magento setup:upgrade bin/magento magesetup:setup:run @@ -65,6 +64,12 @@ FireGento Team * Website: [http://firegento.com](http://firegento.com) * Twitter: [@firegento](https://twitter.com/firegento) +Maintainer +---------- +* @sprankhub +* @frostblogNet +* @Schrank + Licence ------- [GNU General Public License, version 3 (GPLv3)](http://opensource.org/licenses/gpl-3.0) diff --git a/composer.json b/composer.json index e22915d..0550f6f 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "firegento/magesetup2", "description": "MageSetup provides the necessary configuration (system config, tax, agreements, etc. for a national market.", "require": { - "php": "~5.5.0|~5.6.0|~7.0.0|~7.1.0|~7.2.0", + "php": "~7.1.0|~7.2.0", "magento/module-store": "*", "magento/module-backend": "*", "magento/framework": "*" diff --git a/etc/di.xml b/etc/di.xml index eb87397..04dd796 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -48,12 +48,56 @@ + + + + + - - + + + + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + +