X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Trying to add a custom tab in My Account section (https://forum.x-cart.com/showthread.php?t=74712)

acidon 11-23-2016 03:00 PM

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!

cherie 11-23-2016 04:55 PM

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'
); 


cflsystems 11-23-2016 06:25 PM

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

acidon 11-24-2016 01:34 AM

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!

cherie 11-24-2016 07:15 AM

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).


All times are GMT -8. The time now is 01:13 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.