Skip to content

Instantly share code, notes, and snippets.

@larscwallin
Created June 17, 2011 08:19
Show Gist options
  • Save larscwallin/1031063 to your computer and use it in GitHub Desktop.
Save larscwallin/1031063 to your computer and use it in GitHub Desktop.
visioncart_deleteorder_menufix
<?php
$modx->regClientStartupHTMLBlock('
<script type="text/javascript">
Ext.onReady(function(){
var qsParams = Ext.urlDecode(window.location.search.substring(1));
this.updateContextMenu = function (){
var orderMenu = Ext.select(".x-menu.x-menu-floating",true);
if(orderMenu.elements[0]){
var elementId = orderMenu.elements[0].id;
orderMenu = Ext.ComponentMgr.get(elementId);
var cloneSource = orderMenu.items.items[2];
var deleteMenuItem = cloneSource.cloneConfig(
{
text:"'.$menuItemName.'",
listeners: {
click: {
fn: function() {
window.location = "?a=77&action=orders&do=deleteorder&orderid="+this.ownerCt.baseParams.rowId+"&shopid="+qsParams["shopid"];
}
}
}
}
);
orderMenu.add(deleteMenuItem);
}else{
window.setTimeout("this.updateContextMenu()",500);
}
}
if(qsParams["action"]=="orders"){
window.setTimeout("this.updateContextMenu()",1000);
}
});
</script>
');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment