Contributions
Customer Private Messages
Customer Private Messages v1.0
========================
***********************
***********************
Please DO NOT post enhancements, questions, suggestions to the contribution section. My effort is to keep this as clear, straightforward and as easy to understand and install as possible. If you have suggestions, comments or improvements, please post to the forum. I will implement them with future releases. Thank you for understanding and respecting my wishes.
A support thread can be found in the osCommerce forums here:
http://forums.oscommerce.com/index.php?showtopic=201603
***********************
***********************
I designed this contribution in order to provide an additional means of communication between ourselves and the customers. Customers entered inaccurate or false email addresses; which thereby breaks down the means of interacting with the customer. Invoices fail to reach their destination for many reason, email errors, they moved, change ISP's, exceed mail quota's, do not check their email often or intentionally provided a false email.
Additionally there are reasons which do not warrant an email, and sending an email for certain issues may be deemed unprofessional or simply nagging in nature.
I needed a means to notify the customer when they would login that their email address is not correct and we cannot contact them, or a simple
"We've added the other items that you requested to your order"
"Happy Birthday - We'd like to give you...."
The uses are endless.
How it works and what it does
=====================
Once they login successfully and are forwarded to their account information, they will see any Messages that you may have left for them. If there are no messages, it will also inform them of this. I was debating having the box not displayed if there were no messages, but I felt that if they knew there is a messaging system it may remind them to look at it and not quickly skip over it, so if no messages are found it will say so.
Includes:
Easy Step by Step Installation
Multiple Screen Shots
GPL
Expand All / Collapse All
I changed the account.php addition to use the .privatemessages entry in the stylesheet.css. Previous submissions asked to add this but the code did not use the addition. I also changed the stylesheet addition to make it a little more appealing. Ofcourse, everyone can make changes as they need to.
Change in account.php from:
<!-- BEGIN Private Message v1.0 -->
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><b><?php echo PRIVATE_MESSAGES_TITLE; ?></b></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" class="infoBox" width="100%">
<tr class="infoBoxContents"><td align="left">
<?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?>
<?php $result = tep_db_query("select customers_private_messages from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . " '");
$result_array = tep_db_fetch_array($result);
if ($result_array['customers_private_messages'] != "") {
echo PRIVATE_MESSAGES_YES . "<P>" . $result_array['customers_private_messages'];
echo '<form action=' . $_SERVER['PHP_SELF'] . ' method="post">';
echo '<input type="submit" name="submit" value="Delete Message">';
echo '</form>';
if (isset($_POST['submit']))
{
tep_db_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_private_messages = ('') where customers_id ='" . (int)$customer_id . "'");
echo PRIVATE_MESSAGES_DELETED;
}
} else {
echo PRIVATE_MESSAGES_NO;
}
?>
</td></tr></table>
<!-- END Private Messages -->
TO THIS:
<!-- BEGIN Private Message v1.3 -->
<tr>
<td>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><b><?php echo PRIVATE_MESSAGES_TITLE; ?></b></td>
</tr>
<td>
<table border="0" cellspacing="0" cellpadding="2" class="privatemessages" width="100%"><tr class="infoboxcontents">
<?php
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'deletemessage')) {
tep_db_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_private_messages = ('') where customers_id ='" . (int)$customer_id . "'"); ?>
<tr class="infoboxcontents"><td class="main"><?php echo PRIVATE_MESSAGES_DELETED; ?></td></tr>
<tr class="infoboxcontents"><td class="main"><?php echo PRIVATE_MESSAGES_NO; ?></td></tr>
<?php } else {
$result = tep_db_query("select customers_private_messages from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . " '");
$result_array = tep_db_fetch_array($result);
if ($result_array['customers_private_messages'] != "") { ?>
<td class="main"><?php echo PRIVATE_MESSAGES_YES; ?></td></tr><tr class="infoboxcontents" ><td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td></tr><td class="infoboxcontents">
<?php echo $result_array['customers_private_messages']; ?></td></tr><tr class="infoboxcontents"><td align="right"><br>
<?php echo tep_draw_form('account', tep_href_link(FILENAME_ACCOUNT, 'action=deletemessage', 'SSL')); ?>
<input type="submit" name="submit" value="delete message">
</form></td></tr>
<?php } else { ?>
<tr><td class="main"><?php echo PRIVATE_MESSAGES_NO; ?></td></tr>
<?php }} ?>
</td>
</tr>
</table>
</tr></table>
<!-- END Private Messages v1.3-->
I also changed the stylesheet.css entry to :
/* Private Message Box */
.privatemessages { font-family: Verdana, Arial, sans-serif; font-size: 10px; font-weight: bold; color: #ff0000; text-align: left; border-left: 1px solid #ff0000; border-right: 1px solid #ff0000; border-top: 1px solid #ff0000; border-bottom: 1px solid #ff0000; padding-bottom: 2px; padding-top: 2px; padding-right: 2px; padding-left: 2px;}
But again, everyone can change the colors to what they want.
The attached file is just a screenshot of the My Account Information screen.
Hope this is helpful.
Chris
This is a correction update for "just a small fix make the message as tables and more. icaneat2 1 Feb 2008"
Nice first try icaneat2 but one or two errors where found.
Corrected and tested
Select from admin/account.php
<!-- BEGIN Private Message v1.0 -->
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><b><?php echo PRIVATE_MESSAGES_TITLE; ?></b></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" class="infoBox" width="100%">
<tr class="infoBoxContents"><td align="left">
<?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?>
<?php $result = tep_db_query("select customers_private_messages from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . " '");
$result_array = tep_db_fetch_array($result);
if ($result_array['customers_private_messages'] != "") {
echo PRIVATE_MESSAGES_YES . "<P>" . $result_array['customers_private_messages'];
echo '<form action=' . $_SERVER['PHP_SELF'] . ' method="post">';
echo '<input type="submit" name="submit" value="Delete Message">';
echo '</form>';
if (isset($_POST['submit']))
{
tep_db_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_private_messages = ('') where customers_id ='" . (int)$customer_id . "'");
echo PRIVATE_MESSAGES_DELETED;
}
} else {
echo PRIVATE_MESSAGES_NO;
}
?>
</td></tr></table>
<!-- END Private Messages -->
Replace with:
<!-- BEGIN Private Message v1.0 -->
<tr>
<td>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><font size="2"><b><?php echo PRIVATE_MESSAGES_TITLE; ?></b></font></td>
</tr>
<td>
<table border="0" cellspacing="0" cellpadding="2" class="infoBox" width="100%"><tr>
<?php
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'deletemessage')) {
tep_db_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_private_messages = ('') where customers_id ='" . (int)$customer_id . "'"); ?>
<tr><td class="main"><?php echo PRIVATE_MESSAGES_DELETED; ?></td></tr>
<tr><td class="main"><?php echo PRIVATE_MESSAGES_NO; ?></td></tr>
<?php } else {
$result = tep_db_query("select customers_private_messages from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . " '");
$result_array = tep_db_fetch_array($result);
if ($result_array['customers_private_messages'] != "") { ?>
<td class="main"><?php echo PRIVATE_MESSAGES_YES; ?></td></tr><tr><td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td></tr><td class="main">
<?php echo $result_array['customers_private_messages']; ?></td></tr><tr><td align="center"><br>
<?php echo tep_draw_form('account', tep_href_link(FILENAME_ACCOUNT, 'action=deletemessage', 'SSL')); ?>
<input type="submit" name="submit" value="delete message">
</form></td></tr>
<?php } else { ?>
<tr><td class="main"><?php echo PRIVATE_MESSAGES_NO; ?></td></tr>
<?php }} ?>
</td>
</tr>
</table>
</tr></table>
<!-- END Private Messages -->
>> BACKUP YOU FILES FIRST.<<
[!] This is just add-on to original contribution, not full pack!
This is very useful contribution - thanks to original contributor custodian. Many thanks for you
work!
However - I just added small extra feature to this. What if your customer does not login before
shopping? He goes directly from login pages to his shipping checkout and actually - never receives
messages before order.
hey , this is my first add-on so please take it slow for me.
just changed some of the if's and make it more workable for oscommerce.
in catalog/account.php
just find this :
<!-- BEGIN Private Message v1.0 -->
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><b><?php echo PRIVATE_MESSAGES_TITLE; ?></b></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" class="infoBox" width="100%">
<tr class="infoBoxContents"><td align="left">
<?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?>
<?php $result = tep_db_query("select customers_private_messages from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . " '");
$result_array = tep_db_fetch_array($result);
if ($result_array['customers_private_messages'] != "") {
echo PRIVATE_MESSAGES_YES . "<P>" . $result_array['customers_private_messages'];
echo '<form action=' . $_SERVER['PHP_SELF'] . ' method="post">';
echo '<input type="submit" name="submit" value="Delete Message">';
echo '</form>';
if (isset($_POST['submit']))
{
tep_db_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_private_messages = ('') where customers_id ='" . (int)$customer_id . "'");
echo PRIVATE_MESSAGES_DELETED;
}
} else {
echo PRIVATE_MESSAGES_NO;
}
?>
</td></tr></table>
<!-- END Private Messages -->
and change it with this:
<!-- BEGIN Private Message v1.0 -->
<tr>
<td>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><b><?php echo PRIVATE_MESSAGES_TITLE; ?></b></td>
</tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" class="infoBox" width="100%"><tr>
<?php
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'deletemessage'))
{
tep_db_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_private_messages = ('') where customers_id ='" . (int)$customer_id . "'");
echo "<tr><td class="main">" . PRIVATE_MESSAGES_DELETED . "</td></tr>";
echo "<tr><td class="main">" . PRIVATE_MESSAGES_NO . "</td></tr>";
} else {
$result = tep_db_query("select customers_private_messages from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . " '");
$result_array = tep_db_fetch_array($result);
if ($result_array['customers_private_messages'] != "") {
echo "<td align="right" valign="bottom">" . PRIVATE_MESSAGES_YES . ":</td></tr><tr><td class="main"><strong>הודעה:</strong></td></tr><td class="main">" . $result_array['customers_private_messages'] . "</td></tr>";
echo tep_draw_form('account', tep_href_link(FILENAME_ACCOUNT, 'action=deletemessage', 'SSL'));
echo '<tr><td align="right"><input type="submit" name="submit" value="delete message"></td></tr>';
echo '</form>';
} else {
echo "<tr><td class="main">" . PRIVATE_MESSAGES_NO . "</td></tr>";
}
}
?>
</td>
</tr>
</table>
</tr></table>
<!-- END Private Messages -->
that's all
you need to install prev add-on to install this fix
just take in mind that i'm using a RTL so you will need to change the align's of stuff
thanks alot.
** not full add-on and dummy file **
A define statement was inadvertantly left out.
(Thanks to Rolly pointing this out- aka: G4 Productions)
Also added another screen shot
FULL PACKAGE
Minor bug caused by left-over <br> tag in code
Thanks to Qihun for pointing it out
FULL Package
Version 1.1
FULL Package
SQL ALTER fixed
Updated Install
Release March 26, 2006
Minor Update in installation text
Full Package
Customer Private Messages v1.0
========================
***********************
***********************
Please DO NOT post enhancements, questions, suggestions to the contribution section. My effort is to keep this as clear, straightforward and as easy to understand and install as possible. If you have suggestions, comments or improvements, please post to the forum. I will implement them with future releases. Thank you for understanding and respecting my wishes.
A support thread can be found in the osCommerce forums here:
http://forums.oscommerce.com/index.php?showtopic=201603
***********************
***********************
I designed this contribution in order to provide an additional means of communication between ourselves and the customers. Customers entered inaccurate or false email addresses; which thereby breaks down the means of interacting with the customer. Invoices fail to reach their destination for many reason, email errors, they moved, change ISP's, exceed mail quota's, do not check their email often or intentionally provided a false email.
Additionally there are reasons which do not warrant an email, and sending an email for certain issues may be deemed unprofessional or simply nagging in nature.
I needed a means to notify the customer when they would login that their email address is not correct and we cannot contact them, or a simple
"We've added the other items that you requested to your order"
"Happy Birthday - We'd like to give you...."
The uses are endless.
How it works and what it does
=====================
Once they login successfully and are forwarded to their account information, they will see any Messages that you may have left for them. If there are no messages, it will also inform them of this. I was debating having the box not displayed if there were no messages, but I felt that if they knew there is a messaging system it may remind them to look at it and not quickly skip over it, so if no messages are found it will say so.
Includes:
Easy Step by Step Installation
Multiple Screen Shots
GPL
Note: Contributions are used at own risk.