Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Admin link change in 1.4
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3217
Joined:  2009-02-26
Minneapolis MN
 

I need some help updating my admin link for 1.4.x

I have this Ajax script that runs onclick()

function sendcodes(){
     
    
var pre document.getElementById("code_prefix").value;
    var 
num document.getElementById("coupon_num").value;
    var 
len document.getElementById("coupon_len").value;
    var 
id document.getElementById("cartex_id").value;
    
    
xmlhttp GetXmlHttpObject();
    if (
xmlhttp == null{
        alert(
"Browser does not support HTTP Request");
        return;
    
}
    
var url "/mymodule/adminhtml_coupon/create/";
    
url url "code/" pre "/coupon_num/" num "/coupon_len/" len "/id/" id "/";

    
xmlhttp.onreadystatechange stateChanged;
    
xmlhttp.open("GET"urltrue);
    
xmlhttp.send(null);
    
    
}

It works fine in 1.3.x but in 1.4 it goes back to my dash board. I am sure I need to add a key, but I am not sure how to do that. Can anyone help?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3217
Joined:  2009-02-26
Minneapolis MN
 

ok, so I am think, I found the “Add security key to URL in admin”

Now, how do I add that on to my link so it works?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Denys Babenko
Sr. Member
 
Avatar
Total Posts:  130
Joined:  2010-03-03
Fritz-Elsas-Str. 60
 

try generating it with

Mage::getModel('adminhtml/url')->getUrl('mymodule/adminhtml_coupon/create')
 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3217
Joined:  2009-02-26
Minneapolis MN
 

I know I am being lazy, but what is the if() on the URL key?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Denys Babenko
Sr. Member
 
Avatar
Total Posts:  130
Joined:  2010-03-03
Fritz-Elsas-Str. 60
 

I didn’t get your question. Please, rephrase.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3217
Joined:  2009-02-26
Minneapolis MN
 

Something like

if(Admin URL Key turned on){
return     $url $key
}
else{
return $url
}

I need to append my ajax urls with the key if it is turned on and I need to get the key from somewhere

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3217
Joined:  2009-02-26
Minneapolis MN
 

@Denys Babenko::

That worked like a charm, thanks you saved me a bunch of time and research!

I don’t need to do in IF it just returns the correct URL!

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