-
-
Save cagartner/61f227e2bac59ecd6dc9afe920e17c9c to your computer and use it in GitHub Desktop.
Revisions
-
0-Sony revised this gist
Jan 18, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -78,6 +78,7 @@ public function __construct( $this->groupFactory = $groupFactory; $this->groupResourceModel = $groupResourceModel; $this->storeResourceModel = $storeResourceModel; $this->eventManager = $eventManager; } /** -
0-Sony revised this gist
May 4, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface /** @var \Magento\Store\Model\Website $website */ $website = $this->websiteFactory->create(); $website->load('my_custom_code'); if(!$website->getId()){ $website->setCode('my_custom_code'); $website->setName('My Custom Name'); $website->setDefaultGroupId(3); -
0-Sony revised this gist
Feb 8, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface /** @var \Magento\Store\Model\Website $website */ $website = $this->websiteFactory->create(); $website->load('my_custom_code'); if(!$website->getId(){ $website->setCode('my_custom_code'); $website->setName('My Custom Name'); $website->setDefaultGroupId(3); -
0-Sony revised this gist
Feb 8, 2017 . 1 changed file with 10 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ namespace Namespace\Core\Setup; use Magento\Framework\Event\ManagerInterface; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; @@ -48,6 +48,10 @@ class InstallData implements InstallDataInterface * @var Store */ private $storeResourceModel; /** * @var ManagerInterface */ private $eventManager; /** * InstallData constructor. @@ -57,14 +61,16 @@ class InstallData implements InstallDataInterface * @param Group $groupResourceModel * @param StoreFactory $storeFactory * @param GroupFactory $groupFactory * @param ManagerInterface $eventManager */ public function __construct( WebsiteFactory $websiteFactory, Website $websiteResourceModel, Store $storeResourceModel, Group $groupResourceModel, StoreFactory $storeFactory, GroupFactory $groupFactory, ManagerInterface $eventManager ) { $this->websiteFactory = $websiteFactory; $this->websiteResourceModel = $websiteResourceModel; @@ -116,6 +122,8 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $store->setGroupId($group->getId()); $store->setData('is_active','1'); $this->storeResourceModel->save($store); // Trigger event to insert some data to the sales_sequence_meta table (fix bug place order in checkout) $this->eventManager->dispatch('store_add', ['store' => $store]); } } } -
0-Sony revised this gist
Nov 9, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -114,7 +114,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $store->setName('Mu Custom Store Code'); $store->setWebsite($website); $store->setGroupId($group->getId()); $store->setData('is_active','1'); $this->storeResourceModel->save($store); } } -
0-Sony revised this gist
Nov 9, 2016 . 1 changed file with 15 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -93,17 +93,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $this->websiteResourceModel->save($website); } if($website->getId()){ /** @var \Magento\Store\Model\Group $group */ $group = $this->groupFactory->create(); @@ -113,5 +103,19 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $group->setDefaultStoreId(3); $this->groupResourceModel->save($group); } /** @var \Magento\Store\Model\Store $store */ $store = $this->storeFactory->create(); $store->load('my_custom_store_code'); if(!$store->getId()){ $group = $this->groupFactory->create(); $group->load('My Custom Group Name', 'name'); $store->setCode('my_custom_store_code'); $store->setName('Mu Custom Store Code'); $store->setWebsite($website); $store->setGroupId($group->getId()); $store->isActive(true); $this->storeResourceModel->save($store); } } } -
0-Sony revised this gist
Nov 9, 2016 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ <?php /** * This file is part of Namespace for Magento. * * @license All rights reserved * @author Phuong LE <[email protected]> <@> * @category Namespace * @package Namespace_Core * @copyright Copyright (c) 2016 Agence Soon (http://www.agence-soon.fr) */ namespace Namespace\Core\Setup; -
0-Sony created this gist
Nov 9, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,117 @@ <?php /** * This file is part of Proxiserve for Magento. * * @license All rights reserved * @author Phuong LE <[email protected]> <@> * @category Proxiserve * @package Proxiserve_Core * @copyright Copyright (c) 2015 Agence Soon (http://www.agence-soon.fr) */ namespace Namespace\Core\Setup; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Store\Model\GroupFactory; use Magento\Store\Model\ResourceModel\Group; use Magento\Store\Model\ResourceModel\Store; use Magento\Store\Model\ResourceModel\Website; use Magento\Store\Model\StoreFactory; use Magento\Store\Model\WebsiteFactory; class InstallData implements InstallDataInterface { /** * @var WebsiteFactory */ private $websiteFactory; /** * @var Website */ private $websiteResourceModel; /** * @var StoreFactory */ private $storeFactory; /** * @var GroupFactory */ private $groupFactory; /** * @var Group */ private $groupResourceModel; /** * @var Store */ private $storeResourceModel; /** * InstallData constructor. * @param WebsiteFactory $websiteFactory * @param Website $websiteResourceModel * @param Store $storeResourceModel * @param Group $groupResourceModel * @param StoreFactory $storeFactory * @param GroupFactory $groupFactory */ public function __construct( WebsiteFactory $websiteFactory, Website $websiteResourceModel, Store $storeResourceModel, Group $groupResourceModel, StoreFactory $storeFactory, GroupFactory $groupFactory ) { $this->websiteFactory = $websiteFactory; $this->websiteResourceModel = $websiteResourceModel; $this->storeFactory = $storeFactory; $this->groupFactory = $groupFactory; $this->groupResourceModel = $groupResourceModel; $this->storeResourceModel = $storeResourceModel; } /** * Installs data for a module * * @param ModuleDataSetupInterface $setup * @param ModuleContextInterface $context * @return void */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var \Magento\Store\Model\Website $website */ $website = $this->websiteFactory->create(); $website->load('my_custom_code'); if(!$websiteResource){ $website->setCode('my_custom_code'); $website->setName('My Custom Name'); $website->setDefaultGroupId(3); $this->websiteResourceModel->save($website); } /** @var \Magento\Store\Model\Store $store */ $store = $this->storeFactory->create(); $store->load('my_custom_store_code'); if(!$store->getId()){ $store->setCode('my_custom_store_code'); $store->setName('Mu Custom Store Code'); $store->setWebsite($website); $store->isActive(true); $this->storeResourceModel->save($store); } if($website->getId()){ /** @var \Magento\Store\Model\Group $group */ $group = $this->groupFactory->create(); $group->setWebsiteId($website->getWebsiteId()); $group->setName('My Custom Group Name'); $group->setRootCategoryId(2); $group->setDefaultStoreId(3); $this->groupResourceModel->save($group); } } }