Jump to content

Add domain addons to "Sales by Product" report


laszlof

Recommended Posts

Heres a little code you can add to your sales by product report in order to show domain options. (like ID Protection, DNS Management, Email Forwarding)

 

Open up modules/reports/sales_by_product.php in your favorite editor and locate the following line:

 

$total = formatCurrency($total);

 

Directly ABOVE this line, add the following code:

 

$reportdata["tablevalues"][] = array("**<b>Domain Addons</b>");

$result = select_query("tblpricing", "msetupfee, qsetupfee, ssetupfee", array("type"=>"domainaddons"));
$data = mysql_fetch_array($result);
$dnsmanagement = $data[0];
$emailforwarding = $data[1];
$idprotection = $data[2];
$domaddons = array("DNS Management"=>"dnsmanagement,$dnsmanagement", "Email Forwarding"=>"emailforwarding,$emailforwarding", "ID Protection"=>"idprotection,$idprotection");
foreach ($domaddons as $addname => $addkey) {
   $mykey = explode(",", $addkey);
   $keyval = $mykey[0];
   $keyamount = $mykey[1];
   $data = select_query("tbldomains", "SUM($keyval)","status='Active' AND registrationdate LIKE '$year-$pmonth%'");
   $result = mysql_fetch_array($data);
   $count = $result[0];
   $amount = $count*$keyamount;
   $total += $amount;
   $amount = formatCurrency($amount);
   $reportdata["tablevalues"][] = array($addname, $count, $amount);
   $prevgroup = $group;
}

 

Hope this is helpful to someone. Cheers.

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