diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 9ca3c4fba..7438eda6f 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2543,7 +2543,7 @@ class AdminProductsControllerCore extends AdminController $this->tpl_form_vars['currentIndex'] = self::$currentIndex; $this->tpl_form_vars['display_multishop_checkboxes'] = (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP && $this->display == 'edit'); $this->fields_form = array(''); - $this->display = 'edit'; + $this->tpl_form_vars['token'] = $this->token; $this->tpl_form_vars['combinationImagesJs'] = $this->getCombinationImagesJs(); $this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int)Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'); @@ -2573,8 +2573,8 @@ class AdminProductsControllerCore extends AdminController $this->tpl_form_vars['upload_max_filesize'] = $upload_max_filesize; $this->tpl_form_vars['country_display_tax_label'] = $this->context->country->display_tax_label; $this->tpl_form_vars['has_combinations'] = $this->object->hasAttributes(); - $this->product_exists_in_shop = true; + if ($this->display == 'edit' && Validate::isLoadedObject($product) && Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP && !$product->isAssociatedToShop($this->context->shop->id)) { $this->product_exists_in_shop = false; @@ -2602,12 +2602,14 @@ class AdminProductsControllerCore extends AdminController $this->initPack($this->object); $this->{'initForm'.$this->tab_display}($this->object); $this->tpl_form_vars['product'] = $this->object; + if ($this->ajax) if (!isset($this->tpl_form_vars['custom_form'])) throw new PrestaShopException('custom_form empty for action '.$this->tab_display); else return $this->tpl_form_vars['custom_form']; } + $parent = parent::renderForm(); $this->addJqueryPlugin(array('autocomplete', 'fancybox', 'typewatch')); return $parent; @@ -3490,7 +3492,7 @@ class AdminProductsControllerCore extends AdminController $data->assign('languages', $this->_languages); $data->assign('currency', $currency); $this->object = $product; - $this->display = 'edit'; + //$this->display = 'edit'; $data->assign('product_name_redirected', Product::getProductName((int)$product->id_product_redirected, null, (int)$this->context->language->id)); /* * Form for adding a virtual product like software, mp3, etc...