From e001fedef53b961839f3adc64962a588683c339f Mon Sep 17 00:00:00 2001 From: mMarinetti Date: Fri, 7 Oct 2011 12:40:46 +0000 Subject: [PATCH] // revert --- admin-dev/tabs/AdminProducts.php | 72 +++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/admin-dev/tabs/AdminProducts.php b/admin-dev/tabs/AdminProducts.php index daff09871..b99219909 100644 --- a/admin-dev/tabs/AdminProducts.php +++ b/admin-dev/tabs/AdminProducts.php @@ -56,7 +56,11 @@ class AdminProducts extends AdminTab 'a!active' => array('title' => $this->l('Displayed'), 'active' => 'status', 'filter_key' => 'a!active', 'align' => 'center', 'type' => 'bool', 'orderby' => false)); /* Join categories table */ - $this->_category = AdminCatalog::getCurrentCategory(); + if ($id_category = Tools::getvalue('id_category')) + $this->_category = new Category($id_category); + else + $this->_category = new Category(1); + $this->_join = Product::sqlStock('a').' LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = a.`id_product` AND i.`cover` = 1) LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product`) @@ -179,6 +183,7 @@ class AdminProducts extends AdminTab else $this->_errors[] = Tools::displayError('You do not have permission to add here.'); } + else /* Delete a product in the download folder */ if (Tools::getValue('deleteVirtualProduct')) @@ -188,7 +193,7 @@ class AdminProducts extends AdminTab else $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } - + else /* Delete a product in the download folder */ if (Tools::getValue('deleteVirtualProductAttribute')) { @@ -1462,20 +1467,57 @@ class AdminProducts extends AdminTab public function display($token = null) { - if ($id_category = (int)Tools::getValue('id_category')) - AdminTab::$currentIndex .= '&id_category='.$id_category; - $this->getList($this->context->language->id, !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : null, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : null, 0, null, $this->context->shop->getID(true)); + if (((Tools::isSubmit('submitAddproduct') OR Tools::isSubmit('submitAddproductAndPreview') OR Tools::isSubmit('submitAddproductAndStay') OR Tools::isSubmit('submitSpecificPricePriorities') OR Tools::isSubmit('submitPriceAddition') OR Tools::isSubmit('submitPricesModification')) AND sizeof($this->_errors)) OR Tools::isSubmit('updateproduct') OR Tools::isSubmit('addproduct')) + { + $this->displayForm($this->token); + if (Tools::getValue('id_category') > 1) + echo '

'.$this->l('Back to home').'
'; + else + echo '

'.$this->l('Back to catalog').'
'; + } + else + { + if ($id_category = (int)Tools::getValue('id_category')) + AdminTab::$currentIndex .= '&id_category='.$id_category; + $this->getList($this->context->language->id, !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : null, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : null, 0, null, $this->context->shop->getID(true)); - $id_category = Tools::getValue('id_category', 1); - if (!$id_category) - $id_category = 1; - echo '

'.(!$this->_listTotal ? ($this->l('No products found')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('products') : $this->l('product')))).' '. - $this->l('in category').' "'.stripslashes($this->_category->getName()).'"

'; - if ($this->tabAccess['add'] === '1') - echo ' '.$this->l('Add a new product').''; - echo '
'; - $this->displayList($token); - echo '
'; + $id_category = Tools::getValue('id_category', 1); + if (!$id_category) + $id_category = 1; + echo '

'.(!$this->_listTotal ? ($this->l('No products found')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('products') : $this->l('product')))).'

'; + //////////////////////// + // @todo lot of ergonomy works around here + echo '

'.$this->l('Go to category'); + $select_child = ' '; + echo $select_child; + echo '

+ '; + //////////////////////// + $this->l('in category').' "'.stripslashes($this->_category->getName()).'"'; + if ($this->tabAccess['add'] === '1') + echo ' '.$this->l('Add a new product').''; + echo '
'; + $this->displayList($token); + echo '
'; + } } /**