Jump to content

Query Location Hook


Kevin K

Recommended Posts

20 minutes ago, Kevin K said:

Ok I think I am getting somewhere now.  There was an error in the  snippet you provided. Oh well it happens to the best of us, 😜

You had me add:


use WHMCS/Service/Service;

It was supposed to be:


use WHMCS\Service\Service;

 

Although now I am getting the following error when trying to load the client area:


BadMethodCallException: Call to undefined method WHMCS\Service\Service::ofUser() in /home/**********/************/vendor/illuminate/support/Traits/ForwardsCalls.php:50

 

$servicesObj = Service::UserId($client->id)->Active();
Link to comment
Share on other sites

4 minutes ago, pRieStaKos said:

$servicesObj = Service::UserId($client->id)->Active();

Exception: Property [customFieldValues] does not exist on the Eloquent builder instance. in /home/*******/***************/vendor/illuminate/database/Eloquent/Builder.php:1366

 

Link to comment
Share on other sites

39 minutes ago, Kevin K said:

There is no  customFieldValues entries in the service.txt

Yea, that's because we are trying to find product custom fields and not config.options.

Try this query and change the hook accordingly.

SELECT
    tblproductconfigoptions.optionname AS 'option',
    tblproductconfigoptionssub.optionname AS 'value'
FROM
    tblhostingconfigoptions
LEFT JOIN tblproductconfigoptions ON
    (tblhostingconfigoptions.configid = tblproductconfigoptions.id)
LEFT JOIN tblproductconfigoptionssub ON
    (tblhostingconfigoptions.optionid = tblproductconfigoptionssub.id)
WHERE
    tblhostingconfigoptions.relid = {$serviceObj->id}

 

Link to comment
Share on other sites

8 hours ago, pRieStaKos said:

Try this query and change the hook accordingly.

Yes, that will definitely help him 🙄

On 12/13/2021 at 8:14 PM, Kevin K said:

Right now we just need the sql to pull the database information from the configurable options and I believe we can do the rest as far as displaying it.

Alright, simple: https://pastebin.com/eBZ2r294
(I couldn't paste the code into the community, the firewall of WHMCS blocks my request)

This will give you back the "Server Location" configurable option value, if a value exist. I used the Hook "ClientAreaHeaderOutput" so you can see the result directly at the client area. Don't do that on your public WHMCS installation.
You can use the same code to show the value of "Server Location" on the WHMCS homepage. Let me know if you need assistance to get the product name.

Edited by string
Link to comment
Share on other sites

10 minutes ago, string said:

Alright, simple: https://pastebin.com/eBZ2r294
(I couldn't paste the code into the community, the firewall of WHMCS blocks my request)

This will give you back the "Server Location" configurable option value, if a value exist. I used the Hook "ClientAreaHeaderOutput" so you can see the result directly at the client area. Don't do that on your public WHMCS installation.
You can use the same code to show the value of "Server Location" on the WHMCS homepage. Let me know if you need assistance to get the product name.

Oh you are a life saver. I had to do a couple tweaks to get the info into the debug where I can pull it from, but I FINALLY got what I needed.  Thank you so much for providing a working solution so quickly. 

 

13 minutes ago, string said:
8 hours ago, pRieStaKos said:

Try this query and change the hook accordingly.

Yes, that will definitely help him 🙄

Ya, I was less than thrilled with that response, but how can I complain when the help is provided for free.  🤐

Link to comment
Share on other sites

17 minutes ago, string said:

Yes, that will definitely help him 🙄

Note to my self after your comment: Stop trying to assist when you are working. Specially for free, as there will be comments like this. Cheers 

1 minute ago, Kevin K said:

Ya, I was less than thrilled with that response, but how can I complain when the help is provided for free.  🤐

That’s the spirit

Happy holidays guys

Link to comment
Share on other sites

12 hours ago, pRieStaKos said:

Note to my self after your comment: Stop trying to assist when you are working. Specially for free, as there will be comments like this. Cheers 

I'm sorry if you felt offended by my comment, that was not my intention and I think we all agree that contributions are welcome. I just want to point out that throwing around not-working code doesn't help anyone. Especially with a user who is obviously not as experienced in PHP as you are. He wouldn't even know how to execute a raw SQL query, that is the reason for my previous comment.

A 2 page topic of untested code and "try this, try that" (IMHO) makes the thread confusing and if someone else faces the same problem, they would have to take each "fix" one by one until they end up with the right code. Therefore I agree with you that it is better to wait with the answer until you are not busy with other work. That distracts from the work anyway 😜

I also wish you happy holidays.

Edited by string
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