Hi all,
I have installed and addon which allows me to clear items in my customer cart.
However it only displays:
Product Date Added Customer # Maintenance 82 20120223 158 - john Smith delete
However I need to try and show the product name as well as the 82.
This is the code.
<?php
/*
Display basket contents
Released under the GNU General Public License
*/
require('includes/application_top.php');
$languages = tep_get_languages();
$languages_array = array();
$languages_selected = DEFAULT_LANGUAGE;
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
$languages_array[] = array('id' => $languages[$i]['code'],
'text' => $languages[$i]['name']);
if ($languages[$i]['directory'] == $language) {
$languages_selected = $languages[$i]['code'];
}
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<meta name="robots" content="noindex,nofollow">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2" height="40">
<tr>
<td class="pageHeading"><?php echo STORE_NAME; ?></td>
<td class="pageHeading" align="right"><?php echo tep_draw_form('adminlanguage', FILENAME_DEFAULT, '', 'get') . tep_draw_pull_down_menu('language', $languages_array, $languages_selected, 'onchange="this.form.submit();"') . tep_hide_session_id() . '</form>'; ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
echo "Please make a database back up before running this file";
?>
<br>
<a href="backup.php"><font color="#006600"><b>Click here to go to the back up page</b></font></a>
<br>
<?php
/*Script by Fimble, OSCommerce Forums,
web Site http://www.linuxuk.co.uk
mail me at nic@linuxuk.co.uk, */
require_once("includes/configure.php");
mysql_connect(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD);
mysql_select_db(DB_DATABASE) or die( "Cannot connect to your database.");
if (isset($_POST['id'])) {
mysql_query("DELETE FROM customers_basket where customers_basket_id = $_POST[id]") ;
mysql_query("DELETE FROM customers_basket_attributes where customers_id = $_POST[customers_id] and products_id = '$_POST[products_id]'") ;
}
$data = mysql_query("SELECT * FROM `customers_basket` A, customers B where A.customers_id = B.customers_id order by A.customers_basket_date_added DESC") ;
$info = mysql_fetch_array( $data );
?>
<table border="1" cellpadding="4" width="750px">
<tr><th>Product</th><th>Date Added</th><th>Customer #</th><th>Maintenance</th>
<?php
while($info = mysql_fetch_array( $data ))
{
echo "<tr>";
echo "<td> ".$info['products_id'] . "</td> ";
echo "<td> ".$info['customers_basket_date_added'] . "</td> ";
echo "<td> ".$info['customers_id'].' - '.$info['customers_firstname'].' '.$info['customers_lastname']. " </td>";
echo "<td><form method='post' action='basket.php'>";
echo "<input type='hidden' value='$info[customers_basket_id]' name='id'>";
echo "<input type='hidden' value='$info[customers_id]' name='customer_id'>";
echo "<input type='hidden' value='$info[products_id]' name='products_id'>";
echo "<input type='submit' value='Delete'></form></td>";
echo "</tr>";
}
?>
</table>
<a href="clear_basket.php"><font color="#ff0000"><b>Click here to clear records</b></font></a>
</table></td>
</tr>
</table></td>
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
Am I able to do this to make it work? Changes are in red
while($info = mysql_fetch_array( $data ))
{
echo "<tr>";
echo "<td> ".$info['products_id'].' '.$info['product_name']. " </td>";
echo "<td> ".$info['customers_basket_date_added'] . "</td> ";
echo "<td> ".$info['customers_id'].' - '.$info['customers_firstname'].' '.$info['customers_lastname']. " </td>";
echo "<td><form method='post' action='basket.php'>";
echo "<input type='hidden' value='$info[customers_basket_id]' name='id'>";
echo "<input type='hidden' value='$info[customers_id]' name='customer_id'>";
echo "<input type='hidden' value='$info[products_id]' name='products_id'>";
echo "<input type='submit' value='Delete'></form></td>";
echo "</tr>";
}
Thanks in advance
Latest News: (loading..)
1 reply to this topic
#1
Posted 24 February 2012 - 12:54 AM
#2
Posted 24 February 2012 - 09:38 AM
You need to alter the sql to go off and get the description
$data = mysql_query("SELECT * FROM `customers_basket` A, customers B where A.customers_id = B.customers_id order by A.customers_basket_date_added DESC") ;
Try w3schools.com for more info on mysql.
HTH
G
$data = mysql_query("SELECT * FROM `customers_basket` A, customers B where A.customers_id = B.customers_id order by A.customers_basket_date_added DESC") ;
Try w3schools.com for more info on mysql.
HTH
G
Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile
Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.
For links mentioned in old answers that are no longer here follow this link Useful Threads.
If this post was useful, click the Like This button over there ======>>>>>.
Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.
For links mentioned in old answers that are no longer here follow this link Useful Threads.
If this post was useful, click the Like This button over there ======>>>>>.









