graisbeck Posted August 3, 2018 Share Posted August 3, 2018 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. 0 Quote Link to comment Share on other sites More sharing options...
graisbeck Posted August 4, 2018 Author Share Posted August 4, 2018 Please ignore the second issue as I've re-posted it in 7.6. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 4, 2018 Share Posted August 4, 2018 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. 0 Quote Link to comment Share on other sites More sharing options...
graisbeck Posted August 6, 2018 Author Share Posted August 6, 2018 On 8/4/2018 at 9:43 AM, brian! said: as per the other answer, i'd rule out it being a zomex template issue first. Thanks for your help brian! 0 Quote Link to comment Share on other sites More sharing options...
graisbeck Posted August 7, 2018 Author Share Posted August 7, 2018 (edited) 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 August 7, 2018 by graisbeck 0 Quote Link to comment Share on other sites More sharing options...
graisbeck Posted August 7, 2018 Author Share Posted August 7, 2018 I believe I've just solved it by removing the hook in SideBarFaicons.php, then hid the product group. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 7, 2018 Share Posted August 7, 2018 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); } } } }); 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. 0 Quote Link to comment Share on other sites More sharing options...
graisbeck Posted August 7, 2018 Author Share Posted August 7, 2018 20 minutes ago, brian! said: who wrote that dodgy hook? (mea culpa!)... Haha!! I didn't want to mention any names 😀 Thank you for rewriting that hook brian!, it's very much appreciated. I'll put that back in later today. 0 Quote Link to comment Share on other sites More sharing options...
graisbeck Posted August 7, 2018 Author Share Posted August 7, 2018 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); } } } }); 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); } } } }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 7, 2018 Share Posted August 7, 2018 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" ?? 0 Quote Link to comment Share on other sites More sharing options...
graisbeck Posted August 7, 2018 Author Share Posted August 7, 2018 Found it! this was missing; use WHMCS\View\Menu\Item as MenuItem; 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 7, 2018 Share Posted August 7, 2018 damn - I have a habit of doing that recently... works fine without it locally, so must be getting the use from another hook... i've edited the original code. 0 Quote Link to comment Share on other sites More sharing options...
graisbeck Posted August 7, 2018 Author Share Posted August 7, 2018 1 hour ago, brian! said: damn - I have a habit of doing that recently... works fine without it locally, so must be getting the use from another hook... i've edited the original code. Thanks for your help again brian! All is in working order again 😀 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.