Magento Forum

   
Code showing on Manage Categories Screen
 
sadielu
Jr. Member
 
Total Posts:  7
Joined:  2012-12-08
 

I am running version 1.7.0.2 and have recently come across an issue when I go into Manage Categories.  The screen only shows code now rather than the form, and I can no longer add new categories.  I have attached a screen shot of my Manage Categories to show what I am seeing.

Also I am not sure if this is related to the categories issue but it started at the same time which makes me wonder if it is related.  My continue button in my checkout no longer works and I have been unable to find a fix for it.  When the button is clicked after entering billing information it cycles like the next page will load, but then nothing happens.  I have tried to revert to a previously saved backup of my site which was saved before the issues started, but that did not change the problems.  Could anyone help give me advice to resolve these issues?

Image Attachments
ScreenHunter_01 Dec. 08 13.10.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
sadielu
Jr. Member
 
Total Posts:  7
Joined:  2012-12-08
 

Is there anyone that has suggestions about this issue?  I am really in a bind and need to get my website back up and functioning properly as soon as I can.  Any help would help would really be appreciated!

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

Hello
In this file: app/design/adminhtml/default/default/template/catalog/category/edit.phtml there is this piece of code that is supposed to show the category edit form. (around line 105)

onSuccess: function(transport{
                
try {
                    
if (transport.responseText.isJSON()) {
                        
var response transport.responseText.evalJSON();
                        var 
needUpdate true;
                        if (
response.error{
                            alert(response
.message);
                            
needUpdate false;
                        
}
                        
if(response.ajaxExpired && response.ajaxRedirect{
                            setLocation
(response.ajaxRedirect);
                            
needUpdate false;
                        
}
                        
if (needUpdate){
                            
if (response.content){
                                
$(categoryContainer).update(response.content);
                            
}
                            
if (response.messages){
                                
$(messagesContainer).update(response.messages);
                            
}
                        }
                    } 
else {
                        
$(categoryContainer).update(transport.responseText);
                    
}
                }
                
catch (e{
                    
$(categoryContainer).update(transport.responseText);
                
}
            }
To show the form an ajax request is made and the function above handles the response.
It basically does this: if the response is JSON then it evaluates it. if there is a ‘message’ var in the json then it alerts the message, if the session expired then it redirects to login page.
If the response is not JSON then it just shows the response in the form container.
And I think this is you case. For some reason the response is not JSON.
Maybe here is an other character before or after the response.
I think you can start the debugging in this place.

Marius.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sadielu
Jr. Member
 
Total Posts:  7
Joined:  2012-12-08
 

@ tzyganu

here is what mine looks like.  Not sure if there is anthing wrong with it.

categoryForm.refreshPath = function () {

categoryId = this.getCategoryId();

if (!categoryId) {
return false;
}

var refreshPathSuccess = function(transport) {
if (transport.responseText.isJSON()) {
response = transport.responseText.evalJSON()
if (response.error) {
alert(response.message);
} else {
if (categoryForm.getCategoryId() == response[’id’]) {
categoryForm.setCategoryPath(response[’path’]);
}
}
}
};

new Ajax.Request(
‘<?php echo $this->getRefreshPathUrl() ?>’,
{
method:  ‘POST’,
evalScripts: true,
onSuccess: refreshPathSuccess
}
);

};

categoryForm.getCategoryId = function () {
collection = $(this.formId).getInputs(’hidden’,’general[id]’);
if (collection.size() > 0) {
return collection.first().value;
}
return false;
};

categoryForm.setCategoryPath = function (path) {
collection = $(this.formId).getInputs(’hidden’,’general[path]’);
if (collection.size() > 0) {
return collection.first().value = path;
}
};

 
Magento Community Magento Community
Magento Community
Magento Community
 
sadielu
Jr. Member
 
Total Posts:  7
Joined:  2012-12-08
 

Sorry, here’s a better look at that code

Image Attachments
catagories code.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
Shaughn
Member
 
Avatar
Total Posts:  44
Joined:  2010-06-29
South Africa
 

Sounds like several possible issue but all depends on what was done. Common causes for this would be the following:

1. If Magento was upgraded from a previous version, its possible the Javascript was not updated or even the backend module or template. Check these to make sure. Always best practice to implement some versioning like SVN or GIT to be sure that the files were updated.

2. File permission issues could also cause this. Check that the file permissions are set correctly.

3. Make sure the file exists, running a browser debugger like firebug should show a stack trace of all the documents loaded within that page. Keep a lookout for any 404’s

4. Check and make sure you do not have any third party extensions which hook into this area which may be causing this issue.

5. And finally, switch on error logs and developer mode as in most cases this usually pin-points the error or any underlying errors straight away.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sadielu
Jr. Member
 
Total Posts:  7
Joined:  2012-12-08
 

What are the file permissions supposed to be set at and which file are we talking about?  The /catalog/category/edit.phtml or another one?  Thanks in advance for the help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Shaughn
Member
 
Avatar
Total Posts:  44
Joined:  2010-06-29
South Africa
 

All the file permissions in general should be set as follows using the following CMD:

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod -R o+w media var
chmod o+w app/etc

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top