Jump to content

Checkout error with SMS enable


Strats

Recommended Posts

Hi guys,

I need some help configuring the "Recieve SMS when you get new Order". I have followed carefully all steps as described at http://forums.whmcs.com/viewtopic.php?t=5272 The problem is that on new orders now, after step4 when we go to the step=checkout, client sees a white page with just:

37902aedb827acb290cb7d574a0f5992208

 

The funny thing is that I received the SMSs with no prob and the order seems complete, also the emails are sent. Only that client can't see the checkout page. I have checked my checkoutscript.php for extra spaces but I don't find anythig.

 

Any ideas what this can be?

 

Thanks

Link to comment
Share on other sites

I've been advised by lainard (thanks a lot replying mate) I have added the following on my checkoutscript.php

 

META HTTP-EQUIV="Refresh"
CONTENT="5; URL=https://www.domain.com/whmcs/viewinvoice.php?id=1">

 

Now, the page after step4 is completely blank and no sms receive

 

My exact code on my checkoutscript.php was:

 

<?php
/*
**************************************************
************** WHMCS CheckOut Script *************
**************************************************
You may enter code here which will be run when
a user checks out if you have enabled it in
Configuration > General Configuration > Other
of your WHMCS Admin Area.  The following
variables are available to you:
**************************************************
Order ID: $orderid
Order Number: $ordernumber
Invoice ID: $invoiceid
Product ID: $productid
Domains Array: $domains
Addons Array: $addons
**************************************************
*/
require_once ("sms_api.php");
$mysms = new sms();
echo $mysms->session;
echo $mysms->getbalance();
// $mysms->token_pay("1234567890123456"); //spend voucher with SMS credits
$mysms->send ("my phone", "Company", "Order: $domains Invoice ID: $invoiceid Product ID: $productid");

?>

 

where of course myphone and company is changed :)

 

Any idea???

Link to comment
Share on other sites

  • WHMCS CEO

The reason it's not redirected automatically is because you have it outputing data to the screen. The better solution is to fix that issue rather than use a workaround as you are doing with the above meta refresh redirect which won't work unless the users invoice id is 1.

 

Matt

Link to comment
Share on other sites

I think what Matt is saying is that normally the checkoutscript.php doesn't output anything back to the browser.

 

The issue appears to be an order problem. All HTTP headers must be sent to the client before the body of the message. The redirection is via HTTP header that's set after the checkoutscript.php is called (if it was sent first, the client might break connection and PHP abort script processing). But because your code outputs to the client PHP can't add any more headers, so there's no redirection.

 

The solution appears to be to stop outputting anything to the client -- like the echo statements.

 

[Edit]-- What he said :D [/Edit]

Link to comment
Share on other sites

Hey guys, I feel like I speak no english at all :D Lol, how embarrassed I feel :D

 

What I don't get (emm, actually I don't get anything) is how this code works for some of you and not in my whmcs. Also trying to translate the above, I think Matt is talking about the sms_api.php which outputs somthing while brianr is talking about checkoutscript.php that outputs...

 

Anyway, if it's so complicated, let forget about it :)

Link to comment
Share on other sites

remove/comment these two lines

 

echo $mysms->session; 
echo $mysms->getbalance(); 

become

 

//echo $mysms->session; 
//echo $mysms->getbalance(); 

and those session will not appear and do not forget to leave the meta http redirect

META HTTP-EQUIV="Refresh" 
CONTENT="5; URL=https://www.domain.com/whmcs/yoursuccessfullpage.html">

Link to comment
Share on other sites

 

Post here your checkoutscript.php

 

<?php
/*
**************************************************
************** WHMCS CheckOut Script *************
**************************************************
You may enter code here which will be run when
a user checks out if you have enabled it in
Configuration > General Configuration > Other
of your WHMCS Admin Area.  The following
variables are available to you:
**************************************************
Order ID: $orderid
Order Number: $ordernumber
Invoice ID: $invoiceid
Product ID: $productid
Domains Array: $domains
Addons Array: $addons
**************************************************
*/
require_once ("sms_api.php");
$mysms = new sms();
//echo $mysms->session;
//echo $mysms->getbalance();
//$mysms->token_pay("1234567890123456"); //spend voucher with SMS credits
$mysms->send ("phone", "MyCompany", "Order: $domains Invoice ID: $invoiceid Product ID: $productid");
META HTTP-EQUIV="Refresh"
CONTENT="5; URL=https://www.mycomapny.com/transaction_complete.html">

?>

Link to comment
Share on other sites

here for you

 

<?php 
/* 
************************************************** 
************** WHMCS CheckOut Script ************* 
************************************************** 
You may enter code here which will be run when 
a user checks out if you have enabled it in 
Configuration > General Configuration > Other 
of your WHMCS Admin Area.  The following 
variables are available to you: 
************************************************** 
Order ID: $orderid 
Order Number: $ordernumber 
Invoice ID: $invoiceid 
Product ID: $productid 
Domains Array: $domains 
Addons Array: $addons 
************************************************** 
*/ 
require_once ("sms_api.php"); 
$mysms = new sms(); 
//echo $mysms->session; 
//echo $mysms->getbalance(); 
//$mysms->token_pay("1234567890123456"); //spend voucher with SMS credits 
$mysms->send ("Number of your heone", "SigmaWeb", "Order: $domains Invoice ID: $invoiceid Product ID: $productid"); 
?>


<html>
<head>
META HTTP-EQUIV="Refresh" CONTENT="5; URL=https://www.yourweb.com/transaction_complete.html"> 
</head>
<body>
Please wait you are being redirected
if you are not redirected in few second Please click [url="https://www.yourweb.com/transaction_complete.html"]here[/url]
</body>
</html>

 

it should work now

Link to comment
Share on other sites

The code above gives me this error:

 

META HTTP-EQUIV="Refresh" CONTENT="5; URL=https://www.mydomain.com/transaction_complete.html"> Please wait you are being redirected if you are not redirected in few second Please click here

 

:(

 

 

 

double check dude

and copy paste those code above

HINT!!

</head>

Link to comment
Share on other sites

<head>

META HTTP-EQUIV="Refresh" CONTENT="5;URL=https://www.mydomain.com/transaction_complete.html">

 

Missing < before META

 

AMEN!!!!! :D floyd, I would kiss you if I were there mate :D hahaha

 

Last: what is the exact syntax of the last step where the client sees the invoice? This has to be my redirect link. Like viewinvoice.php?id=298 but is there a variable for the invoice ID?

Link to comment
Share on other sites

I have never used the checkout script but from reading it:

 

Order ID: $orderid

Order Number: $ordernumber

Invoice ID: $invoiceid

Product ID: $productid

Domains Array: $domains

Addons Array: $addons

 

Looks like $invoiceid is what you are looking for.

Link to comment
Share on other sites

I have never used the checkout script but from reading it:

 

Order ID: $orderid

Order Number: $ordernumber

Invoice ID: $invoiceid

Product ID: $productid

Domains Array: $domains

Addons Array: $addons

 

Looks like $invoiceid is what you are looking for.

 

Hmmm, the above don't work. There must be another way to redirect to clients order invoice.

Link to comment
Share on other sites

Your meta refresh should look like:

 

<META HTTP-EQUIV="Refresh"
CONTENT="0; URL=https://www.domain.com/whmcs/viewinvoice.php?id=$invoiceid">

 

I use 0 because I want an immediate redirection not a 5 second delay.

 

What is the result you get? Do you get the proper link when you also use:

 

Please wait you are being redirected if you are not redirected in few second Please [url="https://www.domain.com/whmcs/viewinvoice.php?id=$invoiceid"]click here[/url]

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