Zen Cart Logo
Forums / Addon Sideboxes / hide sidebox from lurkers

hide sidebox from lurkers

Locked

Views: 1,739

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
18 May 2008, 6:33 PM
#1
mb1 avatar

mb1

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?

18 May 2008, 7:09 PM
#2
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: hide sidebox from lurkers

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?

18 May 2008, 7:14 PM
#3
mb1 avatar

mb1

Totally Zenned

Join Date:
Jun 2006
Posts:
565
Plugin Contributions:
0

Re: hide sidebox from lurkers

the ty tracking sidebox, useless unless your logged in anyways

18 May 2008, 7:40 PM
#4
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: hide sidebox from lurkers

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.

18 May 2008, 11:16 PM
#5
mb1 avatar

mb1

Totally Zenned

Join Date:
Jun 2006
Posts:
565
Plugin Contributions:
0

Re: hide sidebox from lurkers

well it shows ups up regardless just take a peek at my site and you will see

18 May 2008, 11:51 PM
#6
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: hide sidebox from lurkers

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

19 May 2008, 1:13 AM
#7
mb1 avatar

mb1

Totally Zenned

Join Date:
Jun 2006
Posts:
565
Plugin Contributions:
0

Re: hide sidebox from lurkers

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

19 May 2008, 2:35 AM
#8
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: hide sidebox from lurkers

MB1:

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

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);
  }
?>
19 May 2008, 5:31 AM
#9
mb1 avatar

mb1

Totally Zenned

Join Date:
Jun 2006
Posts:
565
Plugin Contributions:
0

Re: hide sidebox from lurkers

worked like a charm thank you for your time

19 May 2008, 5:52 AM
#10
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: hide sidebox from lurkers

MB1:

worked like a charm thank you for your time

Glad to help.