Jump to content

Removing Categories from Cart and Configure


ukndoit

Recommended Posts

I was given this code and it worked to remove the categories when viewing the products, however, when configuring them, after they add the product, they are there.

 

here is the code:

 

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $SecondarySidebar)
{
if(!is_null($SecondarySidebar->getChild('Categories'))){
$SecondarySidebar->removeChild('Categories');
}
});

 

I put it in a name: RemoveCats.php

in the /includes/hooks

 

Can you tell me how to remove them from the configuration as well?

 

Thanks,

-Richard

Link to comment
Share on other sites

try it here:

 

https://actuatedmarketing.com/orders/cart.php?gid=56

 

click add to cart...

 

still working on the description to make it look better.

 

May not put one at all, and just build a sales page, then if they want it, put a directly link to the cart, so they don't have to see all the stuff that will be on the sales page, so no need to have it in the description...

 

Anyhow, when it goes to the configure, I see the categories. crazy that it does work for you on your test, but not on mine for me. I cleared my cache and still it is there, so tried it in another browser... but in both of the browsers, I'm logged in. I logged out of Firefox, the browser, I don't hardly use anymore, because it is always lagging... so I use Chrome mostly... but even when I log out of Firefox and clear my cache, still I see the categories.

 

Very odd.

 

-Richard

Link to comment
Share on other sites

Hi Richard,

 

still I see the categories... Very odd.

no the categories are there - how weird. :twisted:

 

I can see that you're using a custom version of "Six" and the order form template, but I don't think it's that.

 

one thought - in your hook, have you remembered to add <?php to the beginning - because if you don't do that, WHMCS will just ignore the hook. :?:

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $SecondarySidebar)
{
   if(!is_null($SecondarySidebar->getChild('Categories'))){
               $SecondarySidebar->removeChild('Categories');
   }
}); 

Link to comment
Share on other sites

This is the whole file:

 


<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $SecondarySidebar)
{
if(!is_null($SecondarySidebar->getChild('Categories'))){
$SecondarySidebar->removeChild('Categories');
}
});

?>

 

It is strange that it is not using the hook. I don't know why.

 

And yes, I'm using a custom theme, Csix, because they told me if I change anything at all, I should create a custom theme first, so updates do not overwrite my changes.

 

So just in case I do make any custom updates to anything, I don't have to redo it all. I have not yet done that, but did make the new custom theme...

 

-Richard

Link to comment
Share on other sites

Hi Richard,

 

It is strange that it is not using the hook. I don't know why.

the hook code itself is fine... the problem lies elsewhere.

 

And yes, I'm using a custom theme, Csix, because they told me if I change anything at all, I should create a custom theme first, so updates do not overwrite my changes.

So just in case I do make any custom updates to anything, I don't have to redo it all. I have not yet done that, but did make the new custom theme...

that's fine - and technically correct - but your 'csix' templates and 'six' templates are now different... six looks to be from v7.1+, your 'csix' from an earlier version - so changes that have been introduced by WHMCS, aren't being replicated in your custom template.

 

if it were me, i'd be tempted to upload a clean copy, for your WHMCS version, of 'six', 'standard_cart' and 'premium_comparison'; set the product group to use the clean p_c and see if that makes a difference... there must be something wrong with your template changes for the hook not to work.

 

ultimately, if you can't get to the bottom of this, you may need to edit the orderforms/standard_cart/sidebar_categories.tpl template and add an {if} statement into the beginning of it to remove the Categories sidebar...

 

{foreach $secondarySidebar as $panel}
   {if $panel->getName() neq 'Categories'}

and then add a closing {/if} before the {/foreach} at the end of the file.

 

that should remove the Categories sidebar on all cart pages without the need for the hook. :idea:

 

ideally, you shouldn't need to do this, and the hook should work - but once you start using potentially outdated templates, it might be quicker (though not better!) to just tweak the sidebar template. :)

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