Totally Zenned
- Join Date:
- Jun 2006
- Posts:
- 565
- Plugin Contributions:
- 0
hide sidebox from lurkers
i would like to edit a sidebox so that it could only be veiwed once someone loggedin to the site.
what code changes would i need to do?
Views: 1,739
Totally Zenned
i would like to edit a sidebox so that it could only be veiwed once someone loggedin to the site.
what code changes would i need to do?
Deceased
MB1:
i would like to edit a sidebox so that it could only be veiwed once someone loggedin to the site.
what code changes would i need to do?
Which sidebox are you wishing to change?
Totally Zenned
the ty tracking sidebox, useless unless your logged in anyways
Deceased
MB1:
the ty tracking sidebox, useless unless your logged in anyways
If this sidebox is based on the orders history sidebox then it should only show up if someone is logged in.
You shouldn't need to make any edits to it at all.
Totally Zenned
well it shows ups up regardless just take a peek at my site and you will see
Deceased
MB1:
well it shows ups up regardless just take a peek at my site and you will see
This tutorial may help: www.zen-cart.com/tutorials/index.php?article=279
Totally Zenned
thanks for the link but i couldn't make it work
<?php
/*
* This file is derived from order_history.php
*
******************************************************************************
* order_history sidebox - if enabled, shows customers' most recent orders *
* *
* @package templateSystem *
* @copyright Copyright 2003-2005 Zen Cart Development Team *
* @copyright Portions Copyright 2003 osCommerce *
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 *
* @version $Id: order_history.php 2718 2005-12-28 06:42:39Z drbyte $ *
******************************************************************************
* File ID: track_orders.php v2.2 by colosports
*/
if ($_SESSION['customer_id']) {
// retreive the last x products purchased
$orders_history_query = "select o.orders_id, o.date_purchased
from " . TABLE_ORDERS . " o
where o.customers_id = '" . (int)$_SESSION['customer_id'] . "'
order by o.date_purchased desc
limit " . MAX_DISPLAY_PRODUCTS_IN_TRACK_ORDERS_BOX;
$orders_history = $db->Execute($orders_history_query);
if ($orders_history->RecordCount() > 0) {
$orders_ids = '';
while (!$orders_history->EOF) {
$orders_ids .= (int)$orders_history->fields['orders_id'] . ',';
$orders_history->MoveNext();
}
$orders_ids = substr($orders_ids, 0, -1);
$rows=0;
$customer_orders_string = '<table border="0" width="100%" cellspacing="0" cellpadding="1">';
$products_history_query = "select orders_id, date_purchased
from " . TABLE_ORDERS . "
where orders_id in (" . $orders_ids . ")
order by date_purchased desc";
$products_history = $db->Execute($products_history_query);
while (!$products_history->EOF) {
$rows++;
$customer_orders[$rows]['id'] = $products_history->fields['orders_id'];
$customer_orders[$rows]['date'] = $products_history->fields['date_purchased'];
$products_history->MoveNext();
}
$customer_orders_string .= '</table>';
}
}
require($template->get_template_dir('tpl_track_orders.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_track_orders.php');
$title = BOX_HEADING_TRACK_ORDERS;
$title_link = false;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
?>
this is the code i'm working with in the modules/sidebox
Deceased
<?php /* * This file is derived from order_history.php * ****************************************************************************** * order_history sidebox - if enabled, shows customers' most recent orders * * * * @package templateSystem * * @copyright Copyright 2003-2005 Zen Cart Development Team * * @copyright Portions Copyright 2003 osCommerce * * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * * @version $Id: order_history.php 2718 2005-12-28 06:42:39Z drbyte $ * ****************************************************************************** * File ID: track_orders.php v2.2 by colosports */ if ($_SESSION['customer_id']) { // retreive the last x products purchased $orders_history_query = "select o.orders_id, o.date_purchased from " . TABLE_ORDERS . " o where o.customers_id = '" . (int)$_SESSION['customer_id'] . "' order by o.date_purchased desc limit " . MAX_DISPLAY_PRODUCTS_IN_TRACK_ORDERS_BOX; $orders_history = $db->Execute($orders_history_query); if ($orders_history->RecordCount() > 0) { $orders_ids = ''; while (!$orders_history->EOF) { $orders_ids .= (int)$orders_history->fields['orders_id'] . ','; $orders_history->MoveNext(); } $orders_ids = substr($orders_ids, 0, -1); $rows=0; $customer_orders_string = '<table border="0" width="100%" cellspacing="0" cellpadding="1">'; $products_history_query = "select orders_id, date_purchased from " . TABLE_ORDERS . " where orders_id in (" . $orders_ids . ") order by date_purchased desc"; $products_history = $db->Execute($products_history_query); while (!$products_history->EOF) { $rows++; $customer_orders[$rows]['id'] = $products_history->fields['orders_id']; $customer_orders[$rows]['date'] = $products_history->fields['date_purchased']; $products_history->MoveNext(); } $customer_orders_string .= '</table>'; } } require($template->get_template_dir('tpl_track_orders.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_track_orders.php'); $title = BOX_HEADING_TRACK_ORDERS; $title_link = false; require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default); ?>MB1:
thanks for the link but i couldn't make it work
>
> this is the code i'm working with in the modules/sidebox
try this and see if it works:
```php
<?php
/*
* This file is derived from order_history.php
*
******************************************************************************
* order_history sidebox - if enabled, shows customers' most recent orders *
* *
* @package templateSystem *
* @copyright Copyright 2003-2005 Zen Cart Development Team *
* @copyright Portions Copyright 2003 osCommerce *
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 *
* @version $Id: order_history.php 2718 2005-12-28 06:42:39Z drbyte $ *
******************************************************************************
* File ID: track_orders.php v2.2 by colosports
*/
// test if box should display
$show_track_orders= false;
if ($_SESSION['customer_id']) {
$show_track_orders= true;
} else {
$show_track_orders= false;
}
if ($show_track_orders == true) {
// retreive the last x products purchased
$orders_history_query = "select o.orders_id, o.date_purchased
from " . TABLE_ORDERS . " o
where o.customers_id = '" . (int)$_SESSION['customer_id'] . "'
order by o.date_purchased desc
limit " . MAX_DISPLAY_PRODUCTS_IN_TRACK_ORDERS_BOX;
$orders_history = $db->Execute($orders_history_query);
if ($orders_history->RecordCount() > 0) {
$orders_ids = '';
while (!$orders_history->EOF) {
$orders_ids .= (int)$orders_history->fields['orders_id'] . ',';
$orders_history->MoveNext();
}
$orders_ids = substr($orders_ids, 0, -1);
$rows=0;
$customer_orders_string = '<table border="0" width="100%" cellspacing="0" cellpadding="1">';
$products_history_query = "select orders_id, date_purchased
from " . TABLE_ORDERS . "
where orders_id in (" . $orders_ids . ")
order by date_purchased desc";
$products_history = $db->Execute($products_history_query);
while (!$products_history->EOF) {
$rows++;
$customer_orders[$rows]['id'] = $products_history->fields['orders_id'];
$customer_orders[$rows]['date'] = $products_history->fields['date_purchased'];
$products_history->MoveNext();
}
$customer_orders_string .= '</table>';
}
require($template->get_template_dir('tpl_track_orders.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_track_orders.php');
$title = BOX_HEADING_TRACK_ORDERS;
$title_link = false;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
?>
Totally Zenned
worked like a charm thank you for your time
Deceased
MB1:
worked like a charm thank you for your time
Glad to help.
Tell staff why this post should be reviewed.