Get Adobe Flash player

    postheadericon Magento Multi store setup sub folders

    Okay so I tried to create a multistore magento setup on a single domein using subfolders.

    The internet is stuffed with posts and topics about this. After a long while I figured out what worked for me. I hope this can help anyone having the same issue’s as me.

    First, what am I using?

    - Magento 1.5.0.1

    - Xampp v1.8


    What do I want to do ?

    Create several stores in subfolders of the main magento store. That are all separate from eachother, skin, products, customers.


    How did I do this?

    I assume you have a magento install running on your server, or xampp so I won’t go into that. Aswell as have the knownledge to organize products.

    There are 5 main steps to complete this:

    1. Create stores/views/sites

    2. Create categories & add products

    3. Set default URL (safe/unsafe) and Homepage.

    4. Create subfolders and files

    5. Edit index.php in each subfolder

    1. Create stores/views/sites

    Goto >system> configuration > manage stores

    Add a new Website for each subfolder store you want, after the website make a store and a store view for the subfolder store.

    So it looks mywebsite > mystore > mystoreview, and remember the “Code” you enter we will need it later on.

     

    2. Create categories & add products

    Goto>Catalogue>Manage categories

    Add a new root category for each of your subfolder stores, enable it, and set it to Anchor>Yes

    Now you can create another sub category which will contain the products shown ONLY to visitors of that subfolder store.

    But, to make the products visible you will first need to change your storeview before we can add products to the category.

    So change the storeview in the left column and add products to your category

    Note: For the products to become usable in the category list they need to be set to the correct store view aswell. This can be done by updating the products attributes in Catalogue>Manage products>update attributes>Websites


    3. Set default URL (safe/unsafe) and Homepage.

    Goto>System>Configuration>Web

    Change Secure and insecure for each scope so it looks like this. NOTE that the skin,media and js url do not have the sub folder reference. Keep it that way !

    magento store url's


    Change the CMS Homepage in defaultpages, or goto>CMS>Homepage and change the scope of an already existing page, so we can use it on this view.

    If you do not do this you will get a “There was no Home CMS page configured or found

    4. Create subfolders and files

    Browse to the homefolder of your magento installation. Create new folders that correspond with the subfolder stores we made earlier.

    Copy the .htaccess and Index.php from the main folder to these subfolders.

    5. Edit index.php in each subfolder

    Open index.php and replace these lines:

    /* Store or website code */

    $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';

    /* Run store or run website */

    $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

    Mage::run($mageRunCode, $mageRunType);

    With

    Mage::run(‘mycode’, ‘website’); //(for me: Mage::run(‘kbc’, ‘website’);)


    Okay so this was my notebook for this problem. Note that if you don’t see any products, that you are sure you alterd the right products in the right product scopes.

    And ALWAYS disable your cache during development. Have a nice day.

     


    Last Updated (Saturday, 27 October 2012 20:39)

     
    Comments (14)
    what about $mageFilename = MAGENTO_ROOT . '/app/Mage.php';
    1 Wednesday, 10 April 2013 09:11
    don't see anything about "$mageFilename = MAGENTO_ROOT . '/app/Mage.php';"
    Quiero complementar con un último paso
    2 Friday, 17 May 2013 17:14
    Muy buen tutorial, quiero agregar que falta modificar el archivo index.php que copiamos y pegamos en la carpeta creada.

    Hay que buscar la línea que dice:
    $compilerConfig = MAGENTO_ROOT . '/includes/config.php';

    Comentarla o modificarla por:
    $compilerConfig = '../includes/config.php';

    ---

    Hay que buscar también la línea que dice:
    $mageFilename = MAGENTO_ROOT . '/app/Mage.php';

    Comentarla o modificarla por:
    $mageFilename = '../app/Mage.php';

    Saludos desde Colombia.
    Error: app/Mage.php was not found
    3 Thursday, 06 June 2013 07:46
    I have followed your instructions in this tutorial, and have changed:
    $compilerConfig = MAGENTO_ROOT . '/includes/config.php';
    to:
    $compilerConfig = '../includes/config.php';

    but I can't access the sites as I get the error: "app/Mage.php was not found".
    $mageFilename = MAGENTO_ROOT . '/app/Mage.php';
    4 Wednesday, 12 June 2013 07:44
    There are a few things that you need to modify. First find the following line inside the index.php file:
    $mageFilename = MAGENTO_ROOT . '/app/Mage.php';
    You need to change the path to the Mage.php file so that it points to the file in your Magento installation. Assuming that your Magento is installed directly in the pubic_html folder on your account, you need to edit the code so that it looks like this:
    $mageFilename = '/home/username/public_html/app/Mage.php';
    This would be the full path on your account to the Mage.php file. Of course, you need to change username with your actual username.
    Great!
    5 Wednesday, 26 June 2013 07:26
    Spent the whole afternoon trying to figure this out because I was having a problem with the categories on my store located in a subfolder giving me a 404. Followed the instructions to set up the Homepages and it all went smoothly. Thank you.
    Great Content
    6 Wednesday, 20 November 2013 08:42
    I was search lots of site for this help. But do not get any proper help. I have a problem in js , css , and image folder. But form here i have got complete solution. thanks a lot.
    this is what i was searching for long
    7 Thursday, 04 September 2014 14:57
    this very clearly spells what needs to be done for a subfolder approach to multi-stores in magento. thank you so much.
    product url problem
    8 Tuesday, 07 October 2014 07:58
    the problem is, all products in the cart will have the same store URL which is the current store the users viewing.
    installation error
    9 Thursday, 13 November 2014 13:04
    D:\xamppNew\htdocs\magento/app/Mage.php was not found

    when i install magento below error occur, i cant do anything what can i do...
    sas
    10 Monday, 01 December 2014 08:26
    Awesome
    Nice Article
    11 Wednesday, 31 December 2014 11:02
    Handy Article.
    Setup multi store
    12 Tuesday, 02 June 2015 13:58
    Thanks admin for sharing this tutorial.

    Check this advance multi store setup extension released by FME.
    By using this extension you can easily create multiple store and configure them for specific locations, regions, or countries.

    http://www.fmeextensions.com/magento-geo-ip-default-store-view.html

    Customers are automatically redirected to the appropriate store based on their IP-address.
    nginx multistore magento
    13 Monday, 13 July 2015 17:25
    There is a website that has multiple subcatogories which are stores in magento:

    www.website.com/sub1 www.website.com/sub2 www.website.com/sub3

    The server used is ngnix. everything is set up. And used to work, the nginx conf file for this site need to be reconstructed.

    at the moment when for example www.website.com/sub1 is requested this wil set the store to store to sub1. which works fine. However when a product is asked i.e. www.website.com/sub1/product this returned a "page not found" error.

    If the store is set to sub1 the url www.website.com/product DOES FIND the product without any issues. on the other hand f the store was not set previously, www.website.com/product DID NOT FIND the product.

    it seemed that once a store is set the following happens e.g. www.website.com/sub1/product :

    sub1->sub1->product == error (because of sub1->sub1)

    this should be:

    sub1->product.

    note that setting the store when www.website.com/sub1/product is requested and then redirecting the site to www.website.com/product is not an option. everything used to work fine! The store setup had not been changed. only the the nginx conf file should be adjusted. any sugestions?
    Very Helpful Tutorial
    14 Monday, 25 September 2017 11:24
    Thanks admin for sharing such a helpful tutorial. One can also find the tutorials regarding Magento and WooCommerce by visiting this blog. https://www.fmeaddons.com/blog

    Add your comment

    Your name:
    Your email:
    Your website:
    Subject:
    Comment: