how to fix the tab switch in backend
Posted: 16 Jun 2010, 17:14
Hi,
some of you might know this problem. When you are on the delivery tab in backend and click a button like "new delivery", "save" or "cancel" then after the postback the "order status change" tab is active and you have to switch back to "delivery" to continue.
This seems to be a known problem. In the install instructions article you can find:
This tries to re-select the delivery tab after a postback. Unfortunately this doesn't work for me. I only get a javascript error. I think its because of a timing problem with the tab-panel initialisation or something.
Nevermind. After looking at the code for the tab panel init I found a better solution I think. Looks like the code for the tab panel init which is part of virtuemart has an error in it. The active panels ID is stored in a cookie whenever you change the active tab. When the new page is loaded this cookie should be read and the tab should be re-selected. But this doesn't work at all I think.
In order to fix this just change
/administrator/components/com_virtuemart/classes/htmlTools.class.php
line ~443
from this:
to this:
Now the active panel is restored after a postback like it should be.
I hope this helps
some of you might know this problem. When you are on the delivery tab in backend and click a button like "new delivery", "save" or "cancel" then after the postback the "order status change" tab is active and you have to switch back to "delivery" to continue.
This seems to be a known problem. In the install instructions article you can find:
I think the author of the invoice mod wanted to fix this by adding these lines to ps_order_delivery.php:It can happen that after some action in Delivery folder (clicking on button), you will be redirect to the first folder (Order Status Change). Just click on Delivery folder again to process the action.
Code: Select all
if( vmRequest::getVar ( 'delivery_pane' ) == '1') {
?>
<script type="text/javascript">
var current = document.getElementById( "delivery_pane" );
current.tabPage.select();
</script>
<?php
}
Nevermind. After looking at the code for the tab panel init I found a better solution I think. Looks like the code for the tab panel init which is part of virtuemart has an error in it. The active panels ID is stored in a cookie whenever you change the active tab. When the new page is loaded this cookie should be read and the tab should be re-selected. But this doesn't work at all I think.
In order to fix this just change
/administrator/components/com_virtuemart/classes/htmlTools.class.php
line ~443
from this:
Code: Select all
if( $this->useCookies ) {
$scripttag .= "tabs_{$this->panel_id}.activate(state.get('{$this->panel_id}-active', '".key($this->tabs)."'));";
} else {
$scripttag .= "tabs_{$this->panel_id}.activate( '".key($this->tabs)."'); ";
}
if( $this->useCookies ) {
$scripttag .= "
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
tabs_{$this->panel_id}.on('tabchange', function(tp, tab){
state.set('{$this->panel_id}-active', tab.id);
});
";
Code: Select all
if( $this->useCookies ) {
$scripttag .= "Ext.state.Manager.setProvider(new Ext.state.CookieProvider());tabs_{$this->panel_id}.activate(state.get('{$this->panel_id}-active', '".key($this->tabs)."'));";
} else {
$scripttag .= "tabs_{$this->panel_id}.activate( '".key($this->tabs)."'); ";
}
if( $this->useCookies ) {
$scripttag .= "
tabs_{$this->panel_id}.on('tabchange', function(tp, tab){
state.set('{$this->panel_id}-active', tab.id);
});
";
I hope this helps