It is currently Thu Mar 28, 2024 9:00 am


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: I heed a piece of code - Anyone game?
PostPosted: Sat May 06, 2006 11:48 am 
Moderator
Moderator

Joined: Sat Feb 12, 2005 4:48 pm
Posts: 575
Location: Largo, Florida USA
Hi all, I need a little help with something.

I have a PHP generated page (an invoice) that I would like to be able to email to people (when requested) with a click of a button.

What this would do is capture the contents of the PHP page and put it into the body of the message, I enter the email address, subject and a comment.

Although I would prefer it be in PHP or JAVA but if need be CGI.

Thanks in advance,

_________________
Bob G.

Grout Recoloring Systems: http://coloryourgrout.com

Save Your Data - Do Backups
http://forum.100webspace.com/viewtopic. ... highlight=


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 4:37 pm 
Moderator
Moderator

Joined: Sat Feb 12, 2005 4:48 pm
Posts: 575
Location: Largo, Florida USA
Not sure, here is the code, maybe that will help:

Code:
<?php
/*
  $Id: invoice2.php,v 1.6 2003/06/20 00:37:30 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  require('includes/application_top.php');

  require(DIR_WS_CLASSES . 'currencies.php');
  $currencies = new currencies();

  $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
  $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

  include(DIR_WS_CLASSES . 'order.php');
  $order = new order($oID);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- body_text //-->
<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
    <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>
        <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'logo1.jpg', 'Color Your Grout', '204', '50'); ?></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="2">
      <tr>
        <td colspan="2"><?php echo tep_draw_separator(); ?></td>
      </tr>
      <tr>
        <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><b><?php echo ENTRY_SOLD_TO; ?></b></td>
          </tr>
          <tr>
            <td class="main"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>'); ?></td>
          </tr>
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
          </tr>
          <tr>
            <td class="main"><?php echo $order->customer['telephone']; ?></td>
          </tr>
          <tr>
            <td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '"><u>' . $order->customer['email_address'] . '</u></a>'; ?></td>
          </tr>
        </table></td>
        <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><b><?php echo ENTRY_SHIP_TO; ?></b></td>
          </tr>
          <tr>
            <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr>
    <td><table border="0" cellspacing="0" cellpadding="2">
      <tr>
        <td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td>
        <td class="main"><?php echo $order->info['payment_method']; ?></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr>
    <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr class="dataTableHeadingRow">
        <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
        <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
        <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td>
        <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></td>
        <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></td>
        <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td>
        <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td>
      </tr>
<?php
    for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
      echo '      <tr class="dataTableRow">' . "\n" .
           '        <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . "\n" .
           '        <td class="dataTableContent" valign="top">' . $order->products[$i]['name'];

      if (isset($order->products[$i]['attributes']) && (($k = sizeof($order->products[$i]['attributes'])) > 0)) {
        for ($j = 0; $j < $k; $j++) {
          echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
          if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';
          echo '</i></small></nobr>';
        }
      }

      echo '        </td>' . "\n" .
           '        <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n";
      echo '        <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" .
           '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
           '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
           '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
           '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";
      echo '      </tr>' . "\n";
    }
?>
      <tr>
        <td align="right" colspan="8"><table border="0" cellspacing="0" cellpadding="2">
<?php
  for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
    echo '          <tr>' . "\n" .
         '            <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" .
         '            <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "\n" .
         '          </tr>' . "\n";
  }
?>

        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
<!-- body_text_eof //-->

<br>

<SCRIPT Language="Javascript">

/*
This script is written by Eric (Webcrawl@usa.net)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/

function printit(){ 
if (window.print) {
    window.print() ; 
} else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = ""; 
}
}
</script>

<SCRIPT Language="Javascript"> 
var NS = (navigator.appName == "Netscape");
var VERSION = parseInt(navigator.appVersion);
if (VERSION > 3) {
    document.write('<form><input type=button value="Print this Page" name="Print" onClick="printit()"></form>');       
}

</script>

</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Thanks,

_________________
Bob G.

Grout Recoloring Systems: http://coloryourgrout.com

Save Your Data - Do Backups
http://forum.100webspace.com/viewtopic. ... highlight=


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 5:33 pm 
Moderator
Moderator

Joined: Thu Dec 15, 2005 2:59 pm
Posts: 681
Location: England
I would help you but I dont understand what your saying when you say capture the contents of the PHP page..

_________________
Mountain biking forum ;)
Ponds and fishkeeping :D


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 6:49 pm 
Moderator
Moderator

Joined: Sat Feb 12, 2005 4:48 pm
Posts: 575
Location: Largo, Florida USA
Ok, I create a printable invoice that I include with the package when shipped, sometimes I get a request a duplicate when the original is lost. What I want to do is take the invoice and email it to them rather than mail it.

Hrer is a screenshot of what it looks like:

http://coloryourgrout.com/invoice.bmp

_________________
Bob G.

Grout Recoloring Systems: http://coloryourgrout.com

Save Your Data - Do Backups
http://forum.100webspace.com/viewtopic. ... highlight=


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 07, 2006 7:57 am 
Moderator
Moderator

Joined: Thu Dec 15, 2005 2:59 pm
Posts: 681
Location: England
Can you not just set the email to be $document and set their email to be $email then use this:

Code:
if ($act=="email")
{
$to = "$email";
$subject = "Subject line";
$body = "$document";
if (mail($to, $subject, $body)) {
  echo("Mail Successfully Sent");
} else {
  echo("Failed To Send Email");
}


And on submit you set the form action to be page.php?act=email ?

Sorry if i'm way out but i'm still not 100% sure. (Sorry).

_________________
Mountain biking forum ;)
Ponds and fishkeeping :D


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 07, 2006 11:29 am 
Moderator
Moderator

Joined: Sat Feb 12, 2005 4:48 pm
Posts: 575
Location: Largo, Florida USA
It might work, I'm just not sure where to code it into the script :oops:

_________________
Bob G.

Grout Recoloring Systems: http://coloryourgrout.com

Save Your Data - Do Backups
http://forum.100webspace.com/viewtopic. ... highlight=


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 08, 2006 5:30 pm 
Moderator
Moderator

Joined: Thu Dec 15, 2005 2:59 pm
Posts: 681
Location: England
Lol yes sorry, just use $email instead of $to. Just thought it would explain it easier to bobg if I used $to.

_________________
Mountain biking forum ;)
Ponds and fishkeeping :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ]  Moderators: fhmagic, KJ, Moderators, Support Team

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
100WebSpace © 2011