Jump to content

Fetch a custom field value of the products at the time of accepting an order and terminating an order


Believe_

Recommended Posts

Team,

I'm looking to create two WHMCS hooks using AcceptOrder and AfterModuleTerminate. We have several custom products available with a few custom fields in it as follows:

- Linux product 1

- Linux product 2

- Windows product 1

- Windows product 2

 All the above products having three custom fields, where the client's will give some values when making the order. The field name is same, but the customfiled ID should varies in databases as far as I can see. What I need to do is, when we accept an order in WHMCS, I've to compare whether they purchased Linux or Windows product, and collect an IP address they are giving in one of the customfield to variable, and echo/insert to a file accordingly as follows:

- If it is Linux

echo linux [IP] or insert "Linux: [IP]" to a file named servercollection.txt (here the linux is just text not the product name)

- If it is Windows

echo windows [IP] or insert "Windows: [IP]" to a file named servercollection.txt (here the windows is a test not the product name)

Same way, when the product terminate in WHMS, have to just collect the associated IP address to the product and echo/ insert to a file accordingly as follows:

- Same for both Linux/Windows:

echo [IP] or insert "[IP]" to a file named termination.txt

A product comparison and collect the customfield data is required for AcceptOrder hook, and associated custom field data required in AfterModuleTerminate hook. Can anyone please share me a sample code to get this output for both hooks.

Your assistance/help would be much appreciated! 🙂

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