run:R W Run
992 By
2026-04-08 19:24:44
R W Run
656 By
2026-04-08 19:24:43
R W Run
810 By
2026-04-08 19:24:43
R W Run
1.73 KB
2026-04-08 19:24:43
R W Run
1.79 KB
2026-04-08 19:24:44
R W Run
39 By
2026-04-08 19:24:43
R W Run
4.49 KB
2026-04-08 19:24:45
R W Run
3.63 KB
2026-04-08 19:24:45
R W Run
error_log
📄productpricing.php
1<?php
2
3use WHMCS\Application;
4use WHMCS\Billing\Currency;
5use WHMCS\Database\Capsule;
6
7require("../init.php");
8
9/*
10*** USAGE SAMPLES ***
11
12<script language="javascript" src="feeds/productpricing.php?pid=1&currency=1"></script>
13
14<script language="javascript" src="feeds/productpricing.php?pid=5&currency=2"></script>
15
16*/
17 $whmcs = Application::getInstance();
18 $pid = $whmcs->get_req_var('pid');
19 $currencyid = $whmcs->get_req_var('currencyid');
20 $paytype = '';
21
22 // Verify user input for pid exists, is numeric, and as is a valid id
23 $data = null;
24 if (!empty($pid) && ctype_digit($pid)) {
25 $data = Capsule::table('tblproducts')
26 ->where('id', '=', $pid)
27 ->first();
28 }
29 if (!is_object($data)) {
30 widgetoutput('Product ID Not Found');
31 }
32 $pid = $data->id;
33 $paytype = $data->paytype;
34 unset($data);
35
36 $currencyid = $whmcs->get_req_var('currency');
37 // Support for older currencyid variable
38 if (!$currencyid) {
39 $currencyid = $whmcs->get_req_var('currencyid');
40 }
41 if (!is_numeric($currencyid)) {
42 $currency = array();
43 } else {
44 $currency = getCurrency(null, $currencyid);
45 }
46
47 if (!$currency || !is_array($currency) || !isset($currency['id'])) {
48 $currency = Currency::factoryForClientArea();
49 }
50 $currencyid = $currency['id'];
51
52 $data = Capsule::table('tblpricing')
53 ->where('type', '=', 'product')
54 ->where('currency', '=', $currencyid)
55 ->where('relid', '=', $pid)
56 ->first();
57
58 $msetupfee = $data->msetupfee;
59 $qsetupfee = $data->qsetupfee;
60 $ssetupfee = $data->ssetupfee;
61 $asetupfee = $data->asetupfee;
62 $bsetupfee = $data->bsetupfee;
63 $tsetupfee = $data->tsetupfee;
64 $monthly = $data->monthly;
65 $quarterly = $data->quarterly;
66 $semiannually = $data->semiannually;
67 $annually = $data->annually;
68 $biennially = $data->biennially;
69 $triennially = $data->triennially;
70
71 $systemurl = App::getSystemUrl();
72
73 $output = '<form method="post" action="' . $systemurl . 'cart.php?a=add&pid=' . $pid . '">';
74
75 if ($paytype=="free") {
76
77 $output .= $_LANG['orderfree'];
78
79 } elseif ($paytype=="onetime") {
80
81 $output .= formatCurrency($monthly);
82 if ($msetupfee!="0.00") $output .= " + ".formatCurrency($msetupfee)." ".$_LANG['ordersetupfee'];
83
84 } elseif ($paytype=="recurring") {
85
86 $output .= '<select name="billingcycle">';
87
88 if ($triennially>=0) {
89 $output .= '<option value="triennially">'.$_LANG['orderpaymentterm36month'].' - '.formatCurrency($triennially/36).'/mo';
90 if($tsetupfee!="0.00") $output .= " + ".formatCurrency($tsetupfee)." ".$_LANG['ordersetupfee'];
91 $output .= '</option>';
92 }
93
94 if ($biennially>=0) {
95 $output .= '<option value="biennially">'.$_LANG['orderpaymentterm24month'].' - '.formatCurrency($biennially/24).'/mo';
96 if($bsetupfee!="0.00") $output .= " + ".formatCurrency($bsetupfee)." ".$_LANG['ordersetupfee'];
97 $output .= '</option>';
98 }
99
100 if ($annually>=0) {
101 $output .= '<option value="annually">'.$_LANG['orderpaymentterm12month'].' - '.formatCurrency($annually/12).'/mo';
102 if($asetupfee!="0.00") $output .= " + ".formatCurrency($asetupfee)." ".$_LANG['ordersetupfee'];
103 $output .= '</option>';
104 }
105
106 if ($semiannually>=0) {
107 $output .= '<option value="semiannually">'.$_LANG['orderpaymentterm6month'].' - '.formatCurrency($semiannually/6).'/mo';
108 if($ssetupfee!="0.00") $output .= " + ".formatCurrency($ssetupfee)." ".$_LANG['ordersetupfee'];
109 $output .= '</option>';
110 }
111
112 if ($quarterly>=0) {
113 $output .= '<option value="quarterly">'.$_LANG['orderpaymentterm3month'].' - '.formatCurrency($quarterly/3).'/mo';
114 if($qsetupfee!="0.00") $output .= " + ".formatCurrency($qsetupfee)." ".$_LANG['ordersetupfee'];
115 $output .= '</option>';
116 }
117
118 if ($monthly>=0) {
119 $output .= '<option value="monthly">'.$_LANG['orderpaymenttermmonthly'].' - '.formatCurrency($monthly).'/mo';
120 if($msetupfee!="0.00") $output .= " + ".formatCurrency($msetupfee)." ".$_LANG['ordersetupfee'];
121 $output .= '</option>';
122 }
123
124 $output .= '</select>';
125
126 }
127
128 $output .= ' <input type="submit" value="'.$_LANG['domainordernow'].'" /></form>';
129
130 widgetoutput($output);
131
132function widgetoutput($value) {
133 echo "document.write('".addslashes($value)."');";
134 exit;
135}
136