Magento multi site setup

In this post, we will guide you how to setup multiple websites in Magento

As you know, Magento support multiple websites stores and store views. That means you can manage separate websites using same admin panel. Each website has its own settings, themes, products, customers …

In this post, we will tell you how to create and setup multiple website on Magento 1.

Step 1: Create a website in Magento admin

Go to System -> Manage Stores -> Create Website

Setup multiple websites in magento - Metagento

Please remember new website code, store code because you will need it when editing index.php file.

Step 2: Create a new Root Category

( optional – if your new website has different products )

Go to Catalog -> Manage Categories -> Add Root Category

Step 3: Create a new Store

Go to System -> Manage Stores -> Create Store, select the website and the root category that you’ve just created.

Setup multiple websites in magento - Metagento

Step 4: Create a new Store View

Go to System -> Manage Stores -> Create Store View, select the store that you’ve just created.

Setup multiple websites in magento - Metagento

Step 5: Set new website Base URL

Go to System -> Configuration -> General -> Web -> Change “Current Configuration Scope” to the new website.

Edit Base URL in “Unsecure” & “Secure” tab using your new website domain.

Setup multiple websites in magento

Step 6: Edit index.php file in Magento root directory

Use your Cpanel File Manager or other FTP Clients as FilleZilla, WinSCP. Move to document root of Magento installation, then edit index.php file. You should create a backup of this file before editing.

Add this code:

BEFORE:

Step 7: Flush Magento Storage Cache in System -> Cache Management.

It’s done, that’s how to setup multiple websites in Magento 1.

In the next tutorial, we will guide you to do this in Magento 2.

If you have any question, please leave a comment.

Upload images in Magento programmatically

In our custom Magento modules, sometimes we need to be able to upload, save some images to our server. As we know, in Magento we can upload images for product, store logo … So we also can create a form which can be used to upload images and save them to the server. Let’s find out how to upload images in Magento.

What we need:

  • a form with a file input.
  • a controller to get request and save the images.
  • Assuming that we save all images in “/media” directory.

 

1. Create a form with content:

It’s simple, right ? Now we will create a controller with an action to get request from this form and process.

 

2. Create upload action in your controller class like this:

 

You can get uploaded file name and path in $result which is an array. You also can look into “/media” directory and see if the image is saved. Hope this post could help you upload images in Magento.

In the next post, we will tell you how to create this feature work in Magento 2.