Simple wishlist for OSCommerce. This module should fit all versions of oscommerce. The module adds a ‘add to wishlist’ button on the products_info.php page and creates a new wishlist page. Once a customer is signed in they can visit the wishlist page which lists there items. Each item has an ‘add to cart’ button and a ‘delete’ button. Each customers wishlist is permanantly stored in the database and thus remains available to the customer until they delete the items.
There is also a admin report which lists the existing wishlist and the items in each wishlist.
- create the following table in the database:
CREATE TABLE `customers_wishlist` (
`products_id` tinytext NOT NULL,
`customers_id` int(13) NOT NULL default '0',
`products_name` varchar(34) NOT NULL default '0',
`products_price` decimal(6,2) NOT NULL default '0',
`products_price` varchar(6) NOT NULL default '0',
`products_image` varchar(24) NOT NULL default '0'
) TYPE=MyISAM;
- Download the following oscommerce contribution: wishlist, http://addons.oscommerce.com/info/1682. Use the 2 Mar 2009 upgrade by FIMBLE. Install the admin files (stats_wishlist.php and it’s cooresponding language file) Follow the instructions for installing that contribution in the admin folder. Ignore the catalog files and the instructions for installing in the catalog.
- Open catalog/includes/application_top.php. Locate:
switch ($HTTP_GET_VARS['action']) {
Just below add:
case 'add_wishlist':
if (tep_session_is_registered('customer_id')){
$wishlist_addtoquery = tep_db_query("select products_id, customers_id from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' ");
$wishlist_addto = tep_db_fetch_array($wishlist_addtoquery);
if (isset($wishlist_addto['products_id'])){
$wishlist_item_exists='is in your wishlist.';
}else{
if (isset($HTTP_GET_VARS['products_id'])) {
tep_db_query("insert into " . TABLE_WISHLIST . " (products_id, products_image, products_name, products_price, customers_id) values ('" . $HTTP_POST_VARS['products_id'] . "', '" . $HTTP_POST_VARS['products_image'] . "','" . $HTTP_POST_VARS['products_name'] . "','" . $HTTP_POST_VARS['products_price'] . "','" . $customer_id . "')");
}
}
}
break;
case 'delete_wishlist':
if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {
// $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['pid'] . "' and customers_id = '" . $customer_id . "'");
// $check = tep_db_fetch_array($check_query);
// if ($check['count'] > 0) {
tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['pid'] . "' and customers_id = '" . $HTTP_GET_VARS['cid'] . "'");
}
// }
// tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))));
break;
- Open catalog/product_info.php. Add the following code where you wish the ‘add to wishlist’ button to be installed.
<?php
//DISPLAY WISHLIST BUTTON
if (tep_session_is_registered('customer_id')) {
echo tep_draw_form('wish_list', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_wishlist')); //DISPLAY WISHLIST SUBMIT BUTTON
echo tep_draw_hidden_field('products_id', $product_info['products_id']);
echo tep_draw_hidden_field('products_image', $product_info['products_image']);
echo tep_draw_hidden_field('products_name', $product_info['products_name']);
echo tep_draw_hidden_field('products_price', $product_info['products_price']);
echo tep_image_submit('', 'add to wishlist','');
//DISPLAY WISHLIST LINK
// echo '<br /><a href="'.tep_href_link(FILENAME_WISHLIST).'">Visit Wishlist</a><br />';
}else{
echo '<a href="' . tep_href_link(FILENAME_LOGIN, '', 'SSL') . '" class="button"><span>add to wishlist</span></a>';
}
?>
</form>
IMPORTANT: Be sure you do not install this above the existing ‘add to cart’ button, or between the ‘add to cart’ button and it’s closing </form> tag.
- Create a blank page, name it wishlist.php and paste the following table.
<table><tr><td colspan="6"><hr></td></tr>
<tr><td colspan="6">
<?php
$wishlist_id_query = tep_db_query("select customers_id, products_id from(" . TABLE_WISHLIST . " ) where customers_id = '" . $customer_id . "' ");
$wishlist_id = tep_db_fetch_array($wishlist_id_query);
if (tep_not_null($wishlist_id['products_id'])) {
echo 'Items in your wishlist:';
}else{
echo 'There are no items in your wishlist';
}
?>
</td></tr>
<?php
$wishlist_query = tep_db_query("select customers_id, products_id, products_size, products_name, products_image, products_price from(" . TABLE_WISHLIST . " ) where customers_id = '" . $customer_id . "' ");
while ($wishlist = tep_db_fetch_array($wishlist_query)){
?>
<tr>
<td ><?php echo tep_image(DIR_WS_IMAGES . $wishlist['products_image'], $wishlist['products_name'], '70', '70', 'hspace="5" vspace="5"');?></td>
<td width="175" class="align_left"><?php echo '<a class="infobox-cart" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $wishlist['products_id']) . '">'.$wishlist['products_name']; ?></a></td>
<td width="20"><?php echo $wishlist['products_size']; ?></td>
<td><span class="productprice"><?php echo $wishlist['products_price']; ?></span></td>
<td class="align_left" width="100">
<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_product'));?>
<?php
// echo tep_draw_hidden_field('products_id', $wishlist['products_id']) . tep_image_submit('', 'add to cart','');
echo '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=cust_order&pid=' . $wishlist['products_id']) . '" class="button">add to cart</a>';
?></form></td>
<td class="align_left" width="75">
<?php echo '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=delete_wishlist&pid=' . $wishlist['products_id']) . '&cid='.$wishlist['customers_id'].'" class="button">delete</a>';
?>
<?php
// echo tep_draw_hidden_field('products_id', $wishlist['products_id']) . tep_image_submit('', 'delete',''); ?></form></td>
</tr>
<tr><td colspan="6"><hr></td></tr>
<?php
}
?>
</table>
- Open catalog/includes/database and add the following definition:
//wishlist
define('TABLE_WISHLIST', 'customers_wishlist');
- Open catalog/filenames and add the following definition:
//WISHLIST
define('FILENAME_WISHLIST', 'wishlist.php');
- Add links to wishlist.php where desired.
Install a drop down login box on OSC to CSSv2. Click the login link and a login box appears. If the user has javascript turned off, the link functions as normal. This mod also changes the text ‘login’ to ‘account’ once the user has signed in.
DEMO
click ‘login’ at top right.
If you are using OSC to CSS v2 (or v1) this is easy installation. No files or images to upload, just three easy steps.
Adapted from A Simple and Effective jQuery Dropdown Login Form. Visit this site for more detail and alternate drop down box styles.
-
open catalog/includesheader.php and change:
<div class="topnav-login">
<?php
echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">Home</a>';
if (tep_session_is_registered('customer_id')) {
echo '<a href="'.tep_href_link(FILENAME_LOGOFF, '', 'SSL').'" >'. HEADER_TITLE_LOGOFF.'</a>';
}
echo '<a href="'.tep_href_link(FILENAME_ACCOUNT, '', 'SSL').'" >'. HEADER_TITLE_MY_ACCOUNT.'</a><a href="'.tep_href_link(FILENAME_SHOPPING_CART).'" >'.HEADER_TITLE_CART_CONTENTS.'</a><a href="'.tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL').'" >'.HEADER_TITLE_CHECKOUT.'</a>';
?>
</div>
to:
<div class="topnav-login">
<?php
echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">Home</a>';
if (tep_session_is_registered('customer_id')) {
echo '<a href="'.tep_href_link(FILENAME_LOGOFF, '', 'SSL').'" >'. HEADER_TITLE_LOGOFF.'</a>';
echo '<a href="'.tep_href_link(FILENAME_ACCOUNT, '', 'SSL').'" >'. HEADER_TITLE_MY_ACCOUNT.'</a>';
}else{
?>
<!-- LoginBox Starts Here-->
<div id="loginContainer">
<?php echo '<a href="'.tep_href_link(FILENAME_ACCOUNT, '', 'SSL'). ' " id="loginButton" class="topmenu"><span>Log in</span><em></em></a>';?>
<div style="clear:both"></div>
<div id="loginBox">
<?php echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL'), 'post', 'id="loginForm"', true); ?>
<fieldset id="loginBody">
<fieldset>
<label for="email">Email Address</label>
<?php echo tep_draw_input_field('email_address',$login_email,'class="required email" id="email"'); ?>
</fieldset>
<fieldset>
<label for="password">Password</label>
<?php echo tep_draw_password_field('password','','id="password" ');?>
</fieldset><br/ >
<?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?>
</fieldset>
<span>
<?php echo '<br /><a href="' . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '" class="button">Password forgotten?</a>'; ?>
</span>
</form>
</div>
</div>
<!-- LoginBox Ends Here -->
<?php
}
echo '<a href="'.tep_href_link(FILENAME_SHOPPING_CART).'" >'.HEADER_TITLE_CART_CONTENTS.'</a>
<a href="'.tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL').'" >'.HEADER_TITLE_CHECKOUT.'</a>';
?>
</div>
- add this to your stylesheet:
#loginContainer {
position:relative;
float:right;
}
#loginBox {
position:absolute;
top:28px;
right:0;
display:none;
z-index:29;
}
#loginForm {
width:210px;
border-radius:3px 0 3px 3px;
-moz-border-radius:3px 0 3px 3px;
background:#999999;
padding:6px;
}
fieldset#loginBody {
background:#fff;
border-radius:3px;
-moz-border-radius:3px;
padding:10px 13px;
margin:0;
}
- add this javascript snippet to catalog/includes/template_top.php just above the closing </head> tag.
<script type="text/javascript">
$(function() {
var button = $('#loginButton');
var box = $('#loginBox');
var form = $('#loginForm');
button.removeAttr('href');
button.mouseup(function(login) {
box.toggle();
button.toggleClass('active');
});
form.mouseup(function() {
return false;
});
$(this).mouseup(function(login) {
if(!($(login.target).parent('#loginButton').length > 0)) {
button.removeClass('active');
box.hide();
}
});
});
</script>
Improve customer sorting in the admin. Stock OSCommerce simply displays a static alphabetical customer list in admin>orders>customers. This old contribution originally posted on the OSCommmerce site in 2002 by Burt and just recently updated 9/20/2011 by D-Woo allows up and down sorting by first and last name and by date the account was created.
It’s really easy to install, just replace admin/customers.php and upload two images.
Use this mod to enter snail mail or phone orders. Installs a powerful search function in the admin that allows you to quickly select a desired customer, and load their email into the customer login form on the catalog side. If you have installed a master password contribution, then enter the master password and voila, you are signed on as that customer and can complete an order, change their account info, or any other customer accessed functions.
- Install one of these master password contributions from the OSCommerce site.
- Install this table where desired in admin/index.php
<!--customer search form-->
<table cellspacing="5" cellpadding="2" width="100%">
<tr>
<td width="30%" valign="top" >
<?php echo tep_draw_form('search_customers', FILENAME_DEFAULT, 'action=process', 'SSL', 'get', 'contact', ''); ?>
<?php
echo '<table class="mainText"><tr><td>email:<br>'.tep_draw_input_field('search_email').'</td></tr>
<tr><td>last name:<br>'.tep_draw_input_field('search_lastname').'</td></tr>
<tr><td>phone:<br>'.tep_draw_input_field('search_phone').'</td></tr></table>'
.tep_image_submit('button_search.gif', IMAGE_BUTTON_SEARCH).tep_hide_session_id().'</form>';
?>
</td>
<td width="70%" bgcolor="#F2F2F2">
<?php
if ($HTTP_GET_VARS['search_email']) {
$search_email = tep_db_prepare_input($HTTP_GET_VARS['search_email']);
$where_clause = "customers_email_address RLIKE '".tep_db_input($search_email)."'";
}
if ($HTTP_GET_VARS['search_phone']) {
$search_phone = tep_db_prepare_input($HTTP_GET_VARS['search_phone']);
$where_clause .= ($where_clause ? ' or ' : '')."customers_telephone RLIKE '".tep_db_input($search_phone)."'";
}
if ($HTTP_GET_VARS['search_lastname']) {
$search_lastname = tep_db_prepare_input($HTTP_GET_VARS['search_lastname']);
$where_clause .= ($where_clause ? ' or ' : '')." customers_lastname RLIKE '".tep_db_input($search_lastname)."'";
}
if ($where_clause) {
$search_sql = "select * from ".TABLE_CUSTOMERS." where ".$where_clause;
$search_query = tep_db_query($search_sql);
if (tep_db_num_rows($search_query)) {
?>
<table width="100%" >
<tr><td colspan="3" class="mainText"><b>Click email to enter order:<b></td></tr>
<tr><td colspan="3" height="1" bgcolor="000000"></td></tr>
<?php
while ($search_result = tep_db_fetch_array($search_query)) {
echo '<tr>
<td class="smallText"><a href="/login.php?'.$search_result['customers_email_address'].'">'.$search_result['customers_email_address'].'</a></td>
<td class="smallText">'.$search_result['customers_firstname'].' '.$search_result['customers_lastname'].'</td>
<td class="smallText">'.$search_result['customers_telephone'].'</td>
</tr><tr><td colspan="3" height="1" bgcolor="666666"></td></tr>';
}
?>
</table>
<?php
} else {
?>
<table>
<tr><td>No customers match this search</td></tr>
</table>
<?php
}
}
?>
</td>
</tr>
</table>
<!--end customer search form-->
- Make these changes in catalog/login.php
- add this code just above the head tag (it can be anywhere on the page as long as it is above the login form and preferably below the error message code above the page header – paying attention to use of the ?> and <?php tags ):
<?php
$customersearch_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '".$_SERVER['QUERY_STRING']."'");
$customersearch = tep_db_fetch_array($customersearch_query);
if ($customersearch['customers_email_address']==$_SERVER['QUERY_STRING']){
$login_email = $_SERVER['QUERY_STRING'];
}
?>
- change:
<?php echo tep_draw_input_field('email_address',' ','class=" required email"'); ?>
to:
<?php echo tep_draw_input_field('email_address',$login_email,'class=" required email"'); ?>
-
Protect your images folder with this simple .htaccess file.
Create a blank file, add this code to it, name it .htaccess and upload to your images file:
<FilesMatch "\.(php([0-9]|s)?|s?p?html|cgi|pl|exe){:content:}quot;>
Order Deny,Allow
Deny from all
</FilesMatch>
This prevents any files with .php or .exe or .cgi to be executed. In other words unauthorized hacker files. For a little bit more read the full thread on the oscommerce site.
Mail Manager is a comprehensive mail program for OSCommerce. Designed for 2.2RC2a and OSC 2 CSS.
Purpose:
- Send all emails both in html and in text.
- Allow editing and templating of all emails, to include order confirmation, create account, password forgotten, status update, and tell a friend emails from the admin
- Add a post sales email marketing ability to OSCommerce
- Modulate the rate that emails are sent
Emails that can be edited and templated from the admin include the emails that are initiated when a customer create an account, completes an order, requests a password, sends a ‘tell a friend’ email, recieves when an order status is updated, the single emails sent directly from the admin to a customer, and the newsletters.
Mail Manager:
- Mail manager allows the shop owner to create and edit all emails from the admin with both an html and a text alternative, to allow professional and readable emails to be produced.
- To create a consistent look, templates can be produced in the admin that can be applied to all emails.
- A bulkmail module is included that allows the rate that OSCommerce sends email and newsletters to be adjusted. The rate is in seconds per email. This allows shops on shared web-hosting account to send large mailings without exceeding band-width limitations.
- The bulkmail module also contains a special feature that allows the sending of marketing emails to customer that have recently made a purchase. This email contains an orders product listing, to include images and links to ‘write a review’, and also contains cross sold items. (if the xsell module is installed).
- Mail Manager adds product images to the customer initiated tell_a_friend email.
- A search feature is added to the admin email that makes it simple to locate a customer and send them note, etc on a templated email.
Mail Manager Installation
Files can be downloaded from:
Google Code or the OSCommerce site.
Mail Manager Description
installation:
- open catalog/includes/languages/english/checkout_process.php, add:
define('EMAIL_TEXT_CONFIRM', 'has recommended');
define('TEXT_FROM', 'from');
- open/admin/includes/languages/english.php add:
//mail manager
define('BOX_HEADING_MAIL_MANAGER', 'Mail Manager');
define('BOX_MM_BULKMAIL', 'BulkMail Manager');
define('BOX_MM_TEMPLATES', 'Template Manager');
define('BOX_MM_EMAIL', 'Send Email');
define('BOX_MM_RESPONSEMAIL', 'Response Mail');
- open admin/includes/filenames.php
add://MAIL MANAGER
define('FILENAME_MM_RESPONSEMAIL', 'mm_responsemail.php');
define('FILENAME_MM_TEMPLATES', 'mm_templates.php');
define('FILENAME_MM_BULKMAIL', 'mm_bulkmail.php');
define('FILENAME_MM_EMAIL', 'mm_email.php');
- open admin/includes/database_tables.php
add:///Mail Manager
define('TABLE_MM_RESPONSEMAIL', 'mm_responsemail');
define('TABLE_MM_RESPONSEMAIL_RESTORE', 'mm_responsemail_backup');
define('TABLE_MM_RESPONSEMAIL_RESET', 'mm_responsemail_reset');
define('TABLE_MM_TEMPLATES', 'mm_templates');
define('TABLE_MM_NEWSLETTERS', 'mm_newsletters');
- open admin/includes/column_left.php add:
include(DIR_WS_BOXES . 'mail_manager.php');
just below include(DIR_WS_BOXES . 'modules.php');
- open admin/includes/classes/email.php, add at the bottom before the closing ?> tag:
// eliminate line feeds as <br>
class emailMailManager extends email {
function add_html($html, $text = NULL, $images_dir = NULL) {
$this->html = $html; //tep_convert_linefeeds(array("\r\n", "\n", "\r"), '<br>', $html);
$this->html_text = tep_convert_linefeeds(array("\r\n", "\n", "\r"), $this->lf, $text);
if (isset($images_dir)) $this->find_html_images($images_dir);
}
}
- open admin/includes/functions/general.php
just above the closing ?> tag at the bottom of the page add:///////////////////start mail manager////////////////////////////////////////start mail manager////////////////////////////////////////start mail manager/////////////////////
function tep_mm_set_mailstatus($mail_id, $status) {
if ($status == '1') {
return tep_db_query("update " . TABLE_MM_RESPONSEMAIL . " set status = '1' where mail_id = '" . (int)$mail_id . "'");
} elseif ($status == '0') {
return tep_db_query("update " . TABLE_MM_RESPONSEMAIL . " set status = '0' where mail_id = '" . (int)$mail_id . "'");
} else {
return -1;
}
}
//mail it
function tep_mm_sendmail($mail, $email_address, $sender_name, $sender, $output_subject, $output_content_html, $output_content_txt) {
$mimemessage = new emailMailManager(array('X-Mailer: cat/mail_manager.com'));
// add html and alternative text version
$mimemessage->add_html($output_content_html, $output_content_txt);
$mimemessage->build_message(); // encoding -> 76 character linebreak, replacements must be done before
$mimemessage->send($mail, $email_address, $sender_name, $sender, $output_subject, $output_content_html, $output_content_txt);
}
///////////////////end mail manager////////////////////////////////////////end mail manager////////////////////////////////////////end mail manager/////////////////////
- open catalog/includes/classes/email.php, add at the bottom before the closing ?> tag:
// eliminate line feeds as <br>
class emailMailManager extends email {
function add_html($html, $text = NULL, $images_dir = NULL) {
$this->html = $html; //tep_convert_linefeeds(array("\r\n", "\n", "\r"), '<br>', $html);
$this->html_text = tep_convert_linefeeds(array("\r\n", "\n", "\r"), $this->lf, $text);
if (isset($images_dir)) $this->find_html_images($images_dir);
}
}
- open catalog/includes/database_tables.php
add:///Mail Manager
define('TABLE_MM_RESPONSEMAIL', 'mm_responsemail');
define('TABLE_MM_RESPONSEMAIL_RESTORE', 'mm_responsemail_backup');
define('TABLE_MM_RESPONSEMAIL_RESET', 'mm_responsemail_reset');
define('TABLE_MM_TEMPLATES', 'mm_templates');
define('TABLE_MM_BULKMAIL', 'mm_bulkmail');
- open admin/includes/column_left.php add:
include(DIR_WS_BOXES . 'mail_manager.php');
just below include(DIR_WS_BOXES . 'modules.php');
- open catalog/includes/functions/general.php
just above the closing ?> tag at the bottom of the page add:///////////////////start mail manager////////////////////////////////////////start mail manager////////////////////////////////////////start mail manager/////////////////////
//
// Sets the status of a mail item
function tep_mm_set_mailstatus($mail_id, $status) {
if ($status == '1') {
return tep_db_query("update " . TABLE_MM_RESPONSEMAIL . " set status = '1' where mail_id = '" . (int)$mail_id . "'");
} elseif ($status == '0') {
return tep_db_query("update " . TABLE_MM_RESPONSEMAIL . " set status = '0' where mail_id = '" . (int)$mail_id . "'");
} else {
return -1;
}
}
//sends it
function tep_mm_sendmail($mail, $email_address, $sender_name, $sender, $output_subject, $output_content_html, $output_content_txt) {
$mimemessage = new emailMailManager(array('X-Mailer: ad/mail_manager.com'));
// add html and alternative text version
$mimemessage->add_html($output_content_html, $output_content_txt);
$mimemessage->build_message(); // encoding -> 76 character linebreak, replacements must be done before
$mimemessage->send($mail, $email_address, $sender_name, $sender, $output_subject, '');
}
///////////////////end mail manager////////////////////////////////////////end mail manager////////////////////////////////////////end mail manager/////////////////////
- open catalog/tell_a_friend.php.
- About line 35 change:
$product_info_query = tep_db_query("select pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
to:
$product_info_query = tep_db_query("select p.products_image, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
( or simply add p.products_image to the query)
-
About line 100 change:
tep_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address);
to//*******start mail manager***************//
if (file_exists(DIR_WS_MODULES.'mail_manager/tell_a_friend.php')){
include(DIR_WS_MODULES.'mail_manager/tell_a_friend.php');
}else{
tep_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address);
}
//*******end mail manager*****************//
- open admin/orders.php. About line 85 change:
tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
to:
//*******start mail manager****************//
if (file_exists(DIR_FS_CATALOG_MODULES.'mail_manager/status_update.php')){
include(DIR_FS_CATALOG_MODULES.'mail_manager/status_update.php');
}else{
tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}
//********end mail manager****************//
- open catalog/create_account.php. About line 210 change:
tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
to:
//*******start mail manager**************//
if (file_exists(DIR_WS_MODULES.'mail_manager/create_account.php')){
include(DIR_WS_MODULES.'mail_manager/create_account.php');
}else{
tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}
//*******end mail manager****************//
- open catalog/checkout_process.php
- about line 350 change:
tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
to:
//*******start mail manager****************//
if (file_exists(DIR_WS_MODULES.'mail_manager/order_confirm.php')){
include(DIR_WS_MODULES.'mail_manager/order_confirm.php');
}else{
tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}
//*******end mail manager*****************//
- about line 245 change
$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
to
$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n".'<br />';
(add a break tag)
- open catalog/password_forgotten change
tep_mail($check_customer['customers_firstname'] . ' ' . $check_customer['customers_lastname'], $email_address, EMAIL_PASSWORD_REMINDER_SUBJECT, sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
to //*******start mail manager
if (file_exists(DIR_WS_MODULES.'mail_manager/password_forgotten.php')){
include(DIR_WS_MODULES.'mail_manager/password_forgotten.php');
}else{
tep_mail($check_customer['customers_firstname'] . ' ' . $check_customer['customers_lastname'], $email_address, EMAIL_PASSWORD_REMINDER_SUBJECT, sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}
//*******end mail manager
- Upload the files and folders in the folder mail_managers folder. All folders and files are new.
- Import the sql database file. It adds 5 tables to your database, and does not change any existing tables or configuration. It also loads several sample templates.
- Create a new field, mmstatus, in the Database in the customers table. The mmstatus.sql file contains command to use in phpmyadmin to create this. This command is posted below:
ALTER TABLE `customers` ADD `mmstatus` CHAR( 2 ) NOT NULL AFTER `customers_newsletter`
This simple contribution places ‘<<previous’ and ‘next>>’ links in the admin orders list. The advantage is that you can click directly to the next order when processing. The original contribution with language capacity can be found here on the OSCommerce website.
1. Add this function to /catalog/admin/includes/functions/general.php before the last ?> tag
function get_order_id($orderid,$mode='next'){
if ($mode=='prev')
$op = '<';
elseif ($mode=='next')
$op = '>';
if($op == '<' or $op == '>')
$nextprev_resource = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id $op '" . (int)$orderid . "' order by orders_id");
if($mode == 'prev'){
while($nextprev_values = tep_db_fetch_array($nextprev_resource)){
$nextprev_value = $nextprev_values;
}
}else if($mode == 'next')
$nextprev_value = tep_db_fetch_array($nextprev_resource);
if(!empty($nextprev_value['orders_id'])) // RLJ - added quoted values - PHP complains about unknown constants.
return $nextprev_value['orders_id']; // RLJ - added quoted values - PHP complains about unknown constants.
else
return false;
}
2. Add this to /catalog/admin/orders.php where you would like the buttons to appear.
<!-- BEGIN NEXT AND PREVIOUS ORDERS DISPLAY IN ADMIN //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php if( $nextid = get_order_id($oID,'prev')) { echo '<a href="' .tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $nextid . '&action=edit') . '">' . PREV_ORDER . '</a>'; } ?></td>
<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, 10); ?></td>
<td class="pageHeading" align="right"><?php if( $previd = get_order_id($oID)) echo '<a href="' .tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $previd . '&action=edit') . '">' . NEXT_ORDER . '</a>'; ?></td>
</tr>
</table>
<!-- END NEXT AND PREVIOUS ORDERS DISPLAY IN ADMIN //-->
for: OSC 2 CSS.
The following code yields a new infobox that displays the last four items viewed. Adapted from this OSCommerce Contribution to fit OSC 2 CSS. Caveat: I have had mixed success with rendering product urls but you can see a successful demo at www.niora.com. View some products and they start showing up in a box in the right hand column. What is unique about this code is that does not use database queries to display the products.
Installation:
2) Add the following command to the left or right column where you want the box to appear.
require(DIR_WS_BOXES . 'recently_viewed.php');
1) create a new file, recently_viewed.php. Paste the following code into this file and upload the file to the includes/boxes folder.
<?php
// Lets set the number of history items to display
$display_count = 4;
$action = (isset($_GET['action']) ? $_GET['action'] : '');
if ($action == 'clear_history') {
unset($_SESSION['last_product_views']);
}
// Build history string
$last_product_views = $_SESSION['last_product_views'];
if ($last_product_views != "") {
$visited_array = explode('|', $_SESSION['last_product_views']);
$output_count = 1;
foreach ($visited_array as $visited_array_item) {
$visited_item = trim($visited_array_item);
if ( ($visited_item != "") && ($output_count <= $display_count) ) {
$item_pieces = explode("^", $visited_item);
$item_image = trim($item_pieces[0]);
$item_name = trim($item_pieces[1]);
$item_url = trim($item_pieces[2]);
$visited_output .= '';
$last_visited_thumb = tep_image(DIR_WS_IMAGES . $item_image, $item_name, '75', '75');
$visited_output .= '<div class="pl-image"><a href="http://' . $item_url . '">' . $last_visited_thumb . '</a></div><div class="pl-name"><a href="http://' . $item_url . '">' . $item_name.'</a><br></div>';
$visited_output .= '';
$output_count++;
}
}
}
// Now look at the current page
if (basename($_SERVER['SCRIPT_NAME']) == "product_info.php") {
// First remove the action=clear_history from the url
$current_product_path = str_replace('&action=clear_history', '', $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
//$pieces = explode("?osCsid", $current_product_path);
//$current_product_path = $pieces[0];
$new_array_item = $product_info['products_image'] . '^' . $product_info['products_name']. '^' . $current_product_path;
// and add it to the $_SESSION variable
$last_product_views = $_SESSION['last_product_views'];
if ($last_product_views == "") {
$_SESSION['last_product_views'] = trim($new_array_item);
} else {
$items_array = explode('|', $_SESSION['last_product_views']);
$count = 1;
$new_array_string = '';
foreach ($items_array as $array_item) {
if ($count <= $display_count) {
$array_item = trim($array_item);
if ($array_item != "") {
if ($array_item != $new_array_item) {
$new_array_string .= "|" . $array_item;
$count++;
}
}
}
}
$_SESSION['last_product_views'] = $new_array_item . '|' . $new_array_string;
}
}
// Display history string to browser
if ($last_product_views != "") {
$info_box_contents = array();
$info_box_contents[] = array('text' => '<hr><div class="align_left"><strong>Last Viewed</strong></div>');
new cssinfoBoxHeading($info_box_contents, 'true', 'true', tep_href_link($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], tep_get_all_get_params(array('action')) . 'action=clear_history'));
$info_box_contents = array();
$info_box_contents[] = array('text' => $visited_output);
// new plcontentBox($info_box_contents);
new cssinfoBox($info_box_contents);
} // end if ($last_product_views != "")
?>
On OCS to CSS this combines the files address_book.php, account_edit.php, account_history.php and account_password.php into one file, account.php. The information is accessed with JQuery tabs for really intuitive and easy navigation. Download this file, account.php and the required CSS file from google.code
Requires the main JQuery file and the JQuery UI file. You will need to be prepared to make adjustments to the html.
Screenshots:
Download the Files
Posted in Function, JQuery
|