Magento多个商店视图 - 无法获取新商店的css和js文件

时间:2014-03-21 14:21:57

标签: php magento

我设置了几个可以在同一个后端管理面板上运行的Magento商店,但是我对新商店的index.php文件有问题。

我正在改变下面示例中的最后一行代码。它最初是' Mage :: run($ mageRunCode,$ mageRunType);',它将获取所有css和js文件,但不会显示正确的商店类别。

然后我将其更改为Mage :: run(' shoestore',' website');因为它告诉你在Magneto网站的this教程中。然后会显示正确的类别,但是css和js文件不再有效,有人知道我做错了吗?

<?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
 */
define('MAGENTO_ROOT', getcwd());

$compilerConfig = MAGENTO_ROOT . '/includes/config.php';
if (file_exists($compilerConfig)) {
    include $compilerConfig;
}


$mageFilename = MAGENTO_ROOT . '/../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';

if (file_exists($autoload = __DIR__.'/vendor/autoload.php')) {
    require_once $autoload;
}

/*
Mage::run($mageRunCode, $mageRunType);
*/
Mage::run('shoestore', 'website');

3 个答案:

答案 0 :(得分:3)

Smiggle在评论中为我解决了这个问题;我没有从新商店index.php指定基本皮肤URL的正确路径,转到System-Config-Your Store然后再添加&#39; ../ skin /&#39;到基本皮肤URL。

答案 1 :(得分:1)

  1. 转到系统 - &gt;构造
  2. 选择您未获得css和js的商店视图。
  3. 点击&#34; web&#34;
  4. 在不安全和安全的情况下: 将基本URL更改为新商店URL 请勿更改基本链接URL 将基础皮肤URL更改为皮肤/ 将基本媒体URL更改为媒体/ 将基本JavaScript URL更改为js /
  5. 注意:必须使用主商店的硬编码网址替换。

答案 2 :(得分:0)

如果您使用的是主题,请尝试使用SYSTEM&gt;设计&gt;添加设计更改,然后为新商店选择主题