Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Is it possible to have your own tabs

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 09-23-2012, 06:43 PM
 
Pyro Pyro is offline
 

X-Adept
  
Join Date: Nov 2009
Posts: 506
 

Default Re: Is it possible to have your own tabs

Addison,


Thank you for the base example. Could you please clarify for me?

Quote:
Originally Posted by ADDISON
Files to start digging the code:

[XC_Dir]/include/product_tabs.php (for creating/arranging actual/new tabs)
[XC_dir]/skin/common_files/customer/tabs.tpl (for 2 columns and ideal_comfort skin there are other files)

In product_tabs.php you can insert a new tab like this:

Code:
$product_tabs[] = array( 'title' => 'Videos', 'tpl' => 'customer/main/tab_videos.tpl', 'anchor' => 'videos'








I am trying to make a basic tab at the end of my current tabs. This is what is at the end of my current file.


Code:
if ( !empty($active_modules['Customer_Reviews']) && ( $config['Customer_Reviews']['customer_reviews'] == 'Y' || $config['Customer_Reviews']['customer_voting'] == 'Y' ) ) { $product_tabs[] = array( 'title' => func_get_langvar_by_name('lbl_customers_feedback'), 'tpl' => 'modules/Customer_Reviews/vote_reviews.tpl', 'anchor' => 'feedback' ); } if ( !empty($active_modules['Advanced_Customer_Reviews']) ) { func_acr_add_product_tab($product_tabs); } if (!empty($product_tabs)) { $smarty->assign('product_tabs', $product_tabs); if ($config['Appearance']['display_product_tabs'] == 'Y') { $smarty->assign('show_as_tabs', true); } } ?>






Using your example, I end up with:


Code:
if ( !empty($active_modules['Customer_Reviews']) && ( $config['Customer_Reviews']['customer_reviews'] == 'Y' || $config['Customer_Reviews']['customer_voting'] == 'Y' ) ) { $product_tabs[] = array( 'title' => func_get_langvar_by_name('lbl_customers_feedback'), 'tpl' => 'modules/Customer_Reviews/vote_reviews.tpl', 'anchor' => 'feedback' ); } if ( !empty($active_modules['Advanced_Customer_Reviews']) ) { func_acr_add_product_tab($product_tabs); } if (!empty($product_tabs)) { $smarty->assign('product_tabs', $product_tabs); if ($config['Appearance']['display_product_tabs'] == 'Y') { $smarty->assign('show_as_tabs', true); } } $product_tabs[] = array( 'title' => 'Videos', 'tpl' => 'customer/main/tab_videos.tpl', 'anchor' => 'videos' ); ?>




Does that look right? I have run cleanup.php, but the tab does not seem to show. My tab_videos.tpl is empty, but I was thinking that the tab should at least show. To test, I also used vote_reviews.tpl to at least populate the tab, but it did not seem to work either.



Any guidance you could give would be greatly appreciated.


Thanks!
__________________
Best Wishes,
James

4.5.2 Gold (work in progress)
Reply With Quote
  #12  
Old 09-24-2012, 12:27 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

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

Default Re: Is it possible to have your own tabs

You have to insert that code before if (!empty($product_tabs)) statement. Because $product_tabs is passed already to the template and you come to add to this array a new value, this is not correct.

Make sure this template file exists customer/main/tab_videos.tpl and having some content (just for testing).
__________________
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

The following user thanks ADDISON for this useful post:
Pyro (09-24-2012)
  #13  
Old 09-24-2012, 08:54 AM
 
Pyro Pyro is offline
 

X-Adept
  
Join Date: Nov 2009
Posts: 506
 

Default Re: Is it possible to have your own tabs

Addison,

Thank you for the reply. Could you please clarify. Do I need a new

Code:
if (!empty($product_tabs))
line or do I use the last one in the page?


Code:
if ( !empty($active_modules['Customer_Reviews']) && ( $config['Customer_Reviews']['customer_reviews'] == 'Y' || $config['Customer_Reviews']['customer_voting'] == 'Y' ) ) { $product_tabs[] = array( 'title' => func_get_langvar_by_name('lbl_customers_feedback'), 'tpl' => 'modules/Customer_Reviews/vote_reviews.tpl', 'anchor' => 'feedback' ); } if ( !empty($active_modules['Advanced_Customer_Reviews']) ) { func_acr_add_product_tab($product_tabs); } $product_tabs[] = array( 'title' => 'Videos', 'tpl' => 'customer/main/tab_videos.tpl', 'anchor' => 'videos' ); if (!empty($product_tabs)) { $smarty->assign('product_tabs', $product_tabs); if ($config['Appearance']['display_product_tabs'] == 'Y') { $smarty->assign('show_as_tabs', true); } } ?>


Thanks!
__________________
Best Wishes,
James

4.5.2 Gold (work in progress)
Reply With Quote
  #14  
Old 09-24-2012, 09:27 AM
  Toora Designs's Avatar 
Toora Designs Toora Designs is offline
 

eXpert
  
Join Date: Aug 2011
Location: California USA
Posts: 281
 

Default Re: Is it possible to have your own tabs

Just tested and it shows video tab
PHP Code:
if (!empty($product_tabs)) {
        
$product_tabs[] = array(
        
'title'  => 'Videos',
        
'tpl'    => 'customer/main/tab_videos.tpl',
        
'anchor' => 'videos'
        
);
}

if (!empty(
$product_tabs)) {
    
$smarty->assign('product_tabs'$product_tabs);
    if (
$config['Appearance']['display_product_tabs'] == 'Y') {
        
$smarty->assign('show_as_tabs'true);
    }


http://i45.tinypic.com/dc68nn.png
__________________
If you need professional help on your x-cart site or any website.
Feel free to PM me or Skype me to discuss your project.
Reply With Quote

The following user thanks Toora Designs for this useful post:
Pyro (09-24-2012)
  #15  
Old 09-24-2012, 10:48 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

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

Default Re: Is it possible to have your own tabs

@Pyro - look how simple it is based on Toora Designs's example.

You can create as much tabs as you want using this code

PHP Code:
$product_tabs[] = array(
        
'title'  => 'tab_name_you_see_in_frontend'// you can define a language label for this
        
'tpl'    => 'skin_path/template_for_this_tab.tpl',
        
'anchor' => 'tab_anchor_name'
); 

You can re-arrange the tabs moving the code up and down with cut&paste. All tabs must be created before this code

PHP Code:
if (!empty($product_tabs)) {
    
$smarty->assign('product_tabs'$product_tabs);
    if (
$config['Appearance']['display_product_tabs'] == 'Y') {
        
$smarty->assign('show_as_tabs'true);
    }


Pyro, do it yourself to see how easy it is. For sure in 2 months you will come here with a brand new solution for creating and re-arranging tabs in admin (content, position), with enable/disable, of course new/remove tabs should use jQuery
__________________
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

The following user thanks ADDISON for this useful post:
Pyro (09-24-2012)
  #16  
Old 09-24-2012, 04:16 PM
 
Pyro Pyro is offline
 

X-Adept
  
Join Date: Nov 2009
Posts: 506
 

Default Re: Is it possible to have your own tabs

Addison and Toora,


Thank you both for your replies. If I could click "thank you" 1,000 times each I would do it! Unfortunately, it only allows me to do it once... so you will have to settle for that.





As far as copy and pasting goes, I had no problem there. What I was really missing was the understanding of what that last piece of code did. I was under the impression that it was just the last tab - not that it was what "completed" the tabs so to speak.





With that knowledge and Toora's complete example of a complete tab (the if portion is what I was really missing), I was able to successfully make my own tabs.


Thank you both again!
__________________
Best Wishes,
James

4.5.2 Gold (work in progress)
Reply With Quote
  #17  
Old 09-27-2012, 08:50 PM
 
Pyro Pyro is offline
 

X-Adept
  
Join Date: Nov 2009
Posts: 506
 

Default Re: Is it possible to have your own tabs

Toora or Addison,


Could you please clarify something?

If I wanted a certain tab to only show on products from a certain category, would I create an if statement around the existing tab or would I modify the code of the existing tab?



I have tried this, but it does not seem to work as expected.

Quote:
if ($product.categoryid eq "1") {
$product_tabs[] = array(
'title' => 'Sizing Chart',
'tpl' => 'customer/main/sizing_chart_tab.tpl',
'anchor' => 'sizechartt'
);
}



Thank you!
__________________
Best Wishes,
James

4.5.2 Gold (work in progress)
Reply With Quote
  #18  
Old 09-27-2012, 09:25 PM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

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

Default Re: Is it possible to have your own tabs

check if that variable is available in product page $product.categoryid with debugging console.
__________________
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

The following user thanks ADDISON for this useful post:
Pyro (09-27-2012)
  #19  
Old 09-27-2012, 09:39 PM
 
Pyro Pyro is offline
 

X-Adept
  
Join Date: Nov 2009
Posts: 506
 

Default Re: Is it possible to have your own tabs

Quote:
Originally Posted by ADDISON
check if that variable is available in product page $product.categoryid with debugging console.


Addison,


Thank you for the reply. I have not used the debugging console before, but I will give it a try now.


Prior, I was using print_r to find what is available, but I could not seem to make it work with the tabs.


Do you happen to have any more specific pointers of where I am going wrong? (Possibly an example?)

Thanks again.
__________________
Best Wishes,
James

4.5.2 Gold (work in progress)
Reply With Quote
  #20  
Old 09-28-2012, 01:08 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

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

Default Re: Is it possible to have your own tabs

Once you find $product.categoryid see it what value has in debugging console. It could not be 1 as you made that if statement.

Hope to write soon a thread about using one of XCart functions named x_log_add. This is a fantastic feature to use it inside a php code and then see what is happening in a separate file. Same like a debugging tool.
__________________
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

The following user thanks ADDISON for this useful post:
Pyro (09-28-2012)
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:23 AM.

   

 
X-Cart forums © 2001-2020