View Single Post
  #1  
Old 05-01-2013, 09:55 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default [Product Page] Tab for Short Description/Detailed Description

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+):

PHP Code:
$product_tabs = array(); 

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:
{*
c863034063dde05a16bb4f2a2984f56cd779cc10v1 (xcart_4_5_5), 2013-05-01 14:29:28product_descr.tplrandom
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!
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote