Jump to content

brian!

Recommended Posts

Following a question from @Mauwiks...

Quote

how do we link an available add-on product to any of our customers?

natively in WHMCS, there is no way to do this - but with the help of the attached hook, it is possible - just upload the hook to /includes/hooks

the hook currently includes EIGHT different parameter options - I can think of at least 4 more options that I could add, and may do so at a later date, but I think 8 is plenty to be going on with. 🙂

FfoZawQ.png

note: the addon's ID value can be found when in the URL when you edit that product addon in the admin area - configaddons.php?action=manage&id=1

  • Linking to one specific product addon
cart.php?gid=addons&id=1

TV1yV5v.png

  • Linking to Market Connect product addons by brand
cart.php?gid=addons&id=codeguard
cart.php?gid=addons&id=sitelock
cart.php?gid=addons&id=spamexperts
cart.php?gid=addons&id=ssl
cart.php?gid=addons&id=weebly

yQXCVRH.png

these addons are found by the hook searching whether specific terms are found at the START of the product addon descriptions, e.g Codeguard etc

  • Linking to multiple product addons
cart.php?gid=addons&multi[]=1&multi[]=32&multi[]=54

fzdv1Aa.png

  • Linking to a predefined group of product addons
cart.php?gid=addons&id=group1

$group1 is a predefined array of product addon IDs that you can edit in the hook..

$group1 = array(12,28,20);

sHKBWbC.png

you could, in theory, have multiple groups (arrays of addon IDs) predefined in the hook, but it's currently only coded for 1 group - but it would be simple enough to change.

  • if you pass a numeric addon ID value that doesn't exist for the particular client, then you'll get the no addons available error message...

KaEc7JW.png

... I did toy with the idea of showing all addons under those circumstances, but I decided against it for now - not least because it keeps the coding simplified! 😉

  • if you pass an undefined non-numeric id, e.g cart.php?gid=addons&id=brian, then there is nothing for the hook to remove and it will show all addons as per normal.
  • you can only use one parameter option in a URL - e.g., you can't use cart.php?gid=addons&id=43&multi[]=32

addons_mauwiks.php

Edited by brian!
Link to comment
Share on other sites

This is very much awesome @brian!

And I can't thank you enough for the effort of doing this. Thank you, thank you and more thanks. More power and everthing else. You're the best. I hope I can offer something as a token of appreciation. I will take note of this at the time being and will surely give back one day

Link to comment
Share on other sites

  • 7 months later...
12 hours ago, web2008 said:

This was a very good idea

it still is! ☺️

12 hours ago, web2008 said:

but does it work on version 7.10.x?

yes. 😎

newer MarketConnect brands might need to be added to the hook code at some point, but it definitely still works in v.7.10.1

6jRSZQH.png

13 hours ago, web2008 said:

Have tried, but all addons are displayed anyway.

as you're using a custom orderform, is there an addons.tpl template in the v1 folder ?

if all addons are showing, i'm wondering if the if statement that checks the template name isn't being triggered for some reason - difficult for me to know as these are effectively client only pages, so I can't directly access them to test.

almost certainly, this solution should work with any template as it's basically only manipulating the $addons array.

btw - I still can't reproduce the network issues hook issue locally. headshake.gif

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Hi Brian, thank you.

Uploaded your php to includes/hooks

thank you.

Did try various approaches .. couldn't get working :)

--

my main category is: cart.php?gid=1

product shopping cart link: cart.php?a=add&pid=1

what would be the exact url to display only product id=1 on the page?

CfLRoWW.png

---

and what would be the exact url to show items of 2 categories on one page?

cat 1: cart.php?gid=3

cat 2: cart.php?gid=5

Huge thank you,

Helmuts

Edited by HostMaria
Link to comment
Share on other sites

On 19/06/2020 at 14:06, HostMaria said:

Uploaded your php to includes/hooks

for anyone else, this is in relation to the thread below...

and i'll answer the question in the above thread as it's not really relevant to the purpose of the hook in this thread.

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