|
@@ -6,15 +6,10 @@ if (!defined("WHMCS"))
|
|
|
die("This file cannot be accessed directly");
|
|
die("This file cannot be accessed directly");
|
|
|
|
|
|
|
|
add_hook('ClientAreaPageCart', 1, function($vars) {
|
|
add_hook('ClientAreaPageCart', 1, function($vars) {
|
|
|
- // check client login status
|
|
|
|
|
- if(!isset($vars['clientsdetails']['id'])) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
$active_pids = array();
|
|
$active_pids = array();
|
|
|
$free_pids = array();
|
|
$free_pids = array();
|
|
|
$card_pids = array();
|
|
$card_pids = array();
|
|
|
$free_card_pids = array();
|
|
$free_card_pids = array();
|
|
|
- $clientId = $vars['clientsdetails']['id'];
|
|
|
|
|
foreach($_SESSION['cart']['products'] as $item) {
|
|
foreach($_SESSION['cart']['products'] as $item) {
|
|
|
array_push($card_pids, $item['pid']);
|
|
array_push($card_pids, $item['pid']);
|
|
|
if($item['billingcycle'] == null) {
|
|
if($item['billingcycle'] == null) {
|
|
@@ -22,7 +17,17 @@ add_hook('ClientAreaPageCart', 1, function($vars) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
$free_card_double_pids = array_unique(array_diff_assoc($free_card_pids, array_unique($free_card_pids)));
|
|
$free_card_double_pids = array_unique(array_diff_assoc($free_card_pids, array_unique($free_card_pids)));
|
|
|
|
|
+ // check client login status
|
|
|
|
|
+ if(!isset($vars['clientsdetails']['id'])) {
|
|
|
|
|
+ return array('clientPids' => [],
|
|
|
|
|
+ 'clientActiveFree' => [],
|
|
|
|
|
+ 'clientCard' => $card_pids,
|
|
|
|
|
+ 'clientCardFree' => $free_card_pids,
|
|
|
|
|
+ 'clientCradDoubleFree' => $free_card_double_pids
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
// get client products
|
|
// get client products
|
|
|
|
|
+ $clientId = $vars['clientsdetails']['id'];
|
|
|
$clientProducts = localAPI('GetClientsProducts', array('clientid' => $clientId, 'stats' => false));
|
|
$clientProducts = localAPI('GetClientsProducts', array('clientid' => $clientId, 'stats' => false));
|
|
|
if(!$clientProducts['result'] == 'success'){
|
|
if(!$clientProducts['result'] == 'success'){
|
|
|
return array('clientPids' => [],
|
|
return array('clientPids' => [],
|