From 3fbc56c9a98e236550813c2ba81bf66300fcac5f Mon Sep 17 00:00:00 2001 From: lLefevre Date: Wed, 23 Nov 2011 17:14:19 +0000 Subject: [PATCH] // delete btn preview if the shop have not virtual_uri in AdminProductsController --- controllers/admin/AdminProductsController.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index f90f0913a..c5b6e76be 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1811,13 +1811,14 @@ class AdminProductsControllerCore extends AdminController ); // @TODO navigation - $this->toolbar_btn['preview'] = array( - 'short' => 'Preview', - 'href' => $this->getPreviewUrl($product), - 'desc' => $this->l('prevdesc'), - 'target' => true, - 'class' => 'previewUrl' - ); + if ($url_preview = $this->getPreviewUrl($product)) + $this->toolbar_btn['preview'] = array( + 'short' => 'Preview', + 'href' => $url_preview, + 'desc' => $this->l('prevdesc'), + 'target' => true, + 'class' => 'previewUrl' + ); if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php')) $this->toolbar_btn['stats'] = array( @@ -1911,6 +1912,9 @@ class AdminProductsControllerCore extends AdminController public function getPreviewUrl(Product $product) { + if (!(bool)$this->context->shop->virtual_uri) + return false; + $preview_url = $this->context->link->getProductLink( $this->getFieldValue($product, 'id'), $this->getFieldValue($product, 'link_rewrite', $this->context->language->id),