Skip to content

Commit

Permalink
Merge pull request #138 from firegento/develop
Browse files Browse the repository at this point in the history
develop
  • Loading branch information
frostblogNet authored Jul 20, 2019
2 parents 1d5f13e + 1a68179 commit 5201916
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 24 deletions.
31 changes: 19 additions & 12 deletions Model/Setup/SubProcessor/TaxSubProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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");
}
Expand Down
8 changes: 3 additions & 5 deletions Plugin/Email/Model/Source/Variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -18,7 +19,6 @@ class Variables
* @var array
*/
private $additionalConfigVariables = [];

/**
* Constructor
*/
Expand Down Expand Up @@ -78,7 +78,6 @@ public function __construct()
['value' => 'general/imprint/clearing', 'label' => __('Clearing')],
];
}

/**
* Returns additional config config variables
*
Expand All @@ -88,7 +87,6 @@ public function getAdditionalConfigVariables()
{
return $this->additionalConfigVariables;
}

/**
* Return available config variables
*
Expand All @@ -102,4 +100,4 @@ public function afterGetData(\Magento\Email\Model\Source\Variables $subject, $re
{
return array_merge($result, $this->getAdditionalConfigVariables());
}
}
}
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------
Expand All @@ -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 [email protected]: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 <countrycode>
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*"
Expand Down
48 changes: 46 additions & 2 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,56 @@
<plugin name="mageSetupProductDetailsHtml" type="FireGento\MageSetup\Plugin\Catalog\ListProductPlugin" sortOrder="1" />
</type>

<type name="Magento\Email\Block\Adminhtml\Template\Edit\Form">
<plugin name="mageSetupEmailAdminhtmlTemplateEditForm" type="FireGento\MageSetup\Plugin\Email\Block\Adminhtml\Template\Edit\Form"/>
</type>

<!-- Can be removed after M2.2 EOL-->
<type name="Magento\Email\Model\Source\Variables">
<plugin name="mageSetupEmailSourceVariables" type="FireGento\MageSetup\Plugin\Email\Model\Source\Variables"/>
</type>

<type name="Magento\Email\Block\Adminhtml\Template\Edit\Form">
<plugin name="mageSetupEmailAdminhtmlTemplateEditForm" type="FireGento\MageSetup\Plugin\Email\Block\Adminhtml\Template\Edit\Form"/>
<!-- Email variables for versions >= M2.3.0-->
<type name="Magento\Variable\Model\Source\Variables">
<arguments>
<argument name="configPaths" xsi:type="array">
<item name="general/imprint" xsi:type="array">
<item name="general/imprint/shop_name" xsi:type="string">1</item>
<item name="general/imprint/company_first" xsi:type="string">1</item>
<item name="general/imprint/company_second" xsi:type="string">1</item>
<item name="general/imprint/street" xsi:type="string">1</item>
<item name="general/imprint/zip" xsi:type="string">1</item>
<item name="general/imprint/city" xsi:type="string">1</item>
<item name="general/imprint/country" xsi:type="string">1</item>
<item name="general/imprint/telephone" xsi:type="string">1</item>
<item name="general/imprint/telephone_additional" xsi:type="string">1</item>
<item name="general/imprint/fax" xsi:type="string">1</item>
<item name="general/imprint/email" xsi:type="string">1</item>
<item name="general/imprint/web" xsi:type="string">1</item>
<item name="general/imprint/tax_number" xsi:type="string">1</item>
<item name="general/imprint/vat_id" xsi:type="string">1</item>
<item name="general/imprint/court" xsi:type="string">1</item>
<item name="general/imprint/financial_office" xsi:type="string">1</item>
<item name="general/imprint/ceo" xsi:type="string">1</item>
<item name="general/imprint/owner" xsi:type="string">1</item>
<item name="general/imprint/content_responsable_name" xsi:type="string">1</item>
<item name="general/imprint/content_responsable_address" xsi:type="string">1</item>
<item name="general/imprint/content_responsable_press_law" xsi:type="string">1</item>
<item name="general/imprint/register_number" xsi:type="string">1</item>
<item name="general/imprint/business_rules" xsi:type="string">1</item>
<item name="general/imprint/authority" xsi:type="string">1</item>
<item name="general/imprint/shareholdings" xsi:type="string">1</item>
<item name="general/imprint/editorial_concept" xsi:type="string">1</item>
<item name="general/imprint/bank_account_owner" xsi:type="string">1</item>
<item name="general/imprint/bank_account" xsi:type="string">1</item>
<item name="general/imprint/bank_code_number" xsi:type="string">1</item>
<item name="general/imprint/bank_name" xsi:type="string">1</item>
<item name="general/imprint/swift" xsi:type="string">1</item>
<item name="general/imprint/iban" xsi:type="string">1</item>
<item name="general/imprint/clearing" xsi:type="string">1</item>
</item>
</argument>
</arguments>
</type>

</config>

0 comments on commit 5201916

Please sign in to comment.