Setting up Multiple Websites, Stores & Views on Magento

  • 02 Sep , 2015
  • by Ankita Agrawal
Magento Featured

Magento is such a magical portal. The many things a developer can work with using Magento is simply inspiring. There are hardly any two thoughts raised when someones says that Magento is the most trusted eCommerce portal in the world. Even Alexa puts about 10,000 Magento sites in the world’s top 1 million sites.

That is quite a substantial number compared to Magento’s other competitors viz Prestashop, Shopify, WooCommerce etc.

Magento meta-chart

Magento users understand the potential of the technology they are using and in order to siphon maximum business benefits they use utilizing their technology to the maximum benefits. This will require many users accessing the admin panel and also working separately on multiple websites, stores and views to effectuate a sublime workflow.

In Magento, we can add multiple website, stores and store views. Normally we can easily create these from the admin panel but sometimes we are required to create a script. For example, if more than one user is working on same project then we don’t prefer that every developer will create website individually in its admin. Instead of this, let they can use the installer file to create multiple website, stores and views.

Code: We are creating a website “website1″, a store “store1″ and store views “view_nl”, “view_fr” and “view_en”.

/** @var $website Mage_Core_Model_Website */
$website = Mage::getModel('core/website');
/** @var $storeGroup Mage_Core_Model_Store_Group */
$storeGroup = Mage::getModel('core/store_group');
/** @var $store Mage_Core_Model_Store */
$store1 = Mage::getModel('core/store');
->setName('View NL')
$store2 = Mage::getModel('core/store');
->setName('View FR')
$store3 = Mage::getModel('core/store');
->setName('View EN')

The above code will work smoothly on any Magento based portal and will most definitely accelerate your admin processes.

Magento holds a thousand wondrous secrets behind its doors, the above is just a key to unlock one of those secrets. I have been and will continue to provide you the keys to Magento’s various surprise features along with the codes to access it through my coming blog posts. So stay tuned with more news regarding Magento and other technologies by subscribing to the Daffodil blog.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Want us to develop your Mobile/Web Solution?