Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function install(array $fixtures)
 {
     $this->configWriter->save('sales/msrp/enabled', 1);
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $row = $data;
             $productId = $this->getProductIdBySku($row['sku']);
             if (!$productId) {
                 continue;
             }
             /** @var \Magento\Catalog\Model\Product $product */
             $product = $this->productCollection->getItemById($productId);
             $product->setMsrpDisplayActualPriceType(Type::TYPE_ON_GESTURE);
             if (!empty($row['msrp'])) {
                 $price = $row['msrp'];
             } else {
                 $price = $product->getPrice() * 1.1;
             }
             $product->setMsrp($price);
             $product->save();
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->logger->log('Installing MAP:');
     $this->configWriter->save('sales/msrp/enabled', 1);
     $fixtureFile = 'Msrp/products_msrp.csv';
     $fixtureFilePath = $this->fixtureHelper->getPath($fixtureFile);
     /** @var \Magento\SampleData\Helper\Csv\Reader $csvReader */
     $csvReader = $this->csvReaderFactory->create(['fileName' => $fixtureFilePath, 'mode' => 'r']);
     foreach ($csvReader as $row) {
         $productId = $this->getProductIdBySku($row['sku']);
         if (!$productId) {
             continue;
         }
         /** @var \Magento\Catalog\Model\Product $product */
         $product = $this->productCollection->getItemById($productId);
         $product->setMsrpDisplayActualPriceType(\Magento\Msrp\Model\Product\Attribute\Source\Type::TYPE_ON_GESTURE);
         if (!empty($row['msrp'])) {
             $price = $row['msrp'];
         } else {
             $price = $product->getPrice() * 1.1;
         }
         $product->setMsrp($price);
         $product->save();
         $this->logger->logInline('.');
     }
 }
Пример #3
0
 public function aroundSave(\Magento\Config\Model\config $config, \Closure $proceed)
 {
     $ret = $proceed();
     $sectionId = $config->getSection();
     if ($sectionId == 'autoresponder' && !$this->_objectManager->create('\\Ebizmarts\\Mandrill\\Helper\\Data')->isActive($config->getStore())) {
         $this->_writer->save(\Ebizmarts\AutoResponder\Model\Config::ACTIVE, 0, $config->getScope(), $config->getScopeId());
     }
     return $ret;
 }
Пример #4
0
 /**
  * Delete custom admin url from configuration if "Use Custom Admin Url" option disabled
  *
  * @return $this
  */
 public function afterSave()
 {
     $value = $this->getValue();
     if (!$value) {
         $this->_configWriter->delete(Custom::XML_PATH_SECURE_BASE_URL, Custom::CONFIG_SCOPE, Custom::CONFIG_SCOPE_ID);
         $this->_configWriter->delete(Custom::XML_PATH_UNSECURE_BASE_URL, Custom::CONFIG_SCOPE, Custom::CONFIG_SCOPE_ID);
     }
     return $this;
 }
Пример #5
0
 /**
  * Change secure/unsecure base_url after use_custom_url was modified
  *
  * @return $this
  */
 public function afterSave()
 {
     $useCustomUrl = $this->getData('groups/url/fields/use_custom/value');
     $value = $this->getValue();
     if ($useCustomUrl == 1 && empty($value)) {
         return $this;
     }
     if ($useCustomUrl == 1) {
         $this->_configWriter->save(self::XML_PATH_SECURE_BASE_URL, $value, self::CONFIG_SCOPE, self::CONFIG_SCOPE_ID);
         $this->_configWriter->save(self::XML_PATH_UNSECURE_BASE_URL, $value, self::CONFIG_SCOPE, self::CONFIG_SCOPE_ID);
     }
     return $this;
 }
Пример #6
0
 public function aroundSave(\Magento\Config\Model\Config $config, \Closure $proceed)
 {
     $ret = $proceed();
     $sectionId = $config->getSection();
     if ($sectionId == 'mandrill' && !$config->getConfigDataValue('mandrill/general/active')) {
         $modules = $this->_loader->load();
         if (isset($modules['Ebizmarts_AbandonedCart'])) {
             $this->_writer->save(\Ebizmarts\AbandonedCart\Model\Config::ACTIVE, 0, $config->getScope(), $config->getScopeId());
         }
         if (isset($modules['Ebizmarts_AutoResponder'])) {
             $this->_writer->save(\Ebizmarts\AutoResponder\Model\Config::ACTIVE, 0, $config->getScope(), $config->getScopeId());
         }
     }
     return $ret;
 }
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->logger->log('Installing Tablerate:');
     /** @var \Magento\Framework\DB\Adapter\AdapterInterface $connection */
     $connection = $this->resource->getConnection('core');
     $fixtureFile = 'OfflineShipping/tablerate.csv';
     $fixtureFilePath = $this->fixtureHelper->getPath($fixtureFile);
     $regions = $this->loadDirectoryRegions();
     /** @var \Magento\SampleData\Helper\Csv\Reader $csvReader */
     $csvReader = $this->csvReaderFactory->create(['fileName' => $fixtureFilePath, 'mode' => 'r']);
     foreach ($csvReader as $data) {
         $regionId = $data['region'] != '*' ? $regions[$data['country']][$data['region']] : 0;
         try {
             $connection->insert($this->tablerate->getMainTable(), ['website_id' => $this->storeManager->getWebsiteId(), 'dest_country_id' => $data['country'], 'dest_region_id' => $regionId, 'dest_zip' => $data['zip'], 'condition_name' => 'package_value', 'condition_value' => $data['order_subtotal'], 'price' => $data['price'], 'cost' => 0]);
         } catch (\Zend_Db_Statement_Exception $e) {
             if ($e->getCode() == self::ERROR_CODE_DUPLICATE_ENTRY) {
                 // In case if Sample data was already installed we just skip duplicated records installation
                 continue;
             } else {
                 throw $e;
             }
         }
         $this->logger->logInline('.');
     }
     $this->configWriter->save('carriers/tablerate/active', 1);
     $this->configWriter->save('carriers/tablerate/condition_name', 'package_value');
     $this->cacheTypeList->cleanType('config');
 }
Пример #8
0
 public function add($contentFile, $cssFile)
 {
     $styleContent = preg_replace('/^\\/\\*[\\s\\S]+\\*\\//', '', file_get_contents($contentFile));
     if (empty($styleContent)) {
         return;
     }
     $mediaDir = $this->directoryList->getPath(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA);
     file_put_contents("{$mediaDir}/{$cssFile}", $styleContent, FILE_APPEND);
     $linkText = sprintf('<link  rel="stylesheet" type="text/css"  media="all" href="{{MEDIA_URL}}%s" />', $cssFile);
     $miscScriptsNode = 'design/head/includes';
     $miscScripts = $this->scopeConfig->getValue($miscScriptsNode);
     if (!$miscScripts || strpos($miscScripts, $linkText) === false) {
         $this->configWriter->save($miscScriptsNode, $miscScripts . $linkText);
         $this->configCacheType->clean();
     }
 }
Пример #9
0
 /**
  * {@inheritdoc}
  */
 public function install(array $fixtures)
 {
     /** @var \Magento\Framework\DB\Adapter\AdapterInterface $adapter */
     $adapter = $this->resource->getConnection('core_write');
     $regions = $this->loadDirectoryRegions();
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $regionId = $data['region'] != '*' ? $regions[$data['country']][$data['region']] : 0;
             try {
                 $adapter->insert($this->tablerate->getMainTable(), ['website_id' => $this->storeManager->getWebsite()->getId(), 'dest_country_id' => $data['country'], 'dest_region_id' => $regionId, 'dest_zip' => $data['zip'], 'condition_name' => 'package_value', 'condition_value' => $data['order_subtotal'], 'price' => $data['price'], 'cost' => 0]);
             } catch (\Zend_Db_Statement_Exception $e) {
                 if ($e->getCode() == self::ERROR_CODE_DUPLICATE_ENTRY) {
                     // In case if Sample data was already installed we just skip duplicated records installation
                     continue;
                 } else {
                     throw $e;
                 }
             }
         }
     }
     $this->configWriter->save('carriers/tablerate/active', 1);
     $this->configWriter->save('carriers/tablerate/condition_name', 'package_value');
     $this->cacheTypeList->cleanType('config');
 }
Пример #10
0
 /**
  * Assign theme to default scope
  *
  * @param string $themeId
  * @param bool &$isReassigned
  * @return $this
  */
 protected function _assignThemeToDefaultScope($themeId, &$isReassigned)
 {
     $configPath = \Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID;
     $this->_configWriter->save($configPath, $themeId, \Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT);
     $isReassigned = true;
     return $this;
 }
Пример #11
0
 /**
  * Add Link to Head
  *
  * @return void
  */
 protected function addHeadInclude()
 {
     $styleContent = '';
     foreach ($this->moduleList->getNames() as $moduleName) {
         $fileName = substr($moduleName, strpos($moduleName, "_") + 1) . '/styles.css';
         $fileName = $this->fixtureHelper->getPath($fileName);
         if (!$fileName) {
             continue;
         }
         $style = file_get_contents($fileName);
         $styleContent .= preg_replace('/^\\/\\*[\\s\\S]+\\*\\//', '', $style);
     }
     if (empty($styleContent)) {
         return;
     }
     $mediaDir = $this->directoryList->getPath(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA);
     file_put_contents("{$mediaDir}/styles.css", $styleContent);
     $linkTemplate = '<link  rel="stylesheet" type="text/css"  media="all" href="%sstyles.css" />';
     $baseUrl = $this->baseUrl->getBaseUrl(['_type' => \Magento\Framework\UrlInterface::URL_TYPE_MEDIA]);
     $linkText = sprintf($linkTemplate, $baseUrl);
     $miscScriptsNode = 'design/head/includes';
     $miscScripts = $this->scopeConfig->getValue($miscScriptsNode);
     if (!$miscScripts || strpos($miscScripts, $linkText) === false) {
         $this->configWriter->save($miscScriptsNode, $miscScripts . $linkText);
         $this->configCacheType->clean();
     }
 }
Пример #12
0
 /**
  * Replace suggested string with another one, keeping rest of config value
  *
  * Usefull to remove sample data config values and strings, keeping the rest
  * value
  *
  * @param  array $data Array of config data
  * @return void
  */
 public function execute($data)
 {
     foreach ($data as $path => $rules) {
         foreach ($this->getStoreIds() as $storeId) {
             if (!$storeId) {
                 // all stores selected
                 $readScope = \Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT;
                 $writeScope = $readScope;
             } else {
                 $readScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
                 $writeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORES;
             }
             $configValue = $this->scopeConfig->getValue($path, $readScope, $storeId);
             foreach ($rules as $search => $replace) {
                 $configValue = str_replace($search, $replace, $configValue);
             }
             $this->configWriter->save($path, $configValue, $writeScope, $storeId);
         }
     }
 }
 /**
  * Process the import
  */
 public function process()
 {
     // Find files
     $files = $this->finder->find();
     if (0 === count($files)) {
         throw new \InvalidArgumentException('No files found for format: *.' . $this->getFormat());
     }
     foreach ($files as $file) {
         $valuesSet = 0;
         $configurations = $this->getConfigurationsFromFile($file);
         foreach ($configurations as $configPath => $configValues) {
             $scopeConfigValues = $this->transformConfigToScopeConfig($configPath, $configValues);
             foreach ($scopeConfigValues as $scopeConfigValue) {
                 $this->configWriter->save($configPath, $scopeConfigValue['value'], $scopeConfigValue['scope'], $this->scopeConverter->convert($scopeConfigValue['scope_id'], $scopeConfigValue['scope']));
                 $this->getOutput()->writeln(sprintf('<comment>%s => %s</comment>', $configPath, $scopeConfigValue['value']));
                 $valuesSet++;
             }
         }
         $this->getOutput()->writeln(sprintf('<info>Processed: %s with %s value(s).</info>', $file, $valuesSet));
     }
 }
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->logger->log('Installing multiple wishlists:');
     $multipleEnabledConfig = 'wishlist/general/multiple_enabled';
     if (!$this->config->isSetFlag($multipleEnabledConfig)) {
         $this->configWriter->save($multipleEnabledConfig, 1);
         $this->configCacheType->clean();
     }
     $fixtureFiles = ['Wishlist/wishlist.csv', 'MultipleWishlist/wishlist.csv'];
     foreach ($fixtureFiles as $fixtureFile) {
         $fixtureFilePath = $this->fixtureHelper->getPath($fixtureFile);
         /** @var \Magento\SampleData\Helper\Csv\Reader $csvReader */
         $csvReader = $this->csvReaderFactory->create(['fileName' => $fixtureFilePath, 'mode' => 'r']);
         foreach ($csvReader as $row) {
             /** @var \Magento\Customer\Model\Customer $customer */
             $customer = $this->wishlistHelper->getCustomerByEmail($row['customer_email']);
             if (!$customer) {
                 continue;
             }
             $wishlistName = $row['name'];
             /** @var \Magento\Wishlist\Model\Resource\Wishlist\Collection $wishlistCollection */
             $wishlistCollection = $this->wishlistColFactory->create();
             $wishlistCollection->filterByCustomerId($customer->getId())->addFieldToFilter('name', $wishlistName);
             /** @var \Magento\Wishlist\Model\Wishlist $wishlist */
             $wishlist = $wishlistCollection->fetchItem();
             if ($wishlist) {
                 continue;
             }
             $wishlist = $this->wishlistEditor->edit($customer->getId(), $wishlistName, true);
             if (!$wishlist->getId()) {
                 continue;
             }
             $productSkuList = explode("\n", $row['product_list']);
             $this->wishlistHelper->addProductsToWishlist($wishlist, $productSkuList);
             $this->logger->logInline('.');
         }
     }
 }
Пример #15
0
 /**
  * @param InputInterface $input
  * @param \Magento\Framework\App\Config\Storage\WriterInterface $configWriter
  * @param                $path
  * @param                $scopeId
  *
  * @return array
  */
 protected function _deletePath(InputInterface $input, \Magento\Framework\App\Config\Storage\WriterInterface $configWriter, $path, $scopeId)
 {
     $deleted = array();
     if ($input->getOption('all')) {
         $storeManager = $this->getObjectManager()->get('Magento\\Store\\Model\\StoreManager');
         // Default
         $configWriter->delete($path, 'default', 0);
         $deleted[] = array('path' => $path, 'scope' => 'default', 'scopeId' => 0);
         foreach ($storeManager->getWebsites() as $website) {
             $configWriter->delete($path, 'websites', $website->getId());
             $deleted[] = array('path' => $path, 'scope' => 'websites', 'scopeId' => $website->getId());
         }
         // Delete stores
         foreach ($storeManager->getStores() as $store) {
             $configWriter->delete($path, 'stores', $store->getId());
             $deleted[] = array('path' => $path, 'scope' => 'stores', 'scopeId' => $store->getId());
         }
     } else {
         $configWriter->delete($path, $input->getOption('scope'), $scopeId);
         $deleted[] = array('path' => $path, 'scope' => $input->getOption('scope'), 'scopeId' => $scopeId);
     }
     return $deleted;
 }
 /**
  * @test
  */
 public function process()
 {
     $finderMock = $this->getMock('Semaio\\ConfigImportExport\\Model\\File\\Finder', ['find']);
     $finderMock->expects($this->once())->method('find')->willReturn(['abc.yaml']);
     $parseResult = ['test/config/custom_field_one' => ['default' => [0 => 'ABC']]];
     $readerMock = $this->getMock('Semaio\\ConfigImportExport\\Model\\File\\Reader\\YamlReader', ['parse']);
     $readerMock->expects($this->once())->method('parse')->willReturn($parseResult);
     $this->scopeValidatorMock->expects($this->once())->method('validate')->willReturn(true);
     $this->configWriterMock->expects($this->once())->method('save');
     $processor = new ImportProcessor($this->configWriterMock, $this->scopeValidatorMock, $this->scopeConverterMock);
     $processor->setOutput($this->outputMock);
     $processor->setFinder($finderMock);
     $processor->setReader($readerMock);
     $processor->process();
 }
Пример #17
0
 /**
  * cover \Magento\Theme\Model\Config::assignToStore
  */
 public function testAssignToStoreNonSingleStoreMode()
 {
     $this->_storeManagerMock->expects($this->once())->method('isSingleStoreMode')->will($this->returnValue(false));
     $themePath = 'Magento/blank';
     /** Unassign themes from store */
     $configEntity = new \Magento\Framework\DataObject(['value' => 6, 'scope_id' => 8]);
     $this->_configData->expects($this->once())->method('getCollection')->will($this->returnValue($this->_configData));
     $this->_configData->expects($this->at(1))->method('addFieldToFilter')->with('scope', \Magento\Store\Model\ScopeInterface::SCOPE_STORES)->will($this->returnValue($this->_configData));
     $this->_configData->expects($this->at(2))->method('addFieldToFilter')->with('path', \Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID)->will($this->returnValue([$configEntity]));
     $this->_themeMock->expects($this->any())->method('getId')->will($this->returnValue(6));
     $this->_themeMock->expects($this->any())->method('getThemePath')->will($this->returnValue($themePath));
     $this->_scopeConfigWriter->expects($this->once())->method('delete');
     $this->_scopeConfigWriter->expects($this->exactly(3))->method('save');
     $this->_model->assignToStore($this->_themeMock, [2, 3, 5]);
 }
Пример #18
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->logger->log('Installing Tablerate:');
     /** @var \Magento\Framework\DB\Adapter\AdapterInterface $adapter */
     $adapter = $this->resource->getConnection('core_write');
     $fixtureFile = 'OfflineShipping/tablerate.csv';
     $fixtureFilePath = $this->fixtureHelper->getPath($fixtureFile);
     $regions = $this->loadDirectoryRegions();
     /** @var \Magento\SampleData\Helper\Csv\Reader $csvReader */
     $csvReader = $this->csvReaderFactory->create(['fileName' => $fixtureFilePath, 'mode' => 'r']);
     foreach ($csvReader as $data) {
         $regionId = $data['region'] != '*' ? $regions[$data['country']][$data['region']] : 0;
         $adapter->insert($this->tablerate->getMainTable(), ['website_id' => $this->storeManager->getWebsiteId(), 'dest_country_id' => $data['country'], 'dest_region_id' => $regionId, 'dest_zip' => $data['zip'], 'condition_name' => 'package_value', 'condition_value' => $data['order_subtotal'], 'price' => $data['price'], 'cost' => 0]);
         $this->logger->logInline('.');
     }
     $this->configWriter->save('carriers/tablerate/active', 1);
     $this->configWriter->save('carriers/tablerate/condition_name', 'package_value');
     $this->cacheTypeList->cleanType('config');
 }
 /**
  * @param  string $path
  * @param  mixed  $value
  * @param  string $scopeType
  * @param  string $scopeCode
  */
 private function changeConfig($path, $value, $scopeType, $scopeCode)
 {
     $originalValue = $this->configReader->getValue($path, $scopeType, $scopeCode);
     $this->storeOrigConfig($path, $originalValue, $scopeType, $scopeCode);
     $this->configWriter->save($path, $value, $scopeType, $this->getScopeIdByScopeCode($scopeType, $scopeCode));
 }
 /**
  * @param $path
  * @param $value
  * @param string $scope
  * @param int $scopeId
  * @return $this
  */
 public function setConfig($path, $value, $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeId = 0)
 {
     $this->configWriter->save($path, $value, $scope, $scopeId);
     return $this;
 }
Пример #21
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $installer = $setup;
     $installer->startSetup();
     $catalogSetup = $this->categorySetupFactory->create(['setup' => $setup]);
     /* ------ shipperhq_shipping_group -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_shipping_group', ['type' => 'text', 'backend' => 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend', 'input' => 'multiselect', 'label' => 'Shipping Group', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     /* ------ shipperhq_warehouse -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_warehouse', ['type' => 'text', 'backend' => 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend', 'input' => 'multiselect', 'label' => 'Origin', 'global' => false, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     $entityTypeId = $catalogSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
     $attributeSetArr = $catalogSetup->getAllAttributeSetIds($entityTypeId);
     $stdAttributeCodes = ['shipperhq_shipping_group' => '1', 'shipperhq_warehouse' => '10'];
     foreach ($attributeSetArr as $attributeSetId) {
         $catalogSetup->addAttributeGroup($entityTypeId, $attributeSetId, 'Shipping', '99');
         $attributeGroupId = $catalogSetup->getAttributeGroupId($entityTypeId, $attributeSetId, 'Shipping');
         foreach ($stdAttributeCodes as $code => $sort) {
             $attributeId = $catalogSetup->getAttributeId($entityTypeId, $code);
             $catalogSetup->addAttributeToGroup($entityTypeId, $attributeSetId, $attributeGroupId, $attributeId, $sort);
         }
     }
     /** @var \Magento\Quote\Setup\QuoteSetup $quoteSetup */
     $quoteSetup = $this->quoteSetupFactory->create(['setup' => $setup]);
     $salesSetup = $this->salesSetupFactory->create(['setup' => $setup]);
     $carrier_type = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Carrier Type'];
     $entities = ['quote_address', 'quote_address_rate'];
     foreach ($entities as $entity) {
         $quoteSetup->addAttribute($entity, 'carrier_type', $carrier_type);
     }
     $salesSetup->addAttribute('order', 'carrier_type', $carrier_type);
     $carrier_id = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Carrier ID'];
     $entities = ['quote_address_rate', 'quote_address'];
     foreach ($entities as $entity) {
         $quoteSetup->addAttribute($entity, 'carrier_id', $carrier_id);
     }
     $salesSetup->addAttribute('order', 'carrier_id', $carrier_id);
     $carrier_group_id = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'Carrier Group ID'];
     $entities = ['quote_address_rate', 'quote_item', 'quote_address_item'];
     foreach ($entities as $entity) {
         $quoteSetup->addAttribute($entity, 'carriergroup_id', $carrier_group_id);
     }
     $salesSetup->addAttribute('order_item', 'carriergroup_id', $carrier_group_id);
     $carrier_group = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Carrier Group'];
     $entities = ['quote_address_rate', 'quote_item', 'quote_address_item'];
     foreach ($entities as $entity) {
         $quoteSetup->addAttribute($entity, 'carriergroup', $carrier_group);
     }
     $salesSetup->addAttribute('order_item', 'carriergroup', $carrier_group);
     $carrierGroupDetails = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Carrier Group Details'];
     $entities = ['quote_address_rate', 'quote_address'];
     foreach ($entities as $entity) {
         $quoteSetup->addAttribute($entity, 'carriergroup_shipping_details', $carrierGroupDetails);
     }
     $salesSetup->addAttribute('order', 'carriergroup_shipping_details', $carrierGroupDetails);
     $isCheckout = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'visible' => false, 'required' => true, 'default' => 0, 'comment' => 'ShipperHQ Checkout Flag'];
     $quoteSetup->addAttribute('quote_address', 'is_checkout', $isCheckout);
     $splitRates = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'visible' => false, 'required' => true, 'default' => 0, 'comment' => 'ShipperHQ Split Rates Flag'];
     $quoteSetup->addAttribute('quote_address', 'split_rates', $splitRates);
     $displayMerged = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'visible' => false, 'required' => true, 'default' => 1, 'comment' => 'ShipperHQ Checkout Display Type'];
     $quoteSetup->addAttribute('quote_address', 'checkout_display_merged', $displayMerged);
     $carriergroupHtml = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Carrier Group HTML'];
     $quoteSetup->addAttribute('quote_address', 'carriergroup_shipping_html', $carriergroupHtml);
     $salesSetup->addAttribute('order', 'carriergroup_shipping_html', $carriergroupHtml);
     $carriergroupShipping = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Shipping Description'];
     $entities = ['quote_item', 'quote_address_item'];
     foreach ($entities as $entity) {
         $quoteSetup->addAttribute($entity, 'carriergroup_shipping', $carriergroupShipping);
     }
     $salesSetup->addAttribute('order_item', 'carriergroup_shipping', $carriergroupShipping);
     $this->configStorageWriter->save('carriers/shipper/ignore_empty_zip', 1);
 }