// delete btn preview if the shop have not virtual_uri in AdminProductsController

This commit is contained in:
lLefevre
2011-11-23 17:14:19 +00:00
parent f3f99d3f63
commit 3fbc56c9a9
+11 -7
View File
@@ -1811,13 +1811,14 @@ class AdminProductsControllerCore extends AdminController
); );
// @TODO navigation // @TODO navigation
$this->toolbar_btn['preview'] = array( if ($url_preview = $this->getPreviewUrl($product))
'short' => 'Preview', $this->toolbar_btn['preview'] = array(
'href' => $this->getPreviewUrl($product), 'short' => 'Preview',
'desc' => $this->l('prevdesc'), 'href' => $url_preview,
'target' => true, 'desc' => $this->l('prevdesc'),
'class' => 'previewUrl' 'target' => true,
); 'class' => 'previewUrl'
);
if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php')) if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php'))
$this->toolbar_btn['stats'] = array( $this->toolbar_btn['stats'] = array(
@@ -1911,6 +1912,9 @@ class AdminProductsControllerCore extends AdminController
public function getPreviewUrl(Product $product) public function getPreviewUrl(Product $product)
{ {
if (!(bool)$this->context->shop->virtual_uri)
return false;
$preview_url = $this->context->link->getProductLink( $preview_url = $this->context->link->getProductLink(
$this->getFieldValue($product, 'id'), $this->getFieldValue($product, 'id'),
$this->getFieldValue($product, 'link_rewrite', $this->context->language->id), $this->getFieldValue($product, 'link_rewrite', $this->context->language->id),