Search code examples
javascriptmagentomagento-1.7

Magento install copied - admin menu doesn't work


I cloned an existing magento 1.7.2 installation on the same server with a test subdomain. The frontend seems to work, and I can login to the admin. The admin menu doesn't work however, no dropdowns, and copying url paths doesn't work either. I've searched online, and most answers date back to 2008 and suggest that it's a rights issue. So I've changed the rights of folders and files to 755 and 644, but still no working menus. The cache (var/cache) is empty.

These menus are javascript generated. The following error message is from the console:

Error: TypeError: Element.addClassName is not a function

To be clear - the solution is not in javascript, but it's something on the server. This install works on the same server in another directory with another domain.

Any ideas how to fix this?


Solution

  • The error

    Error: TypeError: Element.addClassName is not a function
    

    indicates some javascript on your page can't call the addClassName method.

    The addClassName method is added to element via the prototype javascript framework.

    That means its very likely your browser can't download the prototype.js file. Since it can't download this file, the addClassName method is never defined, and you get the error you're seeing.

    Look at the source code of your admin pages and find the script tag that includes the version of prototpye shipped with your version of Magento.

    <script type="text/javascript" src="http://magento.example.com/js/prototype/prototype.js"></script>
    

    Take the URL from this script tag and load it in your browser.

    My guess is you'll get a 404 because the file is missing, or a forbidden error because the file has incorrect permissions, or some other web server error that prevents the file from being shown. It's also possible that the link is pointing to an older domain name that's based on a value configured or cached in Magento.

    Track down the source of that problem, and you'll be good to go.