Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento tab change/redirect
    primarykey
    data
    text
    <p>I have a page with two tabs, a search-tab and a tab with a grid of the database. After the user edits one of the items in the grid, I'd like to keep them on the grid tab, rather than the form tab which is first in order.</p> <p>Is there a way to change the active tab on a page via code?</p> <p>This is the code for the tabs:</p> <pre><code>protected function _beforeToHtml() { $this-&gt;addTab('search_string', array( 'label' =&gt; Mage::helper('advancedtranslate')-&gt;__('Find a string'), 'title' =&gt; Mage::helper('advancedtranslate')-&gt;__('Find a string'), 'content' =&gt; $this-&gt;getLayout()-&gt;createBlock("advancedtranslate/adminhtml_advancedtranslate")-&gt;toHtml(), 'active' =&gt; true )); $this-&gt;addTab('list_untranslated', array( 'label' =&gt; Mage::helper('advancedtranslate')-&gt;__('Untranslated strings'), 'title' =&gt; Mage::helper('advancedtranslate')-&gt;__('Untranslated strings'), 'content' =&gt; $this-&gt;getLayout()-&gt;createBlock("advancedtranslate/adminhtml_grid")-&gt;toHtml(), 'active' =&gt; false )); return parent::_beforeToHtml(); } </code></pre> <p>And this is the saveAction in my controller that handles the redirect:</p> <pre><code>public function saveAction(){ //write data away to core_translate table $resource = Mage::getResourceModel('core/translate_string'); $request = $this-&gt;getRequest(); $translate_id = $request-&gt;getParam('id'); $original = $request-&gt;getParam('original_translation'); $custom = $request-&gt;getParam('string'); $locale = $request-&gt;getParam('locale'); $storeId = $request-&gt;getParam('storeid'); $storeViewSpecific = $request-&gt;getParam('storeview_specific'); if($storeId != 0 &amp;&amp; $storeViewSpecific != 1){ $storeId = 0; } $resource-&gt;saveTranslate($original, $custom, $locale, $storeId); //delete record from phpro table $advancedTranslateRecord = Mage::getModel('advancedtranslate/advancedtranslate'); $advancedTranslateRecord-&gt;setId($translate_id) -&gt;delete(); //clear the cache Mage::app()-&gt;getCache()-&gt;clean(); Mage::getSingleton('adminhtml/session')-&gt;addSuccess(Mage::helper('adminhtml') -&gt;__('Translation was saved.')); $this-&gt;_redirect('*/*/'); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload