Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Unsold Carts Report


Guest

Recommended Posts

When I put the following code into the reports page the report does not show up in my oscommerce report area. I am using the Discount Coupon and I think that may be the problem. Here is what my code looks like without the Unsold Carts code. What code do I put and where?? Thanks!

 

<?php

/*

$Id: reports.php,v 1.5 2003/07/09 01:18:53 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- reports //-->

<tr>

<td>

<?php

$heading = array();

$contents = array();

 

$heading[] = array('text' => BOX_HEADING_REPORTS,

'link' => tep_href_link(FILENAME_STATS_PRODUCTS_VIEWED, 'selected_box=reports'));

 

if ($selected_box == 'reports') {

$contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_VIEWED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_VIEWED . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_PURCHASED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_PURCHASED . '</a><br>' .

//kgt - discount coupons report

'<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a><br>'.

'<a href="' . tep_href_link(FILENAME_STATS_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_DISCOUNT_COUPONS . '</a>');

/*************

'<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a>'); *************/

//end kgt - discount coupons report

}

 

$box = new box;

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

?>

</td>

</tr>

<!-- reports_eof //-->

Link to comment
Share on other sites

I just wanted to say thank you all for this contribution.

 

I ran a report, and found that over the last ~ 10 days there were just about 200 abandoned carts (BY registered users)

 

I emailed all of the abandoned cart users, and had 5% come back and purchase, or just about $4500.

 

Now, it will always make me wonder, was it the reminder that I sent them that made them purchase ? Or, were they coming back to purchase anyways.

 

Ill probably never know. But, if even just half of the $4500 purchases were because of my reminder, heck, thats still $2500 I would have gained in sales anyways.

 

Thanks again guys.

Link to comment
Share on other sites

  • 2 months later...

hi,

i have been using this contribution.. but i am having DATE issue!! i have seen all the previous posts about the fix! but nothing!

the problem is that my unsold cart is showing completely wrong date!!!

i am using the latest version by user delete13 dated 10 Jan, 2008

 

 

i made one unsold item today 17, April 2008 but it is showing that entry as made on Saturday 30 April, 2011

 

 

here is the code of the file im using.. please help me here!

 

<?php

require('includes/application_top.php');

require(DIR_WS_CLASSES . 'currencies.php');

// PARAMETERS 
 define(UNSOLD_IMAGE_HEIGHT, 40);
 define(UNSOLD_IMAGE_WIDTH, 40);
 define(UNSOLD_DAYS, 20);

$currencies = new currencies();

$tdate = $_POST['tdate'];
if ($_POST['tdate'] == '') $tdate = $_GET['tdate'];
if ($_GET['tdate'] == '') $tdate = UNSOLD_DAYS;

// Delete Entry Begin : Roman Gruhn
if ($HTTP_GET_VARS['action']=='delete') { 
  $reset_query_raw = "delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id=$HTTP_GET_VARS[customer_id]"; 
  tep_db_query($reset_query_raw); 
  $reset_query_raw2 = "delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id=$HTTP_GET_VARS[customer_id]"; 
  tep_db_query($reset_query_raw2); 
  tep_redirect(tep_href_link(FILENAME_STATS_UNSOLD_CARTS, 'delete=1&customer_id='. $HTTP_GET_VARS['customer_id'] . '&tdate=' . $tdate)); 
} 
if ($HTTP_GET_VARS['delete']) { 
  $messageStack->add(MESSAGE_STACK_CUSTOMER_ID . $HTTP_GET_VARS['customer_id'] . MESSAGE_STACK_DELETE_SUCCESS, 'success'); 
} 
// Delete Entry End
?>
<!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;?>">
 <title><?php echo TITLE; ?></title>
 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->

<?
function seadate($day)  {
 $rawtime = strtotime("-".$day." days");
 $ndate = date("Ymd", $rawtime);
 return $ndate;
}

function cart_date_short($raw_date) {
 if ( ($raw_date == '00000000') || ($raw_date == '') ) return false;

 $year = substr($raw_date, 0, 4);
 $month = (int)substr($raw_date, 4, 2);
 $day = (int)substr($raw_date, 6, 2);

 if (@date('Y', mktime(0, 0, 0, $month, $day, $year)) == $year) {
return date(DATE_FORMAT, mktime(0, 0, 0, $month, $day, $year));
 } else {
return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime(0, 0, 0, $month, $day, 2037)));
 }
}
?>

<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 align="left" colspan="2">
	<!-- REPORT TABLE BEGIN //-->
	  <table border="0" width="100%" cellspacing="0" cellpadding="2">
		<tr>
		  <td class="pageHeading" align="left"  colspan="2"><?php echo HEADING_TITLE; ?></td>
		  <td class="pageHeading" align="right"  colspan="4">
			<form method="get" action="stats_unsold_carts.php">
			  <table align="right" width="100%">
				<tr class="dataTableContent" align="right">
				  <td><?php echo DAYS_FIELD_PREFIX; ?><input type=text size=4 width=4 value=<?php echo $tdate; ?> name=tdate><?php echo DAYS_FIELD_POSTFIX; ?><input type=submit value="<?php echo DAYS_FIELD_BUTTON; ?>"></td>
				</tr>
			  </table>
			</form>
		  </td>
		</tr>
		<tr class="dataTableHeadingRow">
		  <td class="dataTableHeadingContent" align="left" colspan="1" width="15%"><?php echo TABLE_HEADING_DATE; ?></td>
		  <td class="dataTableHeadingContent" align="left" colspan="1" width="35%"><?php echo TABLE_HEADING_CUSTOMER; ?></td>
		  <td class="dataTableHeadingContent" align="left" colspan="1" width="35%"><?php echo TABLE_HEADING_EMAIL; ?></td>
		  <td class="dataTableHeadingContent" align="left" colspan="3" width="15%"><?php echo TABLE_HEADING_PHONE; ?></td>
		</tr>
		<tr class="dataTableHeadingRow">
		  <td class="dataTableHeadingContent" align="left"   colspan="1" width="20%"><?php echo TABLE_HEADING_MODEL; ?></td>
		  <td class="dataTableHeadingContent" align="left"   colspan="2" width="40%"><?php echo TABLE_HEADING_DESCRIPTION; ?></td>
		  <td class="dataTableHeadingContent" align="center" colspan="1" width="10%"><?php echo TABLE_HEADING_QUANTY; ?></td>
		  <td class="dataTableHeadingContent" align="right"  colspan="1" width="15%"><?php echo TABLE_HEADING_PRICE; ?></td>
		  <td class="dataTableHeadingContent" align="right"  colspan="1" width="15%"><?php echo TABLE_HEADING_TOTAL; ?></td>
		</tr>

<?php
 $ndate = seadate($tdate);
 $query1 = tep_db_query("select cb.customers_id cid,
							 cb.products_id pid,
							 cb.customers_basket_quantity qty,
							 cb.customers_basket_date_added bdate,
							 cus.customers_firstname fname,
							 cus.customers_lastname lname,
							 cus.customers_telephone phone,
							 cus.customers_email_address email
					  from   " . TABLE_CUSTOMERS_BASKET . " cb,
							 " . TABLE_CUSTOMERS . " cus
					  where  cb.customers_basket_date_added >= '" . $ndate . "' and
							 cb.customers_id = cus.customers_id order by cb.customers_basket_date_added desc,
							 cb.customers_id ");
 $results = 0;
 $curcus = "";
 $tprice = 0;
 $totalAll = 0;
 $knt = mysql_num_rows($query1);
 $first_line = true;
 for ($i = 0; $i <= $knt; $i++) {
$inrec = tep_db_fetch_array($query1);

if ($curcus != $inrec['cid']) {
  // output line
  $totalAll += $tprice;
  $tcart_formated = $currencies->format($tprice);
  $cline .= "
		<tr>
		  <td class='dataTableContent' align='right' colspan='6'><b>" . TABLE_CART_TOTAL . "</b>" . $tcart_formated . "</td>
		</tr>
		<tr>
		  <!-- Delete Button : Roman Gruhn //-->
		  <td colspan='6' align='right'><a href=" . tep_href_link(FILENAME_STATS_UNSOLD_CARTS,"action=delete&customer_id=$curcus&tdate=$tdate") . ">" . tep_image_button('button_reset.gif', IMAGE_RESET) . "</a></td>
		</tr>";

  if ($curcus != "") echo $cline;

  // set new cline and curcus
  $curcus = $inrec['cid'];
  $tprice = 0;

  if ($first_line == false) { 
	$cline = "
		<tr>
		  <td colspan=6><br></td>
		</tr>";
  } else {
	$cline = "";
	$first_line = false;
  }
  $cline .= "
		<tr>
		  <td class='dataTableContent' align='left' width='15%'> " . tep_date_long($inrec['bdate']) . "</td>
		  <td class='dataTableContent' align='left' width='35%'><a href='" . tep_href_link(FILENAME_CUSTOMERS, 'search=' . $inrec['lname'], 'NONSSL') . "'>" . $inrec['fname'] . " " . $inrec['lname'] . "</a></td>
		  <td class='dataTableContent' align='left' width='35%'><a href='" . tep_href_link('mail.php', 'selected_box=tools&customer=' . $inrec['email']) . "'>" . $inrec['email'] . "</a></td>
		  <td class='dataTableContent' align='left' colspan='3' width='15%'>" . $inrec['phone'] . "</td>
		</tr>";
}

// empty the shopping cart
$query2 = tep_db_query("select  p.products_price price,
								p.products_model model,
								p.products_image image,
								pd.products_name name
						from	" . TABLE_PRODUCTS . " p,
								" . TABLE_PRODUCTS_DESCRIPTION . " pd,
								" . TABLE_LANGUAGES . " l
						where   p.products_id = '" . $inrec['pid'] . "' and
								pd.products_id = p.products_id and
								l.languages_id = pd.language_id");

$inrec2 = tep_db_fetch_array($query2);
$tprice = $tprice + ($inrec['qty'] * $inrec2['price']);

if ($inrec['qty'] != 0) {
  $pprice_formated  = $currencies->format($inrec2['price']);
  $tpprice_formated = $currencies->format(($inrec['qty'] * $inrec2['price']));
  $cline .= "
		<tr class='dataTableRow'>
		  <td class='dataTableContent' align='left'   width='20%'>" . $inrec2['model'] . "</td>
		  <td class='dataTableContent' align='left'   colspan='2' width='40%'><a href='" . tep_href_link(FILENAME_CATEGORIES, 'action=new_product_preview&read=only&pID=' . $inrec['pid'] . '&origin=' . FILENAME_STATS_UNSOLD_CARTS . '?page=' . $HTTP_GET_VARS['page'], 'NONSSL') . "'>" . $inrec2['name'] . "</a></td>
		  <td class='dataTableContent' align='center' width='10%'>" . $inrec['qty'] . "</td>
		  <td class='dataTableContent' align='right'  width='15%'>" . $pprice_formated . "</td>
		  <td class='dataTableContent' align='right'  width='15%'>" . $tpprice_formated . "</td>
		</tr>
		<td class='dataTableContent' align='left'  width='15%'>" . tep_image(DIR_WS_CATALOG_IMAGES . $inrec2['image'], '',  $inrec2['name'], UNSOLD_IMAGE_WIDTH,  UNSOLD_IMAGE_HEIGHT) . "</td>
		";

}
 }
 $totalAll_formated = $currencies->format($totalAll);

 $cline .= "
		<tr>
		  <td class='dataTableContent' align='right' colspan='6'><b>" . TABLE_GRAND_TOTAL . "</b>" . $totalAll_formated . "</td>
		</tr>";

 echo $cline;
?>
	</tr>	
	  </table>
	<!-- REPORT TABLE END //-->
	</td>
  </tr>
</table>
 </td>
<!-- body_text_eof //-->
</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'); ?>

outside links are not allowed in signatures

Link to comment
Share on other sites

  • 1 month later...

Hi ya,

 

I've got 2 issues with the unsold cart.

 

1) the thumbnails are displaying 1 pixel wide by 40 pixel high.

The parameters specifically are displaying

// PARAMETERS 
 define(UNSOLD_IMAGE_HEIGHT, 40);
 define(UNSOLD_IMAGE_WIDTH, 40);
 define(UNSOLD_DAYS, 10);

 

2) my dates are way off. My server does have the proper date set--just checked--but the report is displaying the year 2012.

 

Suggestions or solutions anyone?

 

Thanks!

Link to comment
Share on other sites

  • 10 months later...

Hi!

 

I install delete13 version and this error is displayed:

 

Warning: Division by zero in /home/content/catalog/admin/includes/functions/html_output.php on line 110

 

Thumbs are displayed but error too.

 

Can anybody help me?

 

Thanks

Link to comment
Share on other sites

  • 1 year later...

Hi! Installed (a few times) the contri but I get this error:

 

The requested URL /admin/stats_unsold_carts.php was not found on this server.

 

Apache/2.0.54 (Unix) mod_ssl/2.0.54 OpenSSL/0.9.7e-p1 FrontPage/5.0.2.2635 PHP/4.4.4 mod_jk/1.2.15 mod_python/3.1.4 Python/2.2.2 mod_perl/2.0.2 Perl/v5.8.8 Server at www.mywebsite.eu Port 80

 

 

I have installed the same files on an other website and it worked fine but on my own website (dutch only) I'll be getting the same error over an over again..

 

Please help me!! ;) Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...