{"id":160,"date":"2011-12-04T21:40:36","date_gmt":"2011-12-05T03:40:36","guid":{"rendered":"http:\/\/www.evermoretechnologies.com\/blog\/?p=160"},"modified":"2011-12-04T21:40:36","modified_gmt":"2011-12-05T03:40:36","slug":"160","status":"publish","type":"post","link":"https:\/\/www.evermoretechnologies.com\/blog\/2011\/12\/160\/","title":{"rendered":"Multiple magento stores and urls on one magento instance."},"content":{"rendered":"<p>So you want to run a few stores from one master admin in magento. \u00a0Luckily, they make it easy to do. First thing&#8217;s first, secure the urls you need for your store. \u00a0For my example, I&#8217;m gonna use www.evermoremagento.com as the main store and www.substore1.com as the secondary store.<\/p>\n<p>I&#8217;m assuming you want to keep the stores pretty seperate. \u00a0The reason for this could be that you have two different item types you&#8217;re selling, for example shoes on one site and electronics on the other site, so you want the catalog and theme to be seperate, but you own them both, so you want an admin panel that shows you sales of all your stores in one place. \u00a0 \u00a0Some people might say this is a bad idea for scalability, but we&#8217;re not going to worry about that for this.<\/p>\n<p>Assuming you have www.evermoremagento.com running your main store, the first step is to add a category for your new store. \u00a0Go to the categories section (Catalog-&gt;Manage Categories) and click &#8220;Add Root Category). \u00a0Name that category something that makes sense for your store, such as substore one catalog. \u00a0Make sure to select Yes for Is Active and Is Anchor.<\/p>\n<p>Next step is to go to manage stores and add a website for the new store. \u00a0Set the name and code to something descriptive of the store. \u00a0We&#8217;ll set ours to Sub-Store for the name and substore for the code.<\/p>\n<p>Now click create store. \u00a0Select Sub-Store for the website, substore one catalog for the root category, and enter Main Store for Substore One for the name.<\/p>\n<p>Next is to create the store view for the store. \u00a0We&#8217;ll call ours SubStore one Main, selecting our store and setting it to enabled. \u00a0Then we&#8217;ll use substore_view for the code.<\/p>\n<p>Now we need to set the url for our second store. \u00a0This is in System-&gt;Configuration-&gt;Web. \u00a0Make sure to set the configuration scope to\u00a0Sub-Store (the name of the website). \u00a0Change the base urls to www.substore1.com.<\/p>\n<p>The final step is to make a change to index.php to load this store if a user comes in through www.substore1.com. \u00a0Open up php and look for this line of code.<\/p>\n<p>[code]Mage::run($mageRunCode, $mageRunType);[\/code]<\/p>\n<p>\u2026and right before this, \u00a0add the following code:<\/p>\n<p>[code]switch($_SERVER[&#8216;HTTP_HOST&#8217;]) {<br \/>\n    case &#8216;shoes.com&#8217;:<br \/>\n    case &#8216;www.shoes.com&#8217;:<br \/>\n        $mageRunCode = &#8216;shoes&#8217;;<br \/>\n        $mageRunType = &#8216;website&#8217;;<br \/>\n    break;<br \/>\n}[\/code]<\/p>\n<p>OK, everything&#8217;s set now. \u00a0If you want, you can change the theme for the second store in System-&gt;Configuration-&gt;Design, and changing the configuration scope to that of your website.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So you want to run a few stores from one master admin in magento. \u00a0Luckily, they make it easy to do. First thing&#8217;s first, secure the urls you need for&#8230; <a href=\"https:\/\/www.evermoretechnologies.com\/blog\/2011\/12\/160\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[22,7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/160"}],"collection":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=160"}],"version-history":[{"count":0,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/160\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}