想要在magento创建两个商店或网站


Want to create two Stores or Websites in magento

我想在magento创建一个网站,里面有两个不同的商店,比如Men和Women。

我不想在女人身上展示男人的产品,在男人身上展示女人的产品。

我创建了商店,但当我搜索产品时,所有产品都会显示在结果中,这是错误的。

现在我在Mangento管理中创建了一个新网站。我无法运行该网站。请帮我什么是好的程序。如果商店很好,那么我如何只在商店下展示我的产品?如果多站点很好,我如何运行多站点?

谢谢。

使用单个magento安装创建多个存储:

步骤1:

如果我们想访问不同的商店视图,我们将创建一个根类别(例如:secondsite_rootcategory)

注意:选择类别后,在"常规信息"下,将"是活动的"设置为"是",在"显示设置"选项卡下,将将"是锚定的"设置成"是"。

步骤2:

然后转到管理->系统->管理商店

i) Select create website button and enter the following details
    Name:domain name of the new website         (ex:www.secondsite.com/secondemagento)
    Code:any key word for our site(without white_space) (ex:seconddomainmagento)
ii) Select manage store option under the option system->manage stores and enter
    website: select your second site name (ex:www.secondsite.com/secondmagento)
    Name: same as the second website name
    Root category: Select your root category
iii) Select create store view under the option system->manage stores
Enter the following details
    store: select your store name (ex:seconddomainmagento)
    name: Enter store view name
    code:enter store view name code(ex:secondstoreviewcode)
    status:Enabled

步骤3:创建新目录(在本例中,创建目录secondmagento并从根目录复制index.php和.htaccess)(若相同的域意味着在magento根目录下创建sub_directory并复制index.php和.htaccess)编辑index.php:

$mageFilename='app/Mage.php'; 

线路

$mageFilename='../app/Mage.php';

有时它看起来像

$mageFilename=MAGENTO_ROOT.'/app/Mage.php'; 

所以我们需要像一样进行编辑

$mageFilename='../app/Mage.php';

然后编辑

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

线路

$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : 'Enter your store view code here(ex:secondstoreviewcode)'; 

edit.htaccess:将行添加到.htaccess

SetEnvIf Host .*base.* MAGE_RUN_CODE="base";
        SetEnvIf Host .*magento_site_2.*MAGE_RUN_TYPE="enter your sitecode here(ex:secondomainmagento)"; 

步骤4:转到系统->配置->web。在左侧更改当前配置范围的值(这意味着选择您的第二个网站url)在Uncurebaseurl和basesecureurl选项卡下,键入您的第二个网站url。

        Finally clear your Cache.

根本不需要创建新目录、复制index.php或更改.htaccess


  • 如果您想将产品在各自的商店中分开,则必须在系统>管理商店中定义网站。我将说明这张桌子应该是什么样子。

    +----------------+----------------------------------+-------------------+
    | Website Name   | Store Name                       | Store View Name   |
    +----------------+----------------------------------+-------------------+
    | Mens Website   | Mens Store                       | Mens Store View   |
    | (Code: men)    | (Root Category: Mens Products)   | (Code: men)       |
    +----------------+----------------------------------+-------------------+
    | Womens Website | Womens Store                     | Womens Store View |
    | (Code : women) | (Root Category: Womens Products) | (Code: women)     |
    +----------------+----------------------------------+-------------------+
    

    请注意,有两个根类别可以帮助您组织产品,但这并不是使其工作所必需的。

  • 现在,当你编辑产品时,会有一个"网站"选项卡,允许你选择"男性网站"或"女性网站"。这是防止产品在错误的搜索中显示的原因,所以请注意不要同时选中这两个框。

  • 接下来转到系统>配置>网站,在左上角的范围下拉框中,选择"男士网站"。设置适当的安全和不安全的基本URL,如http://men.example.com/。对"女性网站"和http://women.example.com/也做同样的操作。

  • 最后为要使用的域配置DNS设置。如果你自己不能做到这一点,请向你的网络主机寻求帮助。简而言之,我假设你知道该怎么做。

我发现这个方法很简单如何使用子目录方法设置Magento Powered Store

假设您想在同一服务器上的不同子目录下设置多个存储,那么您应该遵循此方法。在这种方法中,您将有一个主域,您将通过调用URL中的子目录来调用额外的存储。即

   Mainstore.com/store1
   Maninstore.com/store2

遵循以下步骤:

通过SSH登录到您的站点,并在第二个存储所在的子目录中创建:cd public_htmlmkdir mystore1/cd mystore1/从安装Magento的目录中复制index.php和.htaccess文件,该目录将位于我们的根web目录中:1.cp/public_html/index.php../public_html/.htaccess打开我们刚刚复制的index.php文件,并替换以下代码行:1.$mageFilename="app/Mage.php";具有以下内容:

1$mageFilename='/public_html/app/Mage.php';在index.php文件仍然打开的情况下,替换以下代码行:1.法师::run();具有以下内容:

1法师::run('mystore1','website');

因此,您应该复制子目录中的应用程序文件夹