Jump to content
  • 0

Get If A Client Has Purchased A Service, Via Api


a.daniello

Question

8 answers to this question

Recommended Posts

  • 0

to be more clear , let say the package you want to search for it has id "5" , you can get package id from the package page .

call Services::getList() .

$services = $api->Services->getList($client_id);
$num_services = count($services) ; 

for ($i=0; $i<$num_services; $i++) {
    if ($services->getList->service[$i]->pricing_id == $package_id)
        echo "The Client ID ". $client_id ." has the service searched , with id ". $services->getList->service[$i]->id ."\n";
}
Link to comment
Share on other sites

  • 0

naja7host, it works!!!

 

Many many thanks!!

 

Only a little question/curiosity: you use this sintax to call api

$services = $api->Services->getList($client_id);

but i use (and only in this matter works)

$api = new BlestaApi($url_api, $user, $key);
...
$services = $api->post("services", "getList", array('client_id' => $client_id ));

Why if i use your sintax it not works?

 

Thanks,

Achille

Link to comment
Share on other sites

  • 0

my code is not 100% API, is just a typo to how the code work in normal plugin , then you need to convert it to API .

as before i test anything in API , i test it internally to se if i get what i need, then i convert ot api call .

so you code is correct for API call , and my code is correct for internal call .

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...