|
|
@@ -0,0 +1,24 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+// returns an array of product ids already bought be the client
|
|
|
+
|
|
|
+if (!defined("WHMCS"))
|
|
|
+ die("This file cannot be accessed directly");
|
|
|
+
|
|
|
+add_hook('ClientAreaPageCart', 1, function($vars) {
|
|
|
+ // check client login status
|
|
|
+ if(!isset($vars['clientsdetails']['id'])) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $active_pids = array();
|
|
|
+ $clientId = $vars['clientsdetails']['id'];
|
|
|
+ // get client products
|
|
|
+ $clientProducts = localAPI('GetClientsProducts', array('clientid' => $clientId, 'stats' => false));
|
|
|
+ if(!$clientProducts['result'] == 'success'){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ foreach($clientProducts['products']['product'] as $product) {
|
|
|
+ array_push($active_pids, $product['pid']);
|
|
|
+ }
|
|
|
+ return array('clientPids' => $active_pids);
|
|
|
+});
|