我有一个Magento网站,我已经克隆到我的本地机器,通过MAMP Pro
运行自定义主机名,例如:project.local
问题是,这是文件中的一个函数:
app/design/frontend/default/project/template/page/html/head.phtml
包含许多css/js
个文件但是使用基本url /目录包含路径似乎是错误的: / Applications / MAMP / htdocs / project_name / 这导致文件没找到。功能是:
$this->getCssJsHtml()
以下是我从资料中获取的相关文件列表:
<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和虚拟主机的设置有关,但不用说我已经尝试了所有我能在互联网上寻找解决方案的许多小时后...没有成功。
我希望得到任何帮助,再次提前感谢。
答案 0 :(得分:0)
通常是简单的问题,你有没有清除js / css缓存。当服务器从一个位置移动到另一个位置时,通常会发生这种情况,因为合并时缓存了目录路径。在system-&gt;开发人员javascript和css设置中禁用Merge JS和Css文件将纠正问题,但是为了实际保存该值,您必须执行一些前端hackery。
验证此问题的一种方法是运行以下查询
SELECT *
FROM `core_config_data`
WHERE `path` LIKE '%merge%
如果这些值设置为1,这将导致您的问题,更容易通过数据库直接考虑您具有访问权限,禁用设置为“0”此值。然后清除Magento缓存,包括JS / CSS缓存,这应解决您的问题
屏幕截图显示了这应该是什么样的: