Why is Magento 1.4 including javascript files by f

2019-02-03 10:58发布

I am in the process of testing a Magento 1.3 site using Magento 1.4. I am seeing very weird and inconsistent behavior. Instead of including the URL of my javascript files, Magento is creating tags with the full filesystem path of the js files, as so:

<script type="text/javascript" src="/home/my_username/public_html/js/prototype/prototype.js"></script>

I believe this is related to the new "Themes JavaScript and CSS files combined to one file" function. In fact, when I log into the admin and click "Flush JavaScript/CSS Cache", then the first page load is successful, and I see a single JS include similar to:

<script type="text/javascript" src="/media/js/5b8cfac152fcb2a5f93ef9571d338c54.js"></script>

But subsequent age loads load every single JS file, with the full path names. Which obviously isn't going to work. Anyone have any ideas on what could be wrong or how to fix this issue?

10条回答
冷血范
2楼-- · 2019-02-03 11:31

I had the same problem and came up with the following solution:

  1. Verify that the permissions on media/js belong to the same user that the magento installation's folder is.
  2. Clean the CSS/JS cache using the admin.

The combination of the two actually got things back to normal.

查看更多
Animai°情兽
3楼-- · 2019-02-03 11:31

Check if your media folder is writeable by the user you webserver runs with. I had a symlink to a folder that was only writeable by root

chown -R www-data:www-data media

helped.

查看更多
Fickle 薄情
4楼-- · 2019-02-03 11:32

Editing the config.xml didn't do the trick for me, I had to disable it in the database.

In table 'core_config_data' set the value of the row with path 'dev/js/merge_files' (config_id 772) to '0'.

Thanks for pointing me in the right direction though!

查看更多
在下西门庆
5楼-- · 2019-02-03 11:33

go to System -> Configuration -> Developer Settings -> Javascript Settings -> Merge JavaScript Files (beta) and set it to "no". It is realy a beta :D

查看更多
混吃等死
6楼-- · 2019-02-03 11:34

The problem is related with the javascript merge option. Unfortunatly the form does not work without javascript. You have to change the merge_files option in app/code/core/Mage/Core/etc/config.xml to 0.

        <js>
            <merge_files>0</merge_files>
            <deprecation>0</deprecation>
        </js>

After that I removed all cache files and session files in var directory.

查看更多
Deceive 欺骗
7楼-- · 2019-02-03 11:41

Editing the config.xml didn't do the trick for me, I had to disable it in the database.

In table core_config_data set the value of the row with path dev/js/merge_files (config_id 772) to '0'.

Thanks for pointing me in the right direction though!

This solution is worked for me, thanks.

查看更多
登录 后发表回答