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

Trying to add a custom tab in My Account section

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-23-2016, 03:00 PM
  acidon's Avatar 
acidon acidon is offline
 

Senior Member
  
Join Date: Feb 2008
Posts: 139
 

Question Trying to add a custom tab in My Account section

I am trying to add a custom tab in My Account customer area:



I end up in /common_files/customer/main/top_links.tpl

I hardcoded:

Code:
<li class="ui-state-default ui-corner-top"> <a href="my_page.php" class="ui-tabs-anchor">Downloads</a> </li>

But it is not working as intended.

I am trying to figure out how this bit works:
Code:
from=$tabs item=tab key=ind
, or to be precise, where does $tabs gets created?

I was looking for clues in content.tpl, home.tpl but so far no luck. If only I could find a php page responsible for it, I think I will be on the right track, unless it is more complicated than that.

Does anyone have and advice how to approach it? I am just starting with this smarty thing but have a good background in PHP.

Thanks in advance!
__________________
Version 4.7.6 X-cart Gold
Reply With Quote
  #2  
Old 11-23-2016, 04:55 PM
  cherie's Avatar 
cherie cherie is online now
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Trying to add a custom tab in My Account section

Back in the day we used this to add Wish List before it was included:

In include/account_tabs.php:

PHP Code:
$account_tabs[] = array(
    
'title' => func_get_langvar_by_name('lbl_wish_list'),
    
'url'   => 'cart.php?mode=wishlist'
); 
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #3  
Old 11-23-2016, 06:25 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Trying to add a custom tab in My Account section

Modify include/account_tabs.php and add the tab info you need following the pattern there.

The php script assigns $account_tabs to smarty and this is passed on the top_links.tpl as $tabs
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #4  
Old 11-24-2016, 01:34 AM
  acidon's Avatar 
acidon acidon is offline
 

Senior Member
  
Join Date: Feb 2008
Posts: 139
 

Default Re: Trying to add a custom tab in My Account section

For some reason account_tabs.php is nowhere to be found in my xcart directory. I even downloaded fresh copy of xcart but couldn't find it there either...

I am on latest 4.7.6 if it helps.

Edit:

Found $account_tabs, they moved it to XCAccountTabs class in include/func/func.core.php

Thank you for help!
__________________
Version 4.7.6 X-cart Gold
Reply With Quote
  #5  
Old 11-24-2016, 07:15 AM
  cherie's Avatar 
cherie cherie is online now
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Trying to add a custom tab in My Account section

Unfortunately, this was moved to include/func/func.core.php class XCAccountTabs. You'll see similar tab assignments there.

Rather than editing the core, a slightly less invasive way is to edit postauth.php by finding this line:

PHP Code:
XCAccountTabs::getInstance()->addDefaults()->assignToSmarty(); 
And add something like this after:

PHP Code:
$myNewTab = array( 
    
'title' => 'lbl_downloads',
    
'url'   => 'my_page.php'
);
$myAccountTabs XCAccountTabs::getInstance()->addDefaults();
$myAccountTabs->push($myNewTab);
$myAccountTabs->assignToSmarty(); 
This expects a language variable (ex: lbl_downloads).
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote

The following 2 users thank cherie for this useful post:
acidon (11-27-2016), qualiteam (11-24-2016)
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 03:35 AM.

   

 
X-Cart forums © 2001-2020