Created
July 2, 2014 09:06
-
-
Save roman204/512ab74ee6c69d5a4994 to your computer and use it in GitHub Desktop.
installscript to create website/storegroup/store + root-category
This file contains 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 characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: rhutterer | |
* Date: 02.07.14 | |
* Time: 08:55 | |
*/ | |
$this->startSetup(); | |
//#addWebsite | |
/** @var $website Mage_Core_Model_Website */ | |
//load base website and rename it to europa | |
Mage::registry('isSecureArea'); | |
$directSaleWebsite = Mage::getModel('core/website'); | |
$directSaleWebsite->setCode('direct_sale') | |
->setName('Werksverkauf') | |
->save(); | |
// Force the store to be admin | |
Mage::app()->setUpdateMode(false); | |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); | |
// Create category object | |
$directSaleCategory = Mage::getModel('catalog/category'); | |
$directSaleCategory->setStoreId(Mage_Core_Model_App::ADMIN_STORE_ID); // No store is assigned to this category | |
$data = array(); | |
$data['name'] = 'Directsale'; | |
$data['path'] = "1"; // this is the catgeory path - 1 for root category | |
$data['display_mode'] = "PRODUCTS"; | |
$data['is_active'] = 1; | |
$directSaleCategory->addData($data); | |
$directSaleCategory->save(); | |
////#addStoreGroup | |
///** @var $storeGroup Mage_Core_Model_Store_Group */ | |
$storeGroup = Mage::getModel('core/store_group'); | |
$storeGroup->setWebsiteId($directSaleWebsite->getId()) | |
->setName('Directsale') | |
->setRootCategoryId($directSaleCategory->getId()) | |
->save(); | |
////#addStore | |
///** @var $store Mage_Core_Model_Store */ | |
$deStoreView = Mage::getModel('core/store'); | |
$deStoreView->setCode('direct_de') | |
->setWebsiteId($storeGroup->getWebsiteId()) | |
->setGroupId($storeGroup->getId()) | |
->setName('Deutsch') | |
->setIsActive(1) | |
->save(); | |
$this->endSetup(); |
This file contains 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 characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: rhutterer | |
* Date: 02.07.14 | |
* Time: 10:54 | |
*/ | |
$this->startSetup(); | |
//set layout and design for directsale website | |
$directSaleWebsite = Mage::getModel('core/website')->load('direct_sale', 'code'); | |
$this->setConfigData('design/theme/default', 'werksverkauf', 'websites', $directSaleWebsite->getId()); | |
//set deliverycountry for directsale website | |
$countryAllowPath = 'general/country/allow'; | |
$countryAllowValue = 'DE'; | |
$this->setConfigData($countryAllowPath, $countryAllowValue, 'websites', $directSaleWebsite->getId()); | |
$this->endSetup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment