From 2d3db2e15dca6a376759fc121fc585a616e06245 Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Wed, 23 Nov 2011 16:45:14 +0000 Subject: [PATCH] // Add actions to product list and fix product duplication git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10560 b9a71923-0436-4b27-9f14-aed3839534dd --- .../template/helper/list/list_action_duplicate.tpl | 2 +- classes/HelperList.php | 6 +++--- classes/Product.php | 3 +++ controllers/admin/AdminProductsController.php | 9 +++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/admin-dev/themes/template/helper/list/list_action_duplicate.tpl b/admin-dev/themes/template/helper/list/list_action_duplicate.tpl index 4ef24c5ad..ce5b9c8e7 100644 --- a/admin-dev/themes/template/helper/list/list_action_duplicate.tpl +++ b/admin-dev/themes/template/helper/list/list_action_duplicate.tpl @@ -23,5 +23,5 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} - + {$action} \ No newline at end of file diff --git a/classes/HelperList.php b/classes/HelperList.php index a58fa5944..be4218218 100644 --- a/classes/HelperList.php +++ b/classes/HelperList.php @@ -361,7 +361,7 @@ class HelperListCore extends Helper 'action' => self::$cache_lang['Duplicate'], 'confirm' => self::$cache_lang['Copy images too?'], 'location_ok' => $duplicate.'&token='.($token != null ? $token : $this->token), - 'location_ko' => $duplicate.'&noimage=1&token='.($token ? $token : $this->token).'\\', + 'location_ko' => $duplicate.'&noimage=1&token='.($token ? $token : $this->token), )); return $tpl->fetch(); @@ -564,13 +564,13 @@ class HelperListCore extends Helper 'show_toolbar' => $this->show_toolbar, 'toolbar_fix' => $this->toolbar_fix, 'toolbar_btn' => $this->toolbar_btn, - + 'ps_help_context' => $this->ps_help_context, 'class_name' => get_class($this->context->controller), 'iso_user' => $this->context->language->id, 'country_iso_code' => $this->context->country->iso_code, 'version' => _PS_VERSION_, - + 'table' => $this->table, 'currentIndex' => $this->currentIndex, 'action' => $action, diff --git a/classes/Product.php b/classes/Product.php index c3be1e347..3de22dba4 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -2919,6 +2919,9 @@ class ProductCore extends ObjectModel public static function duplicateCustomizationFields($oldProductId, $productId) { + // If customization is not activated, return success + if (!Customization::isFeatureActive()) + return true; if (($customizations = self::_getCustomizationFieldsNLabels($oldProductId)) === false) return false; if (empty($customizations)) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index ccfd05aa0..4f3f3a0fe 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -70,10 +70,11 @@ class AdminProductsControllerCore extends AdminController $this->table = 'product'; $this->className = 'Product'; $this->lang = true; - $this->edit = true; - $this->delete = true; - $this->view = false; - $this->duplicate = true; + $this->addRowAction('edit'); + $this->addRowAction('duplicate'); + $this->addRowAction('delete'); + $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'))); + $this->imageType = 'jpg'; $this->context = Context::getContext(); $this->_defaultOrderBy = 'position';