|
@@ -13,147 +13,147 @@ require("../../init.php");
|
|
|
<script language="javascript" src="feeds/producttotalpricing.php?pid=5¤cy=2"></script>
|
|
<script language="javascript" src="feeds/producttotalpricing.php?pid=5¤cy=2"></script>
|
|
|
|
|
|
|
|
*/
|
|
*/
|
|
|
- $whmcs = Application::getInstance();
|
|
|
|
|
- $pid = $whmcs->get_req_var('pid');
|
|
|
|
|
- $currencyid = $whmcs->get_req_var('currencyid');
|
|
|
|
|
-
|
|
|
|
|
- // Verify user input for pid exists, is numeric, and as is a valid id
|
|
|
|
|
- if (is_numeric($pid)) {
|
|
|
|
|
- $data = Capsule::table('tblproducts')
|
|
|
|
|
- ->where('id', '=', $pid)
|
|
|
|
|
- ->first();
|
|
|
|
|
- $pid = $data->id;
|
|
|
|
|
- $paytype = $data->paytype;
|
|
|
|
|
- } else {
|
|
|
|
|
- $pid = '';
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (!$pid) {
|
|
|
|
|
- widgetoutput('Product ID Not Found');
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $currencyid = $whmcs->get_req_var('currency');
|
|
|
|
|
- // Support for older currencyid variable
|
|
|
|
|
- if (!$currencyid) {
|
|
|
|
|
- $currencyid = $whmcs->get_req_var('currencyid');
|
|
|
|
|
- }
|
|
|
|
|
- if (!is_numeric($currencyid)) {
|
|
|
|
|
- $currency = array();
|
|
|
|
|
- } else {
|
|
|
|
|
- $currency = getCurrency('', $currencyid);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (!$currency || !is_array($currency) || !isset($currency['id'])) {
|
|
|
|
|
- $currency = getCurrency();
|
|
|
|
|
- }
|
|
|
|
|
- $currencyid = $currency['id'];
|
|
|
|
|
-
|
|
|
|
|
- $data = Capsule::table('tblpricing')
|
|
|
|
|
- ->where('type', '=', 'product')
|
|
|
|
|
- ->where('currency', '=', $currencyid)
|
|
|
|
|
- ->where('relid', '=', $pid)
|
|
|
|
|
|
|
+$whmcs = Application::getInstance();
|
|
|
|
|
+$pid = $whmcs->get_req_var('pid');
|
|
|
|
|
+$currencyid = $whmcs->get_req_var('currencyid');
|
|
|
|
|
+
|
|
|
|
|
+// Verify user input for pid exists, is numeric, and as is a valid id
|
|
|
|
|
+if (is_numeric($pid)) {
|
|
|
|
|
+ $data = Capsule::table('tblproducts')
|
|
|
|
|
+ ->where('id', '=', $pid)
|
|
|
->first();
|
|
->first();
|
|
|
|
|
+ $pid = $data->id;
|
|
|
|
|
+ $paytype = $data->paytype;
|
|
|
|
|
+} else {
|
|
|
|
|
+ $pid = '';
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- $msetupfee = $data->msetupfee;
|
|
|
|
|
- $qsetupfee = $data->qsetupfee;
|
|
|
|
|
- $ssetupfee = $data->ssetupfee;
|
|
|
|
|
- $asetupfee = $data->asetupfee;
|
|
|
|
|
- $bsetupfee = $data->bsetupfee;
|
|
|
|
|
- $tsetupfee = $data->tsetupfee;
|
|
|
|
|
- $monthly = $data->monthly;
|
|
|
|
|
- $quarterly = $data->quarterly;
|
|
|
|
|
- $semiannually = $data->semiannually;
|
|
|
|
|
- $annually = $data->annually;
|
|
|
|
|
- $biennially = $data->biennially;
|
|
|
|
|
- $triennially = $data->triennially;
|
|
|
|
|
-
|
|
|
|
|
- $configOptionsGroupID = Capsule::table('tblproductconfiglinks')
|
|
|
|
|
- ->where('pid', '=', $pid)
|
|
|
|
|
- ->select('gid')
|
|
|
|
|
- ->first();
|
|
|
|
|
-
|
|
|
|
|
- $configOptions = Capsule::table('tblproductconfigoptions')
|
|
|
|
|
- ->where('gid', '=', $configOptionsGroupID->gid)
|
|
|
|
|
- ->select('id','qtyminimum')
|
|
|
|
|
- ->get();
|
|
|
|
|
-
|
|
|
|
|
- foreach($configOptions as $configOption) {
|
|
|
|
|
- $configOptionSub = Capsule::table('tblproductconfigoptionssub')
|
|
|
|
|
- ->where('configid', '=', $configOption->id)
|
|
|
|
|
- ->select('id')
|
|
|
|
|
- ->first();
|
|
|
|
|
- $configOptionPrices = Capsule::table('tblpricing')
|
|
|
|
|
- ->where('type', '=', 'configoptions')
|
|
|
|
|
- ->where('relid', '=', $configOptionSub->id)
|
|
|
|
|
- ->where('currency', '=', $currencyid)
|
|
|
|
|
- ->first();
|
|
|
|
|
-
|
|
|
|
|
- $msetupfee += $configOptionPrices->msetupfee * $configOption->qtyminimum;
|
|
|
|
|
- $qsetupfee += $configOptionPrices->qsetupfee * $configOption->qtyminimum;
|
|
|
|
|
- $ssetupfee += $configOptionPrices->ssetupfee * $configOption->qtyminimum;
|
|
|
|
|
- $asetupfee += $configOptionPrices->asetupfee * $configOption->qtyminimum;
|
|
|
|
|
- $bsetupfee += $configOptionPrices->bsetupfee * $configOption->qtyminimum;
|
|
|
|
|
- $tsetupfee += $configOptionPrices->tsetupfee * $configOption->qtyminimum;
|
|
|
|
|
- $monthly += $configOptionPrices->monthly * $configOption->qtyminimum;
|
|
|
|
|
- $quarterly += $configOptionPrices->quarterly * $configOption->qtyminimum;
|
|
|
|
|
- $semiannually += $configOptionPrices->semiannually * $configOption->qtyminimum;
|
|
|
|
|
- $annually += $configOptionPrices->annually * $configOption->qtyminimum;
|
|
|
|
|
- $biennially += $configOptionPrices->biennially * $configOption->qtyminimum;
|
|
|
|
|
- $triennially += $configOptionPrices->triennially * $configOption->qtyminimum;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+if (!$pid) {
|
|
|
|
|
+ widgetoutput('Product ID Not Found');
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- $systemurl = App::getSystemUrl();
|
|
|
|
|
|
|
+$currencyid = $whmcs->get_req_var('currency');
|
|
|
|
|
+// Support for older currencyid variable
|
|
|
|
|
+if (!$currencyid) {
|
|
|
|
|
+ $currencyid = $whmcs->get_req_var('currencyid');
|
|
|
|
|
+}
|
|
|
|
|
+if (!is_numeric($currencyid)) {
|
|
|
|
|
+ $currency = array();
|
|
|
|
|
+} else {
|
|
|
|
|
+ $currency = getCurrency('', $currencyid);
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- if ($paytype=="free") {
|
|
|
|
|
|
|
+if (!$currency || !is_array($currency) || !isset($currency['id'])) {
|
|
|
|
|
+ $currency = getCurrency();
|
|
|
|
|
+}
|
|
|
|
|
+$currencyid = $currency['id'];
|
|
|
|
|
+
|
|
|
|
|
+$data = Capsule::table('tblpricing')
|
|
|
|
|
+ ->where('type', '=', 'product')
|
|
|
|
|
+ ->where('currency', '=', $currencyid)
|
|
|
|
|
+ ->where('relid', '=', $pid)
|
|
|
|
|
+ ->first();
|
|
|
|
|
+
|
|
|
|
|
+$msetupfee = $data->msetupfee;
|
|
|
|
|
+$qsetupfee = $data->qsetupfee;
|
|
|
|
|
+$ssetupfee = $data->ssetupfee;
|
|
|
|
|
+$asetupfee = $data->asetupfee;
|
|
|
|
|
+$bsetupfee = $data->bsetupfee;
|
|
|
|
|
+$tsetupfee = $data->tsetupfee;
|
|
|
|
|
+$monthly = $data->monthly;
|
|
|
|
|
+$quarterly = $data->quarterly;
|
|
|
|
|
+$semiannually = $data->semiannually;
|
|
|
|
|
+$annually = $data->annually;
|
|
|
|
|
+$biennially = $data->biennially;
|
|
|
|
|
+$triennially = $data->triennially;
|
|
|
|
|
+
|
|
|
|
|
+$configOptionsGroupID = Capsule::table('tblproductconfiglinks')
|
|
|
|
|
+->where('pid', '=', $pid)
|
|
|
|
|
+->select('gid')
|
|
|
|
|
+->first();
|
|
|
|
|
+
|
|
|
|
|
+$configOptions = Capsule::table('tblproductconfigoptions')
|
|
|
|
|
+->where('gid', '=', $configOptionsGroupID->gid)
|
|
|
|
|
+->select('id','qtyminimum')
|
|
|
|
|
+->get();
|
|
|
|
|
+
|
|
|
|
|
+foreach($configOptions as $configOption) {
|
|
|
|
|
+$configOptionSub = Capsule::table('tblproductconfigoptionssub')
|
|
|
|
|
+ ->where('configid', '=', $configOption->id)
|
|
|
|
|
+ ->select('id')
|
|
|
|
|
+ ->first();
|
|
|
|
|
+$configOptionPrices = Capsule::table('tblpricing')
|
|
|
|
|
+ ->where('type', '=', 'configoptions')
|
|
|
|
|
+ ->where('relid', '=', $configOptionSub->id)
|
|
|
|
|
+ ->where('currency', '=', $currencyid)
|
|
|
|
|
+ ->first();
|
|
|
|
|
+
|
|
|
|
|
+$msetupfee += $configOptionPrices->msetupfee * $configOption->qtyminimum;
|
|
|
|
|
+$qsetupfee += $configOptionPrices->qsetupfee * $configOption->qtyminimum;
|
|
|
|
|
+$ssetupfee += $configOptionPrices->ssetupfee * $configOption->qtyminimum;
|
|
|
|
|
+$asetupfee += $configOptionPrices->asetupfee * $configOption->qtyminimum;
|
|
|
|
|
+$bsetupfee += $configOptionPrices->bsetupfee * $configOption->qtyminimum;
|
|
|
|
|
+$tsetupfee += $configOptionPrices->tsetupfee * $configOption->qtyminimum;
|
|
|
|
|
+$monthly += $configOptionPrices->monthly * $configOption->qtyminimum;
|
|
|
|
|
+$quarterly += $configOptionPrices->quarterly * $configOption->qtyminimum;
|
|
|
|
|
+$semiannually += $configOptionPrices->semiannually * $configOption->qtyminimum;
|
|
|
|
|
+$annually += $configOptionPrices->annually * $configOption->qtyminimum;
|
|
|
|
|
+$biennially += $configOptionPrices->biennially * $configOption->qtyminimum;
|
|
|
|
|
+$triennially += $configOptionPrices->triennially * $configOption->qtyminimum;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- $output .= $_LANG['orderfree'];
|
|
|
|
|
|
|
+$systemurl = App::getSystemUrl();
|
|
|
|
|
|
|
|
- } elseif ($paytype=="onetime") {
|
|
|
|
|
|
|
+if ($paytype=="free") {
|
|
|
|
|
|
|
|
- $output .= formatCurrency($monthly);
|
|
|
|
|
- if ($msetupfee!="0.00") $output .= " + ".formatCurrency($msetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
|
|
+ $output .= $_LANG['orderfree'];
|
|
|
|
|
|
|
|
- } elseif ($paytype=="recurring") {
|
|
|
|
|
|
|
+} elseif ($paytype=="onetime") {
|
|
|
|
|
|
|
|
- if ($monthly>=0) {
|
|
|
|
|
- $output .= '<option value="monthly">'.formatCurrency($monthly).' - '.$_LANG['orderpaymenttermmonthly'];
|
|
|
|
|
- if($msetupfee!="0.00") $output .= " + ".formatCurrency($msetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
- $output .= '</option>';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $output .= formatCurrency($monthly);
|
|
|
|
|
+ if ($msetupfee!="0.00") $output .= " + ".formatCurrency($msetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
|
|
|
- if ($quarterly>=0) {
|
|
|
|
|
- $output .= '<option value="quarterly">'.formatCurrency($quarterly).' - '.$_LANG['orderpaymentterm3month'];
|
|
|
|
|
- if($qsetupfee!="0.00") $output .= " + ".formatCurrency($qsetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
- $output .= '</option>';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+} elseif ($paytype=="recurring") {
|
|
|
|
|
|
|
|
- if ($semiannually>=0) {
|
|
|
|
|
- $output .= '<option value="semiannually">'.formatCurrency($semiannually).' - '.$_LANG['orderpaymentterm6month'];
|
|
|
|
|
- if($ssetupfee!="0.00") $output .= " + ".formatCurrency($ssetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
- $output .= '</option>';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if ($monthly>=0) {
|
|
|
|
|
+ $output .= '<option value="monthly">'.formatCurrency($monthly).' - '.$_LANG['orderpaymenttermmonthly'];
|
|
|
|
|
+ if($msetupfee!="0.00") $output .= " + ".formatCurrency($msetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
+ $output .= '</option>';
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if ($annually>=0) {
|
|
|
|
|
- $output .= '<option value="annually">'.formatCurrency($annually).' - '.$_LANG['orderpaymentterm12month'];
|
|
|
|
|
- if($asetupfee!="0.00") $output .= " + ".formatCurrency($asetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
- $output .= '</option>';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if ($quarterly>=0) {
|
|
|
|
|
+ $output .= '<option value="quarterly">'.formatCurrency($quarterly).' - '.$_LANG['orderpaymentterm3month'];
|
|
|
|
|
+ if($qsetupfee!="0.00") $output .= " + ".formatCurrency($qsetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
+ $output .= '</option>';
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if ($biennially>=0) {
|
|
|
|
|
- $output .= '<option value="biennially">'.formatCurrency($biennially).' - '.$_LANG['orderpaymentterm24month'];
|
|
|
|
|
- if($bsetupfee!="0.00") $output .= " + ".formatCurrency($bsetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
- $output .= '</option>';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if ($semiannually>=0) {
|
|
|
|
|
+ $output .= '<option value="semiannually">'.formatCurrency($semiannually).' - '.$_LANG['orderpaymentterm6month'];
|
|
|
|
|
+ if($ssetupfee!="0.00") $output .= " + ".formatCurrency($ssetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
+ $output .= '</option>';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($annually>=0) {
|
|
|
|
|
+ $output .= '<option value="annually">'.formatCurrency($annually).' - '.$_LANG['orderpaymentterm12month'];
|
|
|
|
|
+ if($asetupfee!="0.00") $output .= " + ".formatCurrency($asetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
+ $output .= '</option>';
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if ($triennially>=0) {
|
|
|
|
|
- $output .= '<option value="triennially">'.formatCurrency($triennially).' - '.$_LANG['orderpaymentterm36month'];
|
|
|
|
|
- if($tsetupfee!="0.00") $output .= " + ".formatCurrency($tsetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
- $output .= '</option>';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if ($biennially>=0) {
|
|
|
|
|
+ $output .= '<option value="biennially">'.formatCurrency($biennially).' - '.$_LANG['orderpaymentterm24month'];
|
|
|
|
|
+ if($bsetupfee!="0.00") $output .= " + ".formatCurrency($bsetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
+ $output .= '</option>';
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ if ($triennially>=0) {
|
|
|
|
|
+ $output .= '<option value="triennially">'.formatCurrency($triennially).' - '.$_LANG['orderpaymentterm36month'];
|
|
|
|
|
+ if($tsetupfee!="0.00") $output .= " + ".formatCurrency($tsetupfee)." ".$_LANG['ordersetupfee'];
|
|
|
|
|
+ $output .= '</option>';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- widgetoutput($output);
|
|
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+widgetoutput($output);
|
|
|
|
|
|
|
|
function widgetoutput($value) {
|
|
function widgetoutput($value) {
|
|
|
echo "document.write('".$value."');";
|
|
echo "document.write('".$value."');";
|