0

This is my try:

$this->addTab( $grup_name, array(
                'label'     => Mage::helper('netgroup_attributegrouping')->__($grup_name),
                'title'     => Mage::helper('netgroup_attributegrouping')->__($grup_name),
                'content'   => $this->getLayout()->createBlock('netgroup_attributegrouping/adminhtml_form_edit_tab_managegroup')->toHtml(), //calea catre block
                'url'=> $this->getUrl('*/*/index/' ,array('active_tab' => $grup_name))
));

is it possible that somehow to send a parameter to a a function from a block using the url attribute from tabs ? Or is the an other way ?

1
  • Can you be more clear?
    – mbalparda
    Commented Jul 28, 2014 at 8:04

2 Answers 2

2

You can add a tab either by specifying the exact block

'content'   => $this->getLayout()->createBlock('netgroup_attributegrouping/adminhtml_form_edit_tab_managegroup')->toHtml(), 

In this case you can pass a parameter to the block before calling toHtml().

'content'   => $this->getLayout()->createBlock('netgroup_attributegrouping/adminhtml_form_edit_tab_managegroup')->setSomeValue($valueHere)->toHtml(),  

or if it's an ajax tab you specify the url in which case you can just pass a parameter in the url

'url'=> $this->getUrl('*/*/index/' ,array('param_name'=>$paramValue))

You cannot have a tab that is generated from both, content and url.
[EDIT]
If you are using the url approach, you can read the value sent through the url in your controller like this:

$value = $this->getRequest()->getParam('param_name'); 
//or
$value = Mage::app()->getRequest()->getParam('param_name');
3
  • thx for the quick answer, but how can i get this parameter in index ? Commented Jul 28, 2014 at 8:10
  • @Chester. See my edit. Is that what you need?
    – Marius
    Commented Jul 28, 2014 at 8:23
  • yep, thx for the help :) Commented Jul 28, 2014 at 8:26
0

Chester,As per as code ,you have wrote something wrong,

You can use either  'content'tab or 'url'

'content' is give content of a tab without using ajax.

'url' is give content of tabs with using ajax from other pages. According to Marius ,whenever you want fetch data from directly then use

'content'   => $this->getLayout()->createBlock('netgroup_attributegrouping/adminhtml_form_edit_tab_managegroup')->toHtml(),

This code provide the tabs details on basic of current url.Do not fetch from $this->getUrl('*/*/index',array('_current'=>true,active_tab' => $grup_name)) url

else you want to tab data from ajax other url then you need parameter

$this->addTab($grup_name,array(
        'label'=>Mage::helper('netgroup_attributegrouping')->__($grup_name),,
        'title'     => Mage::helper('netgroup_attributegrouping')->__($grup_name),
        'url' => $this->getUrl('*/*/index',array('_current'=>true,active_tab' => $grup_name)),
        'class'=>'ajax'
        ));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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