HostX Template:
If you were using HostX v2.1.1 or any previous version and now upgraded to Hostx v2.2.0 then Billing Cycle and Order Now options might not be displaying on your VPS type page.

Here are the steps to fix it:
Step 1. Make sure you have uploaded the following files in the root path of your WHMCS

Step 2. If you have created any other file besides these files for your VPS type page for example: sharedhosting.php, example.php, then follow the next steps to get rid of this issue:
- Log in to your FTP or cPnel
- Navigate to the root path of whmcs directory
- Edit the file you have created later for your VPS type page (for example sharedhosting.php or example.php)
- Now copy the subsequent code
$ca->initPage();
$pageName = basename($_SERVER['PHP_SELF']);
$pageData = Capsule::table("mod_hostx_pages")->where('pageTitle',$pageName)->first();
$gid = $pageData->productGroup;
function get_currency(){
$clientCurrency = '';
if (isset($_SESSION['uid']) && !empty($_SESSION['uid'])) {
$clientCurrency = Capsule::table('tblclients')->select('currency')->where('id', $_SESSION['uid'])->get();
}
if (isset($clientCurrency) && !empty($clientCurrency) && $clientCurrency[0]->currency != '0') {
$currency = Capsule::table('tblcurrencies')->where('id', $clientCurrency[0]->currency)->first();
} else if (isset($_SESSION['currency']) && !empty($_SESSION['currency'])) {
$currency = Capsule::table('tblcurrencies')->where('id', $_SESSION['currency'])->first();
} else {
$currency = Capsule::table('tblcurrencies')->where('default', '1')->first();
}
return $currency;
}
function wgs_fetch_product_detail_according_to_language_hostx($language,$relid,$for){
if($for == 'pname'){
$dataReturn = Capsule::table('tbldynamic_translations')->where('related_type','product.{id}.name')->where('related_id',$relid)->where('language',$language)->first();
}else if($for == 'pdescp'){
$dataReturn = Capsule::table('tbldynamic_translations')->where('related_type','product.{id}.description')->where('related_id',$relid)->where('language',$language)->first();
}else if($for == 'pgroupname'){
$dataReturn = Capsule::table('tbldynamic_translations')->where('related_type','product_group.{id}.name')->where('related_id',$relid)->where('language',$language)->first();
}
return $dataReturn;
}
function wgs_get_dynmic_translation_page($related_type,$related_id,$language){
return Capsule::table('mod_hostx_dynmic_translation')->where('related_type',$related_type)->where('related_id',$related_id)->where('language',$language)->first();
}
if(!empty($gid)){
global $_LANG;
$command = 'GetProducts';
$postData = array('gid' => $gid);
$adminUsername = ''; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
$currency = get_currency();
$currenciCode = $currency->code;
$checkForTranslationGroup = Capsule::table('tblconfiguration')->where('setting','EnableTranslations')->first();
$languageVars = $_LANG;
$productsData = [];
$arrayCycles = [];
foreach($results['products']['product'] as $pData){
$chkHidden = Capsule::table('tblproducts')->where('id', $pData['pid'])->where('hidden', 'on')->count();
if($chkHidden!='0'){
$dataPrices = $pData['pricing'][$currenciCode];
$pData['pricing'] = $pData['pricing'][$currenciCode];
$pData['pricing']['monthly'] = formatCurrency($pData['pricing']['monthly'],$currency->id)->toPrefixed();
$pData['pricing']['quarterly'] = formatCurrency($pData['pricing']['quarterly'],$currency->id)->toPrefixed();
$pData['pricing']['semiannually'] = formatCurrency($pData['pricing']['semiannually'],$currency->id)->toPrefixed();
$pData['pricing']['annually'] = formatCurrency($pData['pricing']['annually'],$currency->id)->toPrefixed();
$pData['pricing']['biennially'] = formatCurrency($pData['pricing']['biennially'],$currency->id)->toPrefixed();
$pData['pricing']['triennially'] = formatCurrency($pData['pricing']['triennially'],$currency->id)->toPrefixed();
$pDesc = Capsule::table('mod_hostx_page_products')->select('pHeadSortDesc','pDescription','pFootCaption','pFootSortDesc')->where('productId', $pData['pid'])->where('pageId', $pageData->id)->first();
if($checkForTranslationGroup->value == 1){
if(isset($_SESSION['Language'])){
$getPname = wgs_fetch_product_detail_according_to_language_hostx($_SESSION['Language'],$pData['pid'],'pname');
$getPdescp = wgs_fetch_product_detail_according_to_language_hostx($_SESSION['Language'],$pData['pid'],'pdescp');
$productName = ($getPname->translation != '' ? $getPname->translation : $pData['name']);
$productDescp = ($getPdescp->translation != '' ? $getPdescp->translation : $pData['description']);
}else{
$productName = $pData['name'];
$productDescp = $pData['description'];
}
$pData['name'] = $productName;
$pDesc->pDescription = $productDescp;
}
if(isset($_SESSION['Language'])){
$pHeadSortCol = 'pHeadSortDesc-'.$pData['pid'].'-'.$pageData->id;
$headSortDesc = wgs_get_dynmic_translation_page('vpspage.{id}.pHeadSortDesc',$pHeadSortCol,$_SESSION['Language']);
if($headSortDesc->value != ''){
$pDesc->pHeadSortDesc = $headSortDesc->value;
}
$pFootSortCol = 'pFootSortDesc-'.$pData['pid'].'-'.$pageData->id;
$footSortDesc = wgs_get_dynmic_translation_page('vpspage.{id}.pFootSortDesc',$pFootSortCol,$_SESSION['Language']);
if($footSortDesc->value != ''){
$pDesc->pFootSortDesc = $footSortDesc->value;
}
$pFootCaptionCol = 'pFootCaption-'.$pData['pid'].'-'.$pageData->id;
$footSortCaptio = wgs_get_dynmic_translation_page('vpspage.{id}.pFootCaption',$pFootCaptionCol,$_SESSION['Language']);
if($footSortCaptio->value != ''){
$pDesc->pFootCaption = $footSortCaptio->value;
}
}
if(!empty($pDesc)){
$pDesc = (array) $pDesc;
}else{
require_once __DIR__ . '/modules/addons/hostx/defaultmenu.php';
$pDesc = $defaultPData;
}
$pDesc['pHeadSortDesc'] = html_entity_decode($pDesc['pHeadSortDesc']);
$pDesc['pDescription'] = html_entity_decode($pDesc['pDescription']);
$pDesc['pFootCaption'] = html_entity_decode($pDesc['pFootCaption']);
$pDesc['pFootSortDesc'] = html_entity_decode($pDesc['pFootSortDesc']);
$pData['customDescription'] = $pDesc;
$productsData[] = $pData;
if($dataPrices['monthly'] >= 0 ){
$arrayCycles['monthly'] = 'monthly';
}
if($dataPrices['quarterly'] >= 0 ){
$arrayCycles['quarterly'] = 'quarterly';
}
if($dataPrices['semiannually'] >= 0 ){
$arrayCycles['semiannually'] = 'semiannually';
}
if($dataPrices['annually'] >= 0 ){
$arrayCycles['annually'] = 'annually';
}
if($dataPrices['biennially'] >= 0 ){
$arrayCycles['biennially'] = 'biennially';
}
if($dataPrices['triennially'] >= 0 ){
$arrayCycles['triennially'] = 'triennially';
}
}
}
}
$ca->assign('productsDataCycles', $arrayCycles);
$ca->assign('productsData', $productsData);
$ca->assign('sidebarHostxRemove', 'true');
$ca->setTemplate('hostx');
$ca->output();
- After this, replace the following code (displayed in the screenshot) with the above-mentioned code:
