Jump to content

Removig sidebar in cart.php?a=confproduct&i=5 pages


Recommended Posts

Ok so when someone clicks on a product to oder it i want to remove the sidebar and readjust the content to go full width i did try editing the configureproduct.tpl with the following which i found on the community but it doesnt work any ideas? i am using the six tmplate and standard cart. 

 

 <div class="pull-md-right col-md-{if $configurableoptions}12{else}9{/if}">

            <div class="header-lined">
                <h1>{$LANG.orderconfigure}</h1>
            </div>

        </div>
		{if !$configurableoptions}
        <div class="col-md-3 pull-md-left sidebar hidden-xs hidden-sm">

            {include file="orderforms/standard_cart/sidebar-categories.tpl"}

        </div>
		{/if}
		
        <div class="col-md-{if $configurableoptions}12{else}9{/if} pull-md-right">

 

Link to comment
Share on other sites

you shouldn't need to do anything to the template, just use an action hook to remove the sidebars from the left-hand side... once you have removed all of the sidebars, then the content should be displayed automatically over a wider area.

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar)
{
	if (!is_null($primarySidebar->getChild('Service Details Overview'))) {
		$primarySidebar->removeChild('Service Details Overview');
	}
	if (!is_null($primarySidebar->getChild('Service Details Actions'))) {
		$primarySidebar->removeChild('Service Details Actions');
	}
});

pi4eO4y.png

Edited by brian!
Link to comment
Share on other sites

Thanks but that removes it from product detials. I want to remove categories and actions from the product order page how can i do that? See these guys for example they have managed to remove the left sidebar on configure page but allow it to show on the product listing page. 

https://youraccount.nimbushosting.co.uk/cart.php?gid=18

https://youraccount.nimbushosting.co.uk/cart.php?a=confproduct&i=4

 

That is basicaly what i want to acheive.

Link to comment
Share on other sites

previously, you would edit the templates within standard_cart (or duplicate the theme and then modify/use the duplicate) because if you just use a sidebar hook to remove the sidebars in the cart (similar to above), it leaves a space where they were and doesn't adjust the width accordingly... this is a bug / design flaw that has existed for 5+ years.

Eyrfb2C.png

26 minutes ago, cyberpedz said:

See these guys for example they have managed to remove the left sidebar on configure page but allow it to show on the product listing page. 

in their case, it's not removed - it's been hidden with CSS.

in fact, looking at their browser code, they've seemingly must have done it in a really weird convoluted way using a sidebar hook to create custom sidebars that add css to hide/resize the sidebar/page.

I don't think there's any need for that complexity, and it would be simpler to use a hook to add the CSS directly...

<?php

# Cart Sidebar Removal / Resizing Hook
# Written by brian!

function cart_remove_sidebars_hook($vars)
{	
	$validtemplates = array("products","domainregister");
	if ($vars['filename'] == "cart" && !in_array($vars['templatefile'],$validtemplates)) {
		$head_return = "<style>#order-standard_cart .pull-md-right { width:100%; }
		.sidebar {display: none;}</style>";
		return $head_return;
	}
}
add_hook("ClientAreaHeaderOutput",1,"cart_remove_sidebars_hook");

the only line that you might need to change is that first line, $vaidtemplates, which is defining which templates you want the cart sidebars to still be shown in - so as currently written, the sidebars will be shown on the products (first cart page) and Domain Register - all other templates will hide the sidebars and adjust the page width accordingly.

tested as working on v7.8 and v7.10 using Six & Standard_cart - it should work on earlier versions than v7.8, but that's untested.

Link to comment
Share on other sites

6 hours ago, brian! said:

<?php # Cart Sidebar Removal / Resizing Hook # Written by brian! function cart_remove_sidebars_hook($vars) { $validtemplates = array("products","domainregister"); if ($vars['filename'] == "cart" && !in_array($vars['templatefile'],$validtemplates)) { $head_return = "<style>#order-standard_cart .pull-md-right { width:100%; } .sidebar {display: none;}</style>"; return $head_return; } } add_hook("ClientAreaHeaderOutput",1,"cart_remove_sidebars_hook");

You sir are a legend! Thanks so much!

Link to comment
Share on other sites

  • 1 year later...
On 3/5/2019 at 8:05 AM, brian! said:

you can use the following hook to remove the Store menu dropdown...


<?php

# Remove Store From Navbar Hook
# Written by brian!

use WHMCS\View\Menu\Item as MenuItem;

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

 

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