Jump to content

remove navbar on cart page


Villavu

Recommended Posts

Given that I'm not a master of templates, I'd use this action hook:

<?php

add_hook('ClientAreaHeadOutput', 1, function($vars)
{
	if ($vars['templatefile'] == 'viewcart')
	{
		$RemoveHeader = true; // "true" removes WHMCS header (logo, language picker, login/register, view cart button)
		$RemoveNavBar = true; // "true" removes WHMCS navbar (Home, Store, Announcements...)

		if ($RemoveHeader ? $output .= '<style>#header { display:none }</style>' : 0);
		if ($RemoveNavBar ? $output .= '<style>#main-menu { display:none }</style>' : 0);

		return $output;
	}
});

add_hook('ClientAreaPageCart', 1, function($vars)
{
	$output['DisplayMyCustomHeader'] = true; // "true" shows your custom header in PageCart

	return $output;
});

Open templates/{YOUR_TEMPLATE}/header.tpl and look for the following statement:

{if $templatefile == 'homepage'}

Right befire it add the following code:

{if $DisplayMyCustomHeader}
<div class="home-shortcuts">
    <div class="container">
        <div class="row">
            <div class="col-md-4 hidden-sm hidden-xs text-center">
                <p class="lead">How can we help today?</p>
            </div>
            <div class="col-sm-12 col-md-8">
                <ul>
                    <li><a id="btnBuyADomain" href="domainchecker.php"><i class="fas fa-globe"></i><p>Buy A Domain <span>ยป</span></p></a></li>
                    <li><a id="btnOrderHosting" href="cart.php"><i class="far fa-hdd"></i><p>Order Hosting <span>ยป</span></p></a></li>
                    <li><a id="btnMakePayment" href="clientarea.php"><i class="fas fa-credit-card"></i><p>Make Payment <span>ยป</span></p></a></li>
                    <li><a id="btnGetSupport" href="submitticket.php"><i class="far fa-envelope"></i><p>Get Support <span>ยป</span></p></a></li>
                </ul>
            </div>
        </div>
    </div>
</div>
{/if}

And here is the result:

sample-7.png.47c615f12d9d732e172310146fb3eddb.png

Replace the content of {if $DisplayMyCustomHeader}{/if} with your header.

Link to comment
Share on other sites

21 hours ago, Kian said:

Given that I'm not a master of templates

FWIW, if you are going to edit a template to allow the output of the hook to be displayed, you might as well do it all in the template IMO...

so just in terms of changing the navbar to a custom menu on the cart pages (you could make similar changes to the header if you wanted to), in header.tpl, the <section id="main-menu"> block becomes...

{if $inShoppingCart}
*your custom menu code*
{else}
<section id="main-menu">
...
</section>
{/if}

it's worth adding that Kian's template output code should really use the equivalent language strings used in their original templates - otherwise, the custom menu output is hardcded to be in English for everyone.

also, i've used the $inShoppingCart variable to quickly check if the current page is a cart page, but any MarketConnect products in the cart sidebars will (by default) link to their store sales page, which are not cart pages - so you would have to expand the conditions in the code if you need to show the custom menu on pages outside of the cart.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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