Solved

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

Posted on 2015-01-20
9
97 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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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
 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

773 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