MAMP Pro 的 Magento 基础 url 问题

Magento base url issue with MAMP Pro

我有一个 Magento 网站,我已通过 MAMP Pro 将其克隆到我的本地计算机 运行,并使用自定义主机名,例如:project.local

问题是,这是文件中的一个函数:

app/design/frontend/default/project/template/page/html/head.phtml

其中包含许多 css/js 文件,但是使用基础 url/directory 的包含路径似乎是错误的:/Applications/MAMP/htdocs/project_name/ 其中导致找不到文件。函数是:

$this->getCssJsHtml()

以下是我从来源获取的相关文件列表:

http://i.xomf.com/dcmsw.png

<link rel="stylesheet" type="text/css" href="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/css/styles.css" media="all" />

<link rel="stylesheet" type="text/css" href="/Applications/MAMP/htdocs/project_name/skin/frontend/base/default/css/widgets.css" media="all" />

<link rel="stylesheet" type="text/css" href="/Applications/MAMP/htdocs/project_name/skin/frontend/base/default/css/bubble/elasticsearch.css" media="all" />

<link rel="stylesheet" type="text/css" href="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/inchoo_socialconnect/google/css/button.css" media="all" />

<link rel="stylesheet" type="text/css" href="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/inchoo_socialconnect/facebook/css/button.css" media="all" />

<link rel="stylesheet" type="text/css" href="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/css/ajax-cart.css" media="all" />

<link rel="stylesheet" type="text/css" href="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/css/font-awesome.min.css" media="all" />

<link rel="stylesheet" type="text/css" href="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/css/tablet.css" media="all" />

<link rel="stylesheet" type="text/css" href="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/css/ie_10.css" media="all" />

<link rel="stylesheet" type="text/css" href="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/css/print.css" media="print" />

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/jquery/jquery-1.7.2.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/jquery/jquery.noconflict.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/jquery/jquery.joypopup.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/js/prototype/prototype.js"></script>
<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/js/lib/ccard.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/js/prototype/validation.js"></script>


<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/js/scriptaculous/builder.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/js/scriptaculous/effects.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/js/scriptaculous/dragdrop.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/js/scriptaculous/controls.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/js/scriptaculous/slider.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/js/varien/js.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/js/varien/form.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/js/mage/translate.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/js/mage/cookies.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/quickbuy.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/topmenu.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/event.simulate.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/html5.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/ajax_cart.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/jquery/jquery.CustomScrollbar.min.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/jquery/jquery-ui.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/jquery/jquery.selectbox-0.2.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/jquery/jquery.maketabs.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/jquery/jquery.flexslider-min.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/jquery/jquery.instagram.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/jquery/jquery.minitwitter.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/jquery/jquery.placeholder.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/jquery/jquery.jqzoom-core-pack.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/jquery.cookie.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/main.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/social_login.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/utagtracking.js"></script>

<script type="text/javascript" src="/Applications/MAMP/htdocs/project_name/skin/frontend/default/theme_name/js/play_video.js"></script>

需要说明的是,这些是唯一受到影响的地方。其他包含似乎与数据库中设置的基础 url 有关:core_config_data.

我不确定这是否与 MAMP Pro 和虚拟主机设置有关,但不用说,在互联网上搜索了许多...许多小时后,我已经尽了一切努力没有成功的解决方案。

如果有任何帮助,我将不胜感激,再次感谢。

典型的简单问题,您是否清除了 js/css 缓存。当服务器从一个位置移动到下一个位置时,这种情况经常发生,因为目录路径在合并时被缓存。在 system->developer javascript 和 css 设置中禁用 Merge JS 和 Css 文件将纠正该问题,但是您必须进行一些前端黑客操作才能真正保存该值。

验证此问题的一种方法是运行以下查询

SELECT *
FROM `core_config_data`
WHERE `path` LIKE '%merge%

如果这些值设置为 1,这将导致您的问题,考虑到您有访问权限,直接通过数据库禁用设置为“0”该值要容易得多。然后清除 Magento 缓存,包括 JS / CSS 缓存,这应该可以解决您的问题

屏幕截图应该是这样的: