|
|
@@ -15,10 +15,30 @@ add_hook('ClientAreaPageCart', 1, function($vars) {
|
|
|
$card_pids = array();
|
|
|
$free_card_pids = array();
|
|
|
$clientId = $vars['clientsdetails']['id'];
|
|
|
+ foreach($_SESSION['cart']['products'] as $item) {
|
|
|
+ array_push($card_pids, $item['pid']);
|
|
|
+ if($item['billingcycle'] == null) {
|
|
|
+ array_push($free_card_pids, $item['pid']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $free_card_double_pids = array_unique(array_diff_assoc($free_card_pids, array_unique($free_card_pids)));
|
|
|
// get client products
|
|
|
$clientProducts = localAPI('GetClientsProducts', array('clientid' => $clientId, 'stats' => false));
|
|
|
if(!$clientProducts['result'] == 'success'){
|
|
|
- return;
|
|
|
+ return array('clientPids' => [],
|
|
|
+ 'clientActiveFree' => [],
|
|
|
+ 'clientCard' => $card_pids,
|
|
|
+ 'clientCardFree' => $free_card_pids,
|
|
|
+ 'clientCradDoubleFree' => $free_card_double_pids
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if(empty($clientProducts['products'])){
|
|
|
+ return array('clientPids' => [],
|
|
|
+ 'clientActiveFree' => [],
|
|
|
+ 'clientCard' => $card_pids,
|
|
|
+ 'clientCardFree' => $free_card_pids,
|
|
|
+ 'clientCradDoubleFree' => $free_card_double_pids
|
|
|
+ );
|
|
|
}
|
|
|
foreach($clientProducts['products']['product'] as $product) {
|
|
|
array_push($active_pids, $product['pid']);
|
|
|
@@ -26,12 +46,10 @@ add_hook('ClientAreaPageCart', 1, function($vars) {
|
|
|
array_push($free_pids, $product['pid']);
|
|
|
}
|
|
|
}
|
|
|
- foreach($_SESSION['cart']['products'] as $item) {
|
|
|
- array_push($card_pids, $item['pid']);
|
|
|
- if($item['billingcycle'] == null) {
|
|
|
- array_push($free_card_pids, $item['pid']);
|
|
|
- }
|
|
|
- }
|
|
|
- $free_card_double_pids = array_unique(array_diff_assoc($free_card_pids, array_unique($free_card_pids)));
|
|
|
- return array('clientPids' => $active_pids, 'clientActiveFree' => $free_pids, 'clientCard' => $card_pids, 'clientCardFree' => $free_card_pids, 'clientCardDoubleFree' => $free_card_double_pids);
|
|
|
+ return array('clientPids' => $active_pids,
|
|
|
+ 'clientActiveFree' => $free_pids,
|
|
|
+ 'clientCard' => $card_pids,
|
|
|
+ 'clientCardFree' => $free_card_pids,
|
|
|
+ 'clientCradDoubleFree' => $free_card_double_pids
|
|
|
+ );
|
|
|
});
|