close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Order number on confirmation email not showing

Thread began 9/24/2010 8:36 am by rikaG_510 | Last modified 2/08/2011 2:25 pm by danny405167 | 1718 views | 10 replies |

rikaG_510

Order number on confirmation email not showing

Hello,

On my shopping site confirmation email, there's a php code to echo the order number, but it shows just blank. No error message or nothing.

Could anyone look into the code and tell me what it wrong?
I attached txt file with coding for Store Summary in database and Order number bit on confirmation email.

Thank you for your help,

Rika

Attached Files
Code for summary and conf email.txt
Sign in to reply to this post

Jason ByrnesWebAssist

most likely, the store cart summary code comes after the code that sends the email, so the email is being sent before the cart summary can create the order number session.

Sign in to reply to this post

rikaG_510

Hi Jason,

Sorry I guess I didn't explain enough (and I didn't past enough code either.)

The coding for order number in email which I copy & pasted on previously attached file was copied from confirm_WAUE_HTML_WA_Universal_Email_1.php.
From "confirm.php", I only copied the store summary bit.

From a sound of your comment, I needed to copy more from "confirm.php".
So this time I copied coding from the beginning up to store summary.

Hope this is enough to look through.

Rika

Attached Files
Code for summary and conf email2.txt
Sign in to reply to this post

Jason ByrnesWebAssist

this part of the code sends the email:

php:
<?php

if (!isset($_SESSION))session_start();
if (((
$_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)))     {
  
//WA Universal Email object="mail"
  
set_time_limit(0);
  
$EmailRef "waue_confirm_1";
  
$BurstSize 200;
  
$BurstTime 1;
  
$WaitTime 1;
  
$GoToPage "";
  
$RecipArray = array();
  
$StartBurst time();
  
$LoopCount 0;
  
$TotalEmails 0;
  
$RecipIndex 0;
  
// build up recipients array
  
$CurIndex sizeof($RecipArray);
  
$RecipArray[$CurIndex] = array();
  
$RecipArray[$CurIndex ][] = "".$_SESSION['eCartCheckoutForm_postcode']  ."";
  
$TotalEmails += sizeof($RecipArray[$CurIndex]);
  
$RealWait = ($WaitTime<0.25)?0.25:($WaitTime+0.1);
  
$TimeTracker = Array();
  
$TotalBursts floor($TotalEmails/$BurstSize);
  
$AfterBursts $TotalEmails $BurstSize;
  
$TimeRemaining = ($TotalBursts $BurstTime) + ($AfterBursts*$RealWait);
  if (
$TimeRemaining < ($TotalEmails*$RealWait) )  {
    
$TimeRemaining $TotalEmails*$RealWait;
  }
  
$_SESSION[$EmailRef."_Total"] = $TotalEmails;
  
$_SESSION[$EmailRef."_Index"] = 0;
  
$_SESSION[$EmailRef."_Remaining"] = $TimeRemaining;
  while (
$RecipIndex sizeof($RecipArray))  {
    
$EnteredValue is_string($RecipArray[$RecipIndex][0]);
    
$CurIndex 0;
    while ((
$EnteredValue && $CurIndex sizeof($RecipArray[$RecipIndex])) || (!$EnteredValue && $RecipArray[$RecipIndex][0])) {
      
$starttime microtime_float();
      if (
$EnteredValue)  {
        
$RecipientEmail $RecipArray[$RecipIndex][$CurIndex];
      }  else  {
        
$RecipientEmail $RecipArray[$RecipIndex][0][$RecipArray[$RecipIndex][2]];
      }
      
$EmailsRemaining = ($TotalEmails$LoopCount);
      
$BurstsRemaining ceil(($EmailsRemaining-$AfterBursts)/$BurstSize);
      
$IntoBurst = ($EmailsRemaining-$AfterBursts) % $BurstSize;
      if (
$AfterBursts<$EmailsRemaining$IntoBurst 0;
      
$TimeRemaining = ($BurstsRemaining $BurstTime 60) + ((($AfterBursts<$EmailsRemaining)?$AfterBursts:$EmailsRemaining)*$RealWait) - (($AfterBursts>$EmailsRemaining)?0:($IntoBurst*$RealWait));
      if (
$TimeRemaining < ($EmailsRemaining*$RealWait) )  {
        
$TimeRemaining $EmailsRemaining*$RealWait;
      }
      
$CurIndex ++;
      
$LoopCount ++;
      
session_commit();
      
session_start();
      
$_SESSION[$EmailRef."_Index"] = $LoopCount;
      
$_SESSION[$EmailRef."_Remaining"] = round($TimeRemaining);
      
session_commit();
      
wa_sleep($WaitTime);
      include(
"webassist/email/waue_confirm_1.php");
      
$endtime microtime_float();
      
$TimeTracker[] =$endtime $starttime;
      
$RealWait array_sum($TimeTracker)/sizeof($TimeTracker);
      if (
$LoopCount $BurstSize == 0)  {
        
$TimePassed = (time() - $StartBurst);
        if (
$TimePassed < ($BurstTime*60))  {
          
$WaitBurst = ($BurstTime*60) -$TimePassed;
          
wa_sleep($WaitBurst);
        }
        else  {
          
$TimeRemaining = ($TotalEmails$LoopCount)*$RealWait;
        }
        
$StartBurst time();
      }
      if (!
$EnteredValue)  {
        
$RecipArray[$RecipIndex][0] =  mysql_fetch_assoc($RecipArray[$RecipIndex][1]);
      }
    }
    
$RecipIndex ++;
  }
  
$_SESSION[$EmailRef."_Total"] = 0;
  
$_SESSION[$EmailRef."_Index"] = 0;
  
$_SESSION[$EmailRef."_Remaining"] = 0;
  
session_commit();
  
session_start();
  if (
$GoToPage!="")     {
    
header("Location: ".$GoToPage);
  }
}
?>




it is before the store cart summary code.


This means the email is being sent before the cart summary is stored. the order number session is created when the record is stored, so the email code needs to be moved after the store cart summary code.

Sign in to reply to this post

rikaG_510

Oh ic.
Great. That did it.

Thank you very much!

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

danny405167

I am getting the same email twice

I moved the code that you suggested because the order id was not being added to my email. The only problem I have is that I am receiving the same email twice. They both contain the users and cart info. The only difference is that one adds the order id and the other does not.

Plus also noticed that your code has the following:
if ($LoopCount % $BurstSize == 0 {

and my is a little bit longer

if ($LoopCount % $BurstSize == 0 && $CurIndex < sizeof($RecipArray[$RecipIndex])) {

At home I get the same --> if ($LoopCount % $BurstSize == 0 { when I used my mac with cs 5. At work with my dell and cs4 I get the longer version.

The code that I generate with my mac makes the confirm to reload until I get a 500 error server. Are both code suppose to do the same function?

Sign in to reply to this post

Jason ByrnesWebAssist

it sounds like the universal email behavior is on the page twice. please sends a copy of the page so i can look at the code.

Sign in to reply to this post

danny405167

I found the problem on why I was receiving the same email twice. There was a problem with the server. But I would like to know why Universal email code is written differently. On a pc with windows 7 pro and cs 4 I get this:

if ($LoopCount % $BurstSize == 0 && $CurIndex < sizeof($RecipArray[$RecipIndex])) {


but on a mac with snow leopard and cs 5 I get this:

if ($LoopCount % $BurstSize == 0 {

The second code does not work because it makes the confirm page to keep on loading and after a while it just stops working. Any ideas why?



and my is a little bit longer

if ($LoopCount % $BurstSize == 0 && $CurIndex < sizeof($RecipArray[$RecipIndex])) {

Sign in to reply to this post

Jason ByrnesWebAssist

can you send a copy of the problem page so i can see the entire code in context. I cannot tell why that snippet is not working without seeing the code that surrounds the snippet.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...