I wanted to add a tab in product page. It is called Description. If Short description or Detailed description variables are not empty to show one of them or both (if available) inside this tab.
I did this task easy:
1) I edit include/product_tabs.php as following:
after (line 50 v4.5.5 Gold+):
I added:
PHP Code:
$empty_descr = $GLOBALS['smarty']->_tpl_vars['product']['descr'];
$empty_fulldescr = $GLOBALS['smarty']->_tpl_vars['product']['fulldescr'];
if(!empty($empty_descr) || !empty($empty_fulldescr)){
$product_tabs[] = array(
'title' => func_get_langvar_by_name('lbl_description'),
'tpl' => 'customer/main/product_descr.tpl',
'anchor' => 'descr'
);
}
2) I created a smarty template inside /common_files/customer/main/product_descr.tpl with the following content:
PHP Code:
{*
c863034063dde05a16bb4f2a2984f56cd779cc10, v1 (xcart_4_5_5), 2013-05-01 14:29:28, product_descr.tpl, random
vim: set ts=2 sw=2 sts=2 et:
*}
{if $product.descr}
<strong style="font-size:14px;">{$product.descr}.</strong>
{/if}
{$product.fulldescr}
but ...
QUESTION: I would like to ask an expert if I have already Short Description and Full Description available as PHP variables inside product_tabs.php file, and not using $GLOBALS (as I did above). Just a simple array $product['fulldescr']. Without adding no other statements!