Tuesday 23 September 2014

Apache server - adding another store view - magento multistore

1) added a new root category "test"


2) Created a new store view via configuration>manage stores

Create Website:
Name: newsite
Code: storecode
position: (left blank will autofill)

Create store:
Name: newsite
Root Category: "test" category made in previous step

Create Store View:
Drop down - select store from previous step
Name: newsite
Code: storecode
Enabled
left sort order blank.


3) Configuration > System > Web >

CHANGE STORE VIEW!!!!!! other wise you will have major problems with the next step it will lock you out of your website (if this happens see my other post: http://magento-myguide.blogspot.co.uk/2014/03/magento-mysql-base-urls-locked-out-of.html)

So... change the store view to your new one called "newsite"
go to the tab called "unsecure" and change the "Base URL"
you need to change the base url to the website you want this storeview to open at i.e. www.mysite.co.uk
also change the next tab which is default pages - you will need to make the new site its own homepage other wise the site will re direct to the default!!!

save and repeat the process (keep checking that store view)
go to the "secure" tab and again change the "Base URL"
as you did before.


4) to link the domain name to your new store view I edited the index.php file in my httpdocs where I found the similar code relating to the other store views.

The First "case" (red) is the new site name
The second "case" (green) is the main site name 
In the first part of the bracket (blue) you need to enter the store code. 

Code is as follows:



switch ($_SERVER['HTTP_HOST']){
case "newsite.co.uk":
case "www.mainsiteco.uk":
        Mage::run('storecode', 'website'); 
    break;
    default: 
       Mage::run($mageRunCode, $mageRunType);
}




Upload the index.php doc via ftp (make a backup of the original first) and test your sites domain.

No comments:

Post a Comment