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
Solved

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

Posted on 2015-01-20
9
98 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
One field not displaying content (ASP Classic) 8 29
How to display div value on input field value in php 11 51
Insert Button on a table 16 36
HTML Anchor Link Problem 3 35
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
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.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
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).

792 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