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

This commit is contained in:
lLefevre committed 2011-11-23 17:14:19 +00:00
1 parent f3f99d3f63
commit 3fbc56c9a9
1 file changed
+5 -1
@@ -1811,9 +1811,10 @@ class AdminProductsControllerCore extends AdminController
); );
// @TODO navigation // @TODO navigation
if ($url_preview = $this->getPreviewUrl($product))
$this->toolbar_btn['preview'] = array( $this->toolbar_btn['preview'] = array(
'short' => 'Preview', 'short' => 'Preview',
'href' => $this->getPreviewUrl($product), 'href' => $url_preview,
'desc' => $this->l('prevdesc'), 'desc' => $this->l('prevdesc'),
'target' => true, 'target' => true,
'class' => 'previewUrl' 'class' => 'previewUrl'
@@ -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),