// move toolbar delete button on AdminProducts

This commit is contained in:
gRoussac
2013-08-05 18:18:35 +02:00
parent 931cfee258
commit d585b015c1
+26 -26
View File
@@ -2409,18 +2409,23 @@ class AdminProductsControllerCore extends AdminController
{ {
if ($product = $this->loadObject(true)) if ($product = $this->loadObject(true))
{ {
if ($this->tabAccess['edit'])
{
$this->toolbar_btn['save'] = array(
'short' => 'Save',
'href' => '#',
'desc' => $this->l('Save'),
);
$this->toolbar_btn['save-and-stay'] = array(
'short' => 'SaveAndStay',
'href' => '#',
'desc' => $this->l('Save and stay'),
);
}
if ((bool)$product->id) if ((bool)$product->id)
{ {
// adding button for delete this product
if ($this->tabAccess['delete'] && $this->display != 'add')
$this->toolbar_btn['delete'] = array(
'short' => 'Delete',
'href' => $this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&deleteproduct',
'desc' => $this->l('Delete this product.'),
'confirm' => 1,
'js' => 'if (confirm(\''.$this->l('Delete product?').'\')){return true;}else{event.preventDefault();}'
);
// adding button for duplicate this product // adding button for duplicate this product
if ($this->tabAccess['add'] && $this->display != 'add') if ($this->tabAccess['add'] && $this->display != 'add')
$this->toolbar_btn['duplicate'] = array( $this->toolbar_btn['duplicate'] = array(
@@ -2454,22 +2459,17 @@ class AdminProductsControllerCore extends AdminController
'desc' => $this->l('New combination'), 'desc' => $this->l('New combination'),
'class' => 'toolbar-new' 'class' => 'toolbar-new'
); );
}
// adding button for delete this product
if ($this->tabAccess['edit']) if ($this->tabAccess['delete'] && $this->display != 'add')
{ $this->toolbar_btn['delete'] = array(
$this->toolbar_btn['save'] = array( 'short' => 'Delete',
'short' => 'Save', 'href' => $this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&deleteproduct',
'href' => '#', 'desc' => $this->l('Delete this product.'),
'desc' => $this->l('Save'), 'confirm' => 1,
); 'js' => 'if (confirm(\''.$this->l('Delete product?').'\')){return true;}else{event.preventDefault();}'
);
$this->toolbar_btn['save-and-stay'] = array( }
'short' => 'SaveAndStay',
'href' => '#',
'desc' => $this->l('Save and stay'),
);
}
} }
} }
else else