Nick Jones

a magento developer at Meanbee (@nickj89) and uk magento expert based in Bath

Magento including Javascript by System path

While upgrading a Magento installation all my Javascript files had their server path, e.g. /srv/example.com/www/public/magento/js/, instead of their web accessible path, e.g. http://www.example.com/public/magento/js/.

StackOverflow saves my life again.

Update: (08:52am, 18/03/10) – As Avi Shefi notes, I didn’t actually find a solution to the problem. Avi has updated the StackOverflow question with the following:

  1. Make sure the media/js directory belongs to the same user as the Magento folder
  2. Clean the CSS/Javascript cache in the administration area

You may find that you need to do some hacking around in the html to get the correct cache clearing URL as the admin area is Javascript heavy (but you could just set the dev/js/merge_files flag to 0 in the database before doing this and then reverting).

3 Responses to Magento including Javascript by System path

  1. Avi Shefi says:

    Well, you actually didn't find a solution.
    I had the same problem, and finally I came up to the solution in my case:
    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. And to make it clear – merging in magento 1.4 does actually work.

    Note: I also posted this on Stack Overflow for reference.
    Cheers!

    • Nick says:

      Yes, you are right. I was quite content with the temporary fix, but it would be lazy of me not to actually fix it. I have updated the post with your instructions on how to fix. Thank you!

  2. Buttle Butkus says:

    Thanks, Nick Jones, you saved my life! I was unable to log in to the admin at all. But setting the value in the db to 0 allowed me to login and clear the cache, after which I set the value back to 1 and everything works now.
    I also wonder if I could have just deleted the contents of var/cache?
    Also note, in the db I found the value in the table `core_config_data`. And here are the queries I used to find it.
    SELECT * FROM core_config_data WHERE `path` LIKE "%js%";

    4 rows came up. config_id 721 had path dev/js/merge_files. I used the id to update, but a general solution would be:
    UPDATE core_config_data SET `value` = 0 WHERE `path` = "dev/js/merge_files";
    And after clearing the cache in admin:
    UPDATE core_config_data SET `value` = 1 WHERE `path` = "dev/js/merge_files";

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">