Jump to content

Deleting product group


graisbeck

Recommended Posts

When I try to hide or delete a certain product group (issue 1 in attached image) which does not contain any products, then try to purchase another product the cart throws a 404 error. So, then I have to recreate the product group in order for the checkout to work.

Also, when the product group is in place and I try to make a purchase, I get an 'Error We were unable to connect your account. Please contact your system administrator.' error. I'm using standard order form as I've upgraded to 7.6.

Issues.jpg

Link to comment
Share on other sites

14 hours ago, graisbeck said:

When I try to hide or delete a certain product group (issue 1 in attached image) which does not contain any products, then try to purchase another product the cart throws a 404 error. So, then I have to recreate the product group in order for the checkout to work.

as per the other answer, i'd rule out it being a zomex template issue first.

Link to comment
Share on other sites

After checking with Jack at Zomex, he said that issue 1 is a problem with a WHMCS. WHMCS are saying the issue points to a custom hookpoint as mentioned in their reply -

Quote

No it is not a WHMCS issue. This is a custom hookpoint that I pointed out in the last reply causing this issue. It is located here: /home/gladston/public_html/includes/hooks/SideBarFaicons.php.

You will need to have your SysAdmin/Web Developer correct the custom code or remove that file if you do not need it.

I came across an old thread of mine which might shine some light on it -

https://whmcs.community/topic/271437-add-menu-item-to-home-shortcuts-navigation/

Any help would be appreciated!

Edited by graisbeck
Link to comment
Share on other sites

10 hours ago, graisbeck said:

I came across an old thread of mine which might shine some light on it

who wrote that dodgy hook? (mea culpa!)...

I should have added that the hook, as written, wasn't checking whether a child existed in the sidebar.. so if you remove an iconized product group, the hook breaks because it's trying to modify something that doesn't exist (a no-no)... that's lazy coding on my part as I assumed users would know that (though they shouldn't really need to).

therefore, i've rewritten the hook to assign icons to specific product groups... you can define the groups and icons in the hook, and it won't matter if you delete a product group - the hook will continue to work because its looping through the current sidebar children.... it doesn't need to check that they exist because it already knows that they do! 👍

<?php

# Categories Sidebar Icons for @graisbeck
# Written by brian!

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar)
{
	$CategoriesSidebar = $secondarySidebar->getChild("Categories");
	if (empty($CategoriesSidebar)) {
		return;
	}
	$CategoriesSidebarChildren = $CategoriesSidebar->getChildren();
	$IconsToSet = ['Web Hosting'=>'fas fa-server fa-fw','Game Servers'=>'fas fa-gamepad fa-fw','spamexperts'=>'far fa-at fa-fw','symantec'=>'fas fa-lock fa-fw','sitelock'=>'far fa-shield-check fa-fw','weebly'=>'fab fa-weebly fa-fw'];
	foreach($CategoriesSidebarChildren as $CategoryKey => $CategoryChild) {
		foreach($IconsToSet as $label => $icon) {
			if ($CategoryKey == $label) {
				$CategoriesSidebar->getChild($CategoryKey)
					->setIcon($icon);
			}
		}
	}
});

XJBjJSb.png

the only line you'll need to edit is the array that assigns the icons to a product group...

$IconsToSet = ['Web Hosting'=>'fas fa-server fa-fw','Game Servers'=>'fas fa-gamepad fa-fw','spamexperts'=>'far fa-at fa-fw','symantec'=>'fas fa-lock fa-fw','sitelock'=>'far fa-shield-check fa-fw','weebly'=>'fab fa-weebly fa-fw'];

for product groups that you've created, you would use the group name/label in this array... for the MarketConnect product groups, they're coded to use spamexperts, sitelock, symantec and weebly and so i've added them to the hook... the fact that you aren't currently offering Weebly won't matter - you can leave it in or take it out of the hook, either way it has no effect on the viability of the hook.

Link to comment
Share on other sites

2 hours ago, brian! said:

who wrote that dodgy hook? (mea culpa!)...

I should have added that the hook, as written, wasn't checking whether a child existed in the sidebar.. so if you remove an iconized product group, the hook breaks because it's trying to modify something that doesn't exist (a no-no)... that's lazy coding on my part as I assumed users would know that (though they shouldn't really need to).

therefore, i've rewritten the hook to assign icons to specific product groups... you can define the groups and icons in the hook, and it won't matter if you delete a product group - the hook will continue to work because its looping through the current sidebar children.... it doesn't need to check that they exist because it already knows that they do! 👍


<?php

# Categories Sidebar Icons for @graisbeck
# Written by brian!

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar)
{
	$CategoriesSidebar = $secondarySidebar->getChild("Categories");
	if (empty($CategoriesSidebar)) {
		return;
	}
	$CategoriesSidebarChildren = $CategoriesSidebar->getChildren();
	$IconsToSet = ['Web Hosting'=>'fas fa-server fa-fw','Game Servers'=>'fas fa-gamepad fa-fw','spamexperts'=>'far fa-at fa-fw','symantec'=>'fas fa-lock fa-fw','sitelock'=>'far fa-shield-check fa-fw','weebly'=>'fab fa-weebly fa-fw'];
	foreach($CategoriesSidebarChildren as $CategoryKey => $CategoryChild) {
		foreach($IconsToSet as $label => $icon) {
			if ($CategoryKey == $label) {
				$CategoriesSidebar->getChild($CategoryKey)
					->setIcon($icon);
			}
		}
	}
});

XJBjJSb.png

the only line you'll need to edit is the array that assigns the icons to a product group...


$IconsToSet = ['Web Hosting'=>'fas fa-server fa-fw','Game Servers'=>'fas fa-gamepad fa-fw','spamexperts'=>'far fa-at fa-fw','symantec'=>'fas fa-lock fa-fw','sitelock'=>'far fa-shield-check fa-fw','weebly'=>'fab fa-weebly fa-fw'];

for product groups that you've created, you would use the group name/label in this array... for the MarketConnect product groups, they're coded to use spamexperts, sitelock, symantec and weebly and so i've added them to the hook... the fact that you aren't currently offering Weebly won't matter - you can leave it in or take it out of the hook, either way it has no effect on the viability of the hook.

brian!, I've tried putting the code into SideBarFaicons.php as set out below, but I'm getting a 404 error:

<?php

# Categories Sidebar Icons for @graisbeck
# Written by brian!

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar)
{
	$CategoriesSidebar = $secondarySidebar->getChild("Categories");
	if (empty($CategoriesSidebar)) {
		return;
	}
	$CategoriesSidebarChildren = $CategoriesSidebar->getChildren();
	$IconsToSet = ['Shared Hosting Plans'=>'fas fa-server fa-fw','Email Hosting Plans'=>'fas fa-envelope fa-fw','spamexperts'=>'far fa-at fa-fw','symantec'=>'fas fa-lock fa-fw','sitelock'=>'far fa-shield-check fa-fw','weebly'=>'fab fa-weebly fa-fw'];
	foreach($CategoriesSidebarChildren as $CategoryKey => $CategoryChild) {
		foreach($IconsToSet as $label => $icon) {
			if ($CategoryKey == $label) {
				$CategoriesSidebar->getChild($CategoryKey)
					->setIcon($icon);
			}
		}
	}
});

 

Link to comment
Share on other sites

4 minutes ago, graisbeck said:

brian!, I've tried putting the code into SideBarFaicons.php as set out below, but I'm getting a 404 error:

can you enable Display Errors in setup -> general settings -> other and that might give you more of a clue as to where the problem is...

also, do you have another hook that has added an icon to "Shared Hosting Plans" ??

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