Solved

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

Posted on 2015-01-20
9
103 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will learn how to dynamically set the form action using jQuery.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

687 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