Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding a box on the admin side


jacenstuff

Recommended Posts

I don't know much, let me start there. I'm trying to customize my backend for ease of use. What i'm trying to do should be simple, and sound slike it can be. Iam trying to add a box on the left side thats always there. I made the file and added it to column_left.php, but it failed to recognize it, after tinkering with the code for a bit I eventually got a different error saying :

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/.afro/jacen/dweebweaver.com/shop/admin/includes/functions/database.php:13) in /home/.afro/jacen/dweebweaver.com/shop/admin/includes/functions/database.php on line 13

 

staring at that, scratching my head, then looking back at my code, I realized what was going on. Now in order for you to answer me I should tell you what I'm trying to do, in detail, first. When you go to your admin page, after you login you get brought to index.php, and there is a left side of boxes, one that is links to OSC, another with order status, another with customers/order tallies, and another with the SSL box. I'm trying to take the one with the order status (i.e. processing, paypal[ipn], delivered, cancelled, etc) and put it in it's own box underneath the main left column that we adjust our store config and such.

The problem is that I took the code for it from index.php, cropped out just what i needed and tried to make a box... like so:

 

<?php
/*
 $Id: index.php,v 1.19 2003/06/27 09:38:31 dgw_ Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
?>

<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<?php
 $heading = array();
 $contents = array();

 echo '<br>';

 $orders_contents = '';
 $orders_status_query = tep_db_query("select orders_status_name, orders_status_id from " . TABLE_ORDERS_STATUS . " where language_id = '" . $languages_id . "'");
 while ($orders_status = tep_db_fetch_array($orders_status_query)) {
$orders_pending_query = tep_db_query("select count(*) as count from " . TABLE_ORDERS . " where orders_status = '" . $orders_status['orders_status_id'] . "'");
$orders_pending = tep_db_fetch_array($orders_pending_query);
$orders_contents .= '<a href="' . tep_href_link(FILENAME_ORDERS, 'selected_box=customers&status=' . $orders_status['orders_status_id']) . '">' . $orders_status['orders_status_name'] . '</a>: ' . $orders_pending['count'] . '<br>';
 }
 $orders_contents = substr($orders_contents, 0, -4);

 $heading = array();
 $contents = array();

 $heading[] = array('params' => 'class="menuBoxHeading"',
				 'text'  => 'Order Menu');

 $contents[] = array('params' => 'class="infoBox"',
				  'text'  => $orders_contents);

 $box = new box;
 echo $box->menuBox($heading, $contents);

?>

 

Now the error totally makes sense, this code(i think) is trying to connect to the DB, and it conflicts with the main area of the admin page(which is doing the same thing). So what I need to do, is make a box just like the one on index.php, and port it over under the column_left.php in it's own box to monitor orders while I config and mess around and update whatever in the admin side, but I can't have it conflict with the dbase connection obviously. Any ideas? There are probably 100's of ways to do this, like running a loop or sorts, i dunno. but i don't know anything about php coding to make it myself... so can anyone help?

We must be the change we wish to see in the world.

------------------------------------------------------------

p.s. BACKUP!

Link to comment
Share on other sites

Personally I don't have the best answer, my first gues would be is you added a duplicate box, so when it does this

orders_status_query = tep_db_query("

then down the line it hits your douplicate box, and tried to do it again, problem being is it was already done once.

 

I personally think its because you duplicated an existing box, and from what I understand is you want to remove it from the main index, and put it in its own box inside the backend underneath admin/column_left.php Which if thats true I am really not sure why you would want to do that. The box is on the main index as a quick link to your orders, there is already an orders list inside the admin panel under the customers heading.

 

To each his own, but you will problem have to do some database changes to the configuration and configuration_group tables, It would probably be easier to just create a heading called Orders inside the admin panel and change the already existing tables to have visable links in the left column. Either way its a lot of coding for something that already exists in the admin control.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...