Sideboxes have two peices:
/includes/modules/sideboxes/something.php
/includes/templates/template_default/sideboxes/something.php
For your templates and overrides you would use:
/includes/modules/your_template_dir/sideboxes/something.php
/includes/templates/your_template_dir/sideboxes/something.php
A quick method is using an image that has your coupon code on it for first time customers, meaning they are logged in and have no orders ...
Example would be:
/includes/modules/your_template_dir/sideboxes/coupon_sidebox.php
<?php
/**
* blank sidebox - allows a blank sidebox to be added to your site
*
* @package templateSystem
* @copyright 2007 Kuroi Web Design
* @copyright Portions Copyright 2003-2007 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: coupon_sidebox.php 2007-05-26 kuroi $
*/
// test if box should display
$show_coupon_sidebox = false;
// not logged in hide box
if ($_SESSION['customer_id'] > 0) {
// check if first order exists
global $db;
$sql = "SELECT orders_id
FROM " . TABLE_ORDERS . "
WHERE customers_id = '" . $_SESSION['customer_id'] . "'
LIMIT 1";
$chk_first_time = $db->Execute($sql);
if ($chk_first_time->EOF) {
// no orders show box
$show_coupon_sidebox = true;
} else {
// found an order hide box
$show_coupon_sidebox = false;
}
} else {
$show_coupon_sidebox = false;
}
if ($show_coupon_sidebox == true) {
require($template->get_template_dir('tpl_coupon_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_coupon_sidebox.php');
$title = BOX_HEADING_COUPON_SIDEBOX;
$title_link = false;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
?>
/includes/templates/your_template_dir/sideboxes/tpl_coupon_sidebox.php
<?php
/**
* blank sidebox - allows a blank sidebox to be added to your site
*
* @package templateSystem
* @copyright 2007 Kuroi Web Design
* @copyright Portions Copyright 2003-2007 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: coupon_sidebox.php 2007-05-26 kuroi $
*/
$content = '';
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
$content .= zen_image(DIR_WS_TEMPLATE_IMAGES . 'my_coupon.gif');
$content .= '</div>';
The image my_coupon.gif would then go into:
/includes/templates/classic/images/my_coupon.gif
For the language file use:
/includes/languages/english/extra_definitions/your_template_dir/coupon_sidebox.php
<?php
/**
* blank sidebox - allows a blank sidebox to be added to your site
*
* @package templateSystem
* @copyright 2007 Kuroi Web Design
* @copyright Portions Copyright 2003-2007 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: coupon_sidebox.php 2007-05-26 kuroi $
*/
define('BOX_HEADING_COUPON_SIDEBOX', 'First Time Customers!');
?>
Linda McGrath
If you have to think ... you haven't been zenned ...
**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!