LeonardChallis Posted December 23, 2015 Share Posted December 23, 2015 I am modifying my primary and secondary menu, as suggested in the Editing Client Area Menus documentation. I Want to move the View Cart link down in to the secondary navbar, along with a cart icon and a badge with the number of items. It's that last part I'm stuck with. So far I have this: $secondaryNavbar->addChild('View Cart')->setLabel(Lang::trans('viewcart'))->setUri('/cart.php?a=view')->setOrder(20)->setIcon('fa-shopping-cart')->setBadge('X'); Where 'X' is, I wish to put the cart items count. I see in header.tpl there is $cartitemcount, but I can't seem to find out a way, or even if it's possible, to access this information? I saw in the documentation the use of Lang::trans, so I can only hope there are more available to me. If so, I'd really appreciate a link to the documentation for this - even if it's just general smarty stuff. Many thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 23, 2015 Share Posted December 23, 2015 http://forum.whmcs.com/showthread.php?108886-Add-a-cart-icon-hook-to-the-script&p=445939#post445939 0 Quote Link to comment Share on other sites More sharing options...
LeonardChallis Posted December 23, 2015 Author Share Posted December 23, 2015 That's great, thank you brian! I was wondering if anyone had any further information on the availability of (template) variables in hooks for me? Thanks again 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 23, 2015 Share Posted December 23, 2015 I was wondering if anyone had any further information on the availability of (template) variables in hooks for me? depends on what variable you want to reference and on what type of hook! e.g the clientareapage action hook has access to the smarty variables, but I don't believe the navigation hooks do. so, if you're thinking purely of the navigation hooks, then forget Smarty - you need to find alternative routes to the value you want; as in the above code, using the session might be one solution... for other purposes, you might be able to use the WHMCS Class variables (http://docs.whmcs.com/classes/namespaces/WHMCS.html) or query the database... there are nearly always other paths to the info you want. tbh, the documentation on the navigation hooks isn't great - and I wouldn't even guarantee that all of their example hooks are coded correctly and work without issue. anyway, the chances are that whatever you want to do with the nav hooks has already been posted in these forums (or a previous solution could be applied to your situation). 0 Quote Link to comment Share on other sites More sharing options...
LeonardChallis Posted December 23, 2015 Author Share Posted December 23, 2015 This is all really valuable information - thanks brian! and Merry Christmas! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.