Jump to content

Primary side bar - changing the category name


Recommended Posts

Thank you Brian, I have this in the override file, but it doesn't work:

 

<?php

if (!defined("WHMCS")) die("This file cannot be accessed directly");

$_LANG['locale'] = "en_GB";


$_LANG['globalsystemname'] = "Home";
$_LANG['ordercategories'] = "Products";
$_LANG['knowledgebasecategories'] = "Knowledgebase";
$_LANG['navStore'] = "Products";

 

I use a custom template called 'Control' from the marketplace.

Link to comment
Share on other sites

it works locally on the dev using "Six"...

<?php
$_LANG['navStore'] = "Products";

j0d5nOS.png

 

but if your custom template is using hooks to generate the menu (though it's possibly just a css/template change to make it vertical), then you could try the hook below and see if that changes it...

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
   if (!is_null($primaryNavbar->getChild('Store'))) {
           $primaryNavbar->getChild('Store')
                           ->setLabel('Products');
   }    
});

if it doesn't, then you may need to contact the theme's developers for help.

Link to comment
Share on other sites

i'm not overly convinced that there isn't a bug in their template code... :?:

 

Vqr227c.png

 

that }"="" looks iffy to me... now perhaps it does something clever in the template, but it just looks wrong - the same error is in the demo and your site, so whether that's causing the language override and/or hook not to trigger, I don't know.

 

you might need to go back to the developer about this - though there would be one quick test to try first... go to your WHMCS site and add cart.php?gid=1&systpl=six to the URL.

 

that will allow you to see the site using the six template - now if the language override and/or hook is working, then "Store" will be renamed to whatever you want it to be (as per my previous image)... if it isn't, then something weird is going on.

 

Link to comment
Share on other sites

 

though there would be one quick test to try first... go to your WHMCS site and add cart.php?gid=1&systpl=six to the URL.

 

that will allow you to see the site using the six template - now if the language override and/or hook is working, then "Store" will be renamed to whatever you want it to be (as per my previous image)... if it isn't, then something weird is going on.

 

 

Hi Brian, no does nothing. Stll the 'Store' name... Also I tried to switch to SIX before as you mentionted, but nothing. I will forward your post to the developer again. Thanks

Link to comment
Share on other sites

it's weird it doesn't work in Six... that means there's something else going on causing this unrelated to control...

 

one last throw of the dice regarding control... what happens if you edit /includes/navbar-main.tpl and change ~line119...

 

{$item->getLabel()}

to

{if $item->getLabel() eq 'Store'}Products{else}{$item->getLabel()}{/if}

Link to comment
Share on other sites

It's funy - I don't have the file '/includes/navbar-main.tpl' there. But I have a hook named 'product-categories-hook.php' and inside this:

 

 <?php

use WHMCS\View\Menu\Item as MenuItem;
use Illuminate\Database\Capsule\Manager as Capsule;

add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar)
{
   if (is_null($secondarySidebar->getChild('Categories'))) {

       $ProductGroups = Capsule::table('tblproductgroups')
                                   ->where('tblproductgroups.hidden', '0')
                                   ->select('order', 'id', 'name')
                                   ->get();

       $secondarySidebar->addChild('Product Groups', array(
                               'label' => Lang::trans('ordercategories'),
                                                                                                                               'icon' => 'fa-shopping-cart',
                               ));

       foreach ($ProductGroups as $row){        
               $secondarySidebar->getChild('Product Groups')
                               ->addChild($row->name, array(
                               'label' => $row->name,
                               'uri' => 'cart.php?gid='.$row->id,
                               'order' => $row->order,
                               ));
       }
     }
});

 

I don't know if it's related to this issue...

Link to comment
Share on other sites

It's funny - I don't have the file '/includes/navbar-main.tpl' there.

not even at... /customer/templates/control/includes/navbar-main.tpl ??

 

But I have a hook named 'product-categories-hook.php' and inside this:

I don't know if it's related to this issue...

I recognise that hook....

 

https://forum.whmcs.com/showthread.php?126670-Product-categories-menu-on-other-pages&p=507202#post507202

 

it shouldn't be causing this issue as it's a sidebar, and your issue is with the navbar... you could rename it's extension to .php9 and that would disable it from loading.

Link to comment
Share on other sites

Ok, the file 'navbar-main.tpl' is present in the Control template. Now I changed it with your code and yes - it works! The developer wrote back with:

 

I am aware of the syntax error in the navigation menu, we've just fixed this in our latest udpate which we're packaging at for present. I've attached the updated file which fixes this error, please replace the file control/includes/navbar-main.tpl with the attached updated version, however, it is unlikely that this will have any impact on the language variables or the issue at hand.

 

Did you try the guidance supplied by WHMCS support?

 

If you view your site with the default six theme as they suggested , I still see the "Store" menu item unchanged:

xyz.com/customer/cart.php?gid=1&systpl=six

 

Therefore this would suggest that the issue is not related to Control theme.

Link to comment
Share on other sites

the developer is right in that there is an issue with your site if a hook/language override wouldn't even change the navbar in "Six".... chances are it will be another hook or addon taking precedence.

 

so the template edit I gave you above is only a temporary fix until you resolve where the issue lies... once fixed, it shouldn't be necessary.

Link to comment
Share on other sites

the developer is right in that there is an issue with your site if a hook/language override wouldn't even change the navbar in "Six".... chances are it will be another hook or addon taking precedence. so the template edit I gave you above is only a temporary fix until you resolve where the issue lies... once fixed, it shouldn't be necessary.
Uhh... I don't think I will find it out... I din't make any changes by myself as I'm really not familiar with the new WHMCS code and absolutely don't understand the hooks... :-) And all addons I do have are official WHMCS market plugins or default built in addons in WHMCS package.

 

screenshot-1.jpg

Link to comment
Share on other sites

And all addons I do have are official WHMCS market plugins or default built in addons in WHMCS package.

they're not "official" in the sense that WHMCS verify the products in Marketplace as working - they don't do that and probably never will... and just because they're from Marketplace, doesn't mean they're bug-free or tested to work in anything other than "Six"! :)

 

you could try the include/hooks folder and see if there are any navbar hooks in there... or perhaps enable hook debug mode in setup -> general settings -> other and view the logs to see if that gives a clue... I suspect even if you contacted support about this, they'd tell you to disable the addons before they would even look at it.

Link to comment
Share on other sites

Issue solved - I'm an idiot. I'm doing all code changes via Dreamweaver and changed files will be uploaded to the server automatically after saving via FTP.

BUT - I chose the wrong upload folder in the FTP settings of Dreamweaver. That's it.

 

Now all things are working as the language overriding as well.

 

Thanks Brian!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated