5

In the below <comment> <a href='admin/shipper_method'> tag, It's not redirecting to the correct page..

<allowedmethods translate="label">
   <label>Allowed Methods</label>
   <frontend_type>multiselect</frontend_type>
   <sort_order>30</sort_order>
   <source_model>ultimate_shipper/resource_method_collection</source_model>
   <show_in_default>1</show_in_default>
   <show_in_website>1</show_in_website>
   <show_in_store>0</show_in_store>
   <can_be_empty>1</can_be_empty>
   <comment><![CDATA[<a href='admin/shipper_method'>Add Custom Method</a>. Example Comment.]]></comment>
</allowedmethods>

What I need is like this,

<a href='http://192.168.1.193/madison/admin/shipper_method'>Add Custom Method</a>

or

<a href='http://example.com/admin/shipper_method'>Add Custom Method</a>

In front-end...

For that, What can I put in the system.xml?

For example: <comment><![CDATA[<a href='{{baseURL}}admin/shipper_method'>Add Custom Method</a>. Example Comment.]]></comment>

From: https://stackoverflow.com/questions/7686457/how-to-set-link-is-magegetbaseurl-for-breadcrumbs-in-layout/14576428#14576428

8

You can use a a model to generate the comment for a config field:
Something like this:

<comment>
    <model>ultimate_shipper/adminhtml_allowedmethods_comment</model>
</comment>

then you need to create the file: Ultimate/Shipper/Model/Adminhtml/Allowedmethods/Comment.php with this content:

<?php
class Ultimate_Shipper_Model_Adminhtml_Allowedmethods_Comment
{
    public function getCommentText()
    {
        $text = Mage::helper('ultimate_shipper')->__('Add Custom Method');
        return '<a href="'.Mage::helper('adminhtml')->getUrl('adminhtml/shipper_method').'">'.$text.'</a>';
    }
}
  • It Gives Fatal error: Class 'Mage_Shipper_Method_Helper_Data' not found in /var/www/html/madison/app/Mage.php on line 547.. What has to mentioned in the helper..? and how..? – Prassanna D Manikandan Nov 17 '15 at 10:49
  • You need to declare the helper alias of your module. Or change the helper alias to core in Mage::helpercall. – Marius Nov 17 '15 at 11:07
  • ! It gives an error when redirecting, It gives the url <a href='http://192.168.1.193/madison/index.php/admin/shipper_method'>Add Custom Method</a> But when clicked it redirects to the dashboard page.. Why it's happening..? Is there are any other way to display the right page. I found the Key was changing.. – Prassanna D Manikandan Nov 17 '15 at 11:14
  • sorry. my bad. check my edit. – Marius Nov 17 '15 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.