Headlights.
Spotted this while scraping the ice off the car a while back.
Spotted this while scraping the ice off the car a while back.
I hope they get on as well as this in 10/20/40 years’ time.
Magento is powerful and flexible, but not terribly well documented, so figuring out the best way to accomplish something can take some digging and some experimentation. I needed to set up two stores to run off the same Magento installation as two catalogues (one a subset of the other) from the same retailer.
There are two broad approaches:
VirtualHost
with aliases for the various domains, with logic added to the root index.php
to decide which store to load.VirtualHost
for each domain, linked to one core Magento installation.I took the multiple VirtualHost
s approach, as it seemed a little more logical to me (a matter of taste, really). It has the advantage of each
domain having its own .htaccess
, which might be handy if you’re doing other things alongside Magento.
When running multiple stores from one Magento instance, they all share the same back office and catalogue. Once you set up a second website, store or view then anywhere they need to differentiate the option appears to use the default config or to apply a site- store- or view-specific setting. This means that themes and extensions for the various stores all live together.
You’ll need to decide whether your new store is a whole new website or a new store of the same website. Broadly speaking, from the point of view of what the customer sees:
Although that’s pretty configurable. Websites can be set to share customer accounts, for example. And, again, they’ll all share the same admin and catalogue.
In this case, we went for two distinct websites.
Create a new root category for your new website. You can put a full category tree under it and add products to the categories.
In the control panel, go to System > Manage Shops and create a new website, then shop for that website and view for that shop. Take note of the code you assign to the website - you’ll need it later. Assign your newly-created root category to the new store.
Create a new VirtualHost
for the new website. Note that the Magento files will need to be accessible to PHP from this VirtualHost
,
so pay attention to any restrictions on your server.
In the new VirtualHost
block, you need to set two environmental variables:
SetEnv MAGE_RUN_CODE "your_new_website_code"
SetEnv MAGE_RUN_TYPE "website"
If doing this in the VirtualHost
is a problem, your server configuration may allow you to do it in the .htaccess
file below.
index.php
from the document root of the existing site to the document root of the new site. Find and modify the following variables to point
to the files in the Magento installation:
$compilerConfig
$mageFilename
Copy .htaccess
from the existing document root to that of the new site. Check it for any hostname-specific rules that have been added, and
modify them as necessary.
app
errors
includes
js
lib
media
skin
var
For example, ln -s /path/to/existing/document/root/app /path/to/new/document/root/app
.
In the control panel, go to System > Configuration > Web, select hte new website from the dropdown in the top-left corner, uncheck Use Default by the Unsecure and Secure Base URLs, then correct the URLs set to those of your new website.
Reindex everything.
Optionally set the theme for the new site under System > Configuration > Design.
Job done.
If, after doing this, the home page of the new website is showing a default Magento 404, then check that the code for the new website is set exactly the same in the control panel and in the server environment variable. A typo in the control panel setting lost me 45 minutes. That was frustrating.
Also note that as we’ve edited a core file or two (index.php
and maybe .htaccess
), keep an eye on them if you upgrade your Magento instance.
Ten years ago today I married the best person I’d ever met.
Ten years later, she still is. I don’t expect that to change.
Ten years includes some of the best times in my life, and some of the most difficult. At the highest and at the lowest, I haven’t been alone. The person I have most wanted to have there to share the joys and to help me through the sadnesses has always been there. No exceptions.
Ten years ago, I felt like a child pretending to grow up. I still do. I don’t expect that to change, either.
I have ten years’ more knowledge and experience of the fact that nobody’s perfect. Especially me.
Ten years have proved to me what I believed then: life is hard, but worth it.
After ten years, there are now four of us. And a dog.
Ten years ago I couldn’t have imagined what life would be like now. And I love it.
Ten years ago, I loved her.
Ten years into this, I love her, but I understand better than I did then what that means.
Ten years have been spent realising and marvelling at how lucky I am.
Ten years is a long time. Ten years is no time at all. It’s the beginning.
The man holding a sword near Barnes's throat was a creature worn down almost to the nub, like a pencil eraser with just enough pink rubber left to make one final correction.