Jump to content
  • 0

Finding all active orders for a specific product


Hi Everyone, 

I'm a newbie to WHMCS Dev so please be gentle!

I'm trying to work out how I can get a list of all active orders for a specific product in the internal API, or simply just get such a list anyway.

looking at things I'm thinking I'm going to have to perform some pretty recursive searches which don't seem very efficient and wondered if anyone could point me to a simple method for getting this information.

Many thanks


Share this post

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

It's possible to do . A query like this will do it:

$productid = "INSERT PRODUCT ID HERE";

foreach (Capsule::table('tblhosting')->WHERE('packageid', '=', $productid)-> WHERE('domainstatus', '=', 'Active')->get() as $orderlist) {
                        $userid = $orderlist->userid;
                        $server = $orderlist->server;
                        $domain = $orderlist->domain;
                        $paymentmethod = $orderlist->paymentmethod;
                        $billingcycle = $orderlist->billingcycle;
                        $nextinvoicedate = $orderlist->nextinvoicedate;
                        $amount = $orderlist->amount;
                        print ("$userid: $server : $domain: $paymentmethod: $billingcycle: $nextinvoice: $amount<br />");


Implementation is going to be on you, but this will get you started

Edited by twhiting9275

Share this post

Link to post
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.

Answer this question...

×   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