Jump to content

Another order "pending" question...


docex

Recommended Posts

Of course it won't, He had more problems than just what he asked. That was just a fix to make his downloads active. The OP also needs to upgrade to the latest version as he is using V3.5.1 (hopefully not the pirated one). To fix what he asked originally I have answered already on my FIRST post which was obviously too hard and was ignored. Go back and READ it for yourself.

 

 

OK Mr Smart Ass lets nut this out.

 

Q: Where and when are you going to call the API when the invoice is paid?

A: The Actionhook as I sugested in my first post.

Q: Why call the API for a DB UPDATE when it can be done directly where you have to call it from?

A: You Don't.

Q: Why get the API to send the welcome email?

A: You Don't need to, or else the customer will get 2 emails instead of 1.

Q: So why should I USE IT in this instance?

A: Do I really have to answer that one, or are you able to work it out for yourself.

 

You are however correct about one thing the API can send email!!

 

lol sorry sparky i didnt mean to tell YOU to use the API, i got ur name confused with the OP's.

 

Anyway i was under the assumption that the OP needed to set orders to "Active" instead of "Pending" simpyl because he wants them to get the email that gets sent when they become "Active". I was just suggesting he leaves them as "Pending" and uses the API's "send email" function.

 

anyway, docex, if u wanna send an email using the API, use this code

 

<?php

$url = "http://www.yourdomain.com/whmcs/includes/api.php"; # URL to WHMCS API file
$username = "Admin"; # Admin username goes here
$password = "demo"; # Admin password goes here

$postfields["username"] = $username;
$postfields["password"] = md5($password);
$postfields["action"] = "sendemail";
$postfields["messagename"] = "Hosting Account Welcome Email"; // unique name of the email template to send from WHMCS
$postfields["id"] = "1"; // related ID number to send message for

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);

$data = explode(";",$data);
foreach ($data AS $temp) {
 $temp = explode("=",$temp);
 $results[$temp[0]] = $temp[1];
}

if ($results["result"]=="success") {
 # Result was OK!
} else {
 # An error occured
 echo "The following error occured: ".$results["message"];
}

?>

Link to comment
Share on other sites

  • 4 months later...

Hi,

 

Has this been changed yet?

 

I too would like ALL MY ORDERS to be active once someone is paid - which they do when they sign up.

 

I have searched as well and can not find out - or figure out - how to make all orders active once someone orders them.

 

Does anyone have an idea?

Link to comment
Share on other sites

  • 1 month later...
[sorry typo in post (write)]

When an invoice has been paid any code that is in the InvoicePaid actionhook function is run. You can write some code to set the status of the order to Active.

 

Does this only get run when the client pays? Or also when the admin marks an invoice paid?

Link to comment
Share on other sites

Yes. but my custom emails are not being sent per product. Only the default email is being sent. I found out that when a order status is changed to "active", the custom welcome email is sent, so I want to disable the default email and automatically set all orders as "active" so that my custom welcome email is sent... if that makes sense.

 

Where can I find the InvoicePaid action hook? Im searching now, but dont see it.

 

Thanks again for your kind help.

 

If you only want them to get your custom email, not the default (regardless of status), why not just replace the default email text with your custom text?

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
Reply to this topic...

×   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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated