Solved

removed code now no email are being produced(web Order Confirmatoin)

Posted on 2015-01-20
9
90 Views
Last Modified: 2015-01-23
I have a small script that was wriiten before I arrived and have been asked to remove some information from our order confirmation.
I found that if I comment out certain line it will change the order confirmation, but when I remove almost all the line, for some reason the email seems to stop being genereated.

here is a piece of the code:

 public function getContactStringPlain() {
        $str = "  ";
        //"BIOTONE Professional Massage and Spa Therapy Products\n".
          //  "4757 Old Cliffs Rd,\r".
           // "San Diego, CA 92120, USA\r\n";
            //"Monday - Friday, 8:00 am - 4:30 pm, PST\r\n\r\n".
            //"Toll Free: 800.445.6457\n".
            //"Local: (619) 582-0027\r".
            //"Email: customerservice@biotone.com\r\n\r\n".
            //"Online: www.biotone.com";
        return $str;
    } //end function getContactStringPlain

Will commenting this out change how a email is generated, I may have a situation that is just slow...I just received a email order confirmation and it looks as if the coding is working.
How ever please verify if I commented this code out correctly?
0
Comment
Question by:Scott Johnston
  • 5
  • 4
9 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
ID: 40560815
How ever please verify if I commented this code out correctly? 

Open in new window


More or less.
0
 

Author Comment

by:Scott Johnston
ID: 40560886
OK, it works....I tried to remove the entire statement and the coding will fail.

here is more coding...but it all seems  to be working correctly.
Thank you any more coments will be appreciated..

  * @return <String> String
     */
    public function getContactStringPlain() {
        $str = "  ";
        //"BIOTONE Professional Massage and Spa Therapy Products\n".
          //  "4757 Old Cliffs Rd,\r".
           // "San Diego, CA 92120, USA\r\n";
            //"Monday - Friday, 8:00 am - 4:30 pm, PST\r\n\r\n".
            //"Toll Free: 800.445.6457\n".
            //"Local: (619) 582-0027\r".
            //"Email: customerservice@biotone.com\r\n\r\n".
            //"Online: www.biotone.com";
        return $str;
    } //end function getContactStringPlain

    /**
     * Returns a string of contact information to be placed into an email
     * with the content-type of text/html
     * @return <String> String
     */
    public function getContactStringHTML() {
        $str = $this->getContactStringPlain();
        $str = str_replace("\r\n","<br/>",$str);
        $str = str_replace("customerservice@biotone.com","<a href=\"mailto:customerservice@biotone.com\">customerservice@biotone.com</a>",$str);
        $str = str_replace("www.biotone.com","<a href=\"http://www.biotone.com\" target=\"_blank\">www.biotone.com</a>",$str);
        //$str .= "<br/><a href=\"http://messenger.providesupport.com/messenger/biotone.html\" target=\"_blank\">Live Chat Support</a>";
        return $str;
    } //end function getContactStringHTML

    /**
     * Loads default mail message information based on the provide 'code'
     * Returns true only if the default mail message can be found and
     * defaults are loaded.
     * 
     * @param <string> $code
     * @param <Connection> $cnx
     * @return <boolean>
     */
    public function loadDefaults($code, Connection $cnx = NULL) {
        if(is_null($cnx))
            $cnx = new Connection();
        $cnx->execute("SELECT MailID FROM ".$cnx->MarketDB.".MailMessageAssign WHERE Code = '".$cnx->adjust($code)."'");
        if($cnx->AffectedRows == 1) {
            $result = $cnx->getResults(1);
            $cnx->execute("SELECT DefaultSubject, ReplyTo, Message, ".
                "RecordToLog, MimeType, BackupTo, BackupSubject FROM ".$cnx->MarketDB.".MailMessages WHERE ID = ".$cnx->adjust($result['MailID']));
            if($cnx->AffectedRows == 1) {
                $mail = $cnx->getResults(1);
                $this->Subject = $mail['DefaultSubject'];
                $this->ReturnTo = $mail['ReplyTo'];
                $this->Message = $mail['Message'];
                if($mail['RecordToLog'] == "Y")
                    $this->RecordRequest = true;
                else
                    $this->RecordRequest = false;
                if($mail['MimeType'] == "H")
                    $this->setHtmlHeaders();
                else if($mail['MimeType'] == "P")
                    $this->setPlainHeaders();
                if(trim($mail['BackupTo']) != "") {
                    $this->BackupTo = $mail['BackupTo'];
                    $this->BackupSubject = $mail['BackupSubject'];
                } //end if
                return true;
            } //end if
        } //end if
        return false;
    } //end function loadDefaults
} //end class Email

Open in new window

0
 

Author Closing Comment

by:Scott Johnston
ID: 40560888
More or Less works, that means yes...There is more than one way to skin a cat...
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40560914
OK, it works....I tried to remove the entire statement and the coding will fail.

Because it's a function, it's being called elsewhere in the code so if you just delete it without also deleting the call to it, the whole script will die.  Commenting out the output of the function gets you to where you want to be, albeit in a less-than-graceful fashion.  

I placed your code in a code block above.  Look at line 22.

       $str = $this->getContactStringPlain();

That's the call to the function you want to remove.  If you remove that, you don't need to comment out the function itself...it just never gets used.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Scott Johnston
ID: 40561064
Greeeeat!!!
 I learned again something new...I appreciated you showing me.  This is very helpful in helping me to work on coding.  I am a 1 man shop and do everything from Network, to coding, to database admin, to telephones, business application solution provider and a lot more.  
Sometime all I need is pointed in the right direction!
I've be doing this a long time(25 years) and technology changes, all I try to do is keep up as a  ADMIN who wears just about any type of hat!
0
 

Author Comment

by:Scott Johnston
ID: 40567227
Just verify I understand this correctly, when I see a URL...
..https://www.biotone.com/checkout.php?proc=billing
in this statement I am looking for a Procedure call "Billing" that is in the Checkuot.php program?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40567289
Not necessararily.

That's called a query string the (?proc=billing part).  In your code, you want to look for something that handles the $_GET array, specifically the proc part.  Will look like this:

$_GET['proc']

And be part of a conditional (if) statement.  The code in the conditional will point you to the functions.
0
 

Author Comment

by:Scott Johnston
ID: 40567450
Thank you again, I have a better understanding of the use.  All I see is this used as a HREF, I am unable to find a GET statement.
it is used in a html statment in the program.
html.= "<a  href=\"/checkout.php?proc=billing/">change billing address</a<br/>".
Thi sis in the Checkout.php program.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40567508
You will find it in checkout.php
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Joomla main HTML page 4 47
JQuery tracking event. 3 41
javascript to html map 8 41
HTML 5 video and audio or Flash 1 31
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now