1、登录后台system->manage stores
多站点
选择create website:
进入:
填写完整后,保存,再去该website下新建store和store view
store新建:
2、store下面可以新建多个store view(即多语言设置),Code的值是展示view的关键所在
每个view代表着一种语言,所以建立多个view时,需要去下载安装语言包,magento-community
3、多个网站,重复上面步骤即可。
4、多域名设置
system->confirguration
5、然后在选择,GENERAL标签下的Web:
6、取消use default(或者 use website)前面的勾, 在Unsecure和Secure的base url中输入你已经拥有的域名
点击保存。
7、多域名设置的最后一步,修改项目根木的 .htaccess文件:
打开文件在最后加入:
SetEnvIf Host ^xncp.mez100.de.cn MAGE_RUN_CODE=de /* Store or website code 这里的code新建store view时的code输入框的值*/
SetEnvIf Host ^xncp.mez100.de.cn MAGE_RUN_TYPE=website /* Run store or run website */
8、多货币的设置
view或website设置多货币
再选择下方的currency Setup:
依次设置基础货币、默认货币、所允许的货币
在Allowed Currencies选择多个值后,保存,实现多货币的设置
在去设置货币汇率。这个如果不设置的话,在前台不会出现货币转换的选项:
这里可以设置货币的汇率以及货币的符号
货币汇率:
货币符号:
设置好后,保存,在前台就可以看见货币转为的选项了。
下面还有一种多域名的做法(又称二级目录)
假设我们的网站现在有个vip的站点(只有允许vip用户访问)
1、登录后台system->configuration,选择对应的website或store view ,选择左侧的 web 标签:
注意:{{secure_base_url}}/de
有个斜线,设置的时候不要漏掉。
按上图配置好后,点击保存。
2、回到项目的根目录中,新建一个de的文件夹(这里的de为你在后台配置web下Base Link URL后面追加的那个de),创建如下:
将更目录的index.php的内容copy到de文件下的inde.php,文件.htaccess也一样从根目录的.htaccess 拷贝到de文件夹下的.htaccess
3、修改de文件下的index.php;
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
* @package Mage
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
if (version_compare(phpversion(), '5.2.0', '<')===true) {
echo '<div style="font:12px/1.35em arial, helvetica, sans-serif;"><div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;"><h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 5.2.0 or newer. <a href="http://www.magentocommerce.com/install" target="">Find out</a> how to install</a> Magento using PHP-CGI as a work-around.</p></div>';
exit;
}
/**
* Error reporting
*/
error_reporting(E_ALL | E_STRICT);
/**
* Compilation includes configuration file
*/
$compilerConfig = '../includes/config.php';
if (file_exists($compilerConfig)) {
include $compilerConfig;
}
$mageFilename = '../app/Mage.php';
$maintenanceFile = '../maintenance.flag';
if (!file_exists($mageFilename)) {
if (is_dir('downloader')) {
header("Location: downloader");
} else {
echo $mageFilename." was not found";
}
exit;
}
if (file_exists($maintenanceFile)) {
include_once dirname(__FILE__) . '/errors/503.php';
exit;
}
require_once $mageFilename;
#Varien_Profiler::enable();
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
}
#ini_set('display_errors', 1);
umask(0);
/* 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';
/*de为 website or store view code*/
/*如果该站点为website的话,将store改为wensite即可*/
Mage::run('de', 'store');
4、然后在浏览器中输入www.xample.com/de就可以访问相应的store view或website了