Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Abandoned Carts


Guest

Recommended Posts

  • Replies 211
  • Created
  • Last Reply

Top Posters In This Topic

Thats what I thought, I added just your version and it worked, but then where does this fit in?

 

<?php
/*
$Id: scart.php,v 2.0 2003/10/24 21:01:31 $

scart contrib: JM Ivler (c)
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Released under the GNU General Public License

*/

define('HEADING_TITLE1', 'Abandoned Cart Report');
define('HEADING_TITLE2', 'Abandoned Cart E-Mail');


define('TABLE_HEADING_CUSTOMERS', 'Customers.');
define('TABLE_HEADING_EMAIL', 'E-Mail');
define('TABLE_HEADING_CART', 'Cart');
define('EMAIL_TTL', '90');

define('EMAIL_SEPARATOR', '------------------------------------------------------');
define('EMAIL_TEXT_SUBJECT', 'Enquiry from Education 4 Kids');
define('EMAIL_TEXT_NEWCUST', "\n\n".'Thank you for stopping by Education 4 Kids and considering us for your purchase. We noticed that in your visit to our store that you placed the following item(s) in your shopping cart, but did not complete the transaction with us. ' . "\n\n" . 'Cart Contents:'."\n\n".'%s' . "\n\n" . 'We are always interested in knowing what happened and if there was a reason that you decided to not purchase with Education 4 Kids at this time. If you could be so kind as to let us know if you had any issues or concerns, we would like to address them as getting this feedback from you and others is how we can help make your experience at Education 4 Kids better. '."\n\n". 'Again, thank you for your time and consideration in helping us make Education 4 Kids a better place.'."\n\n".'JM Ivler'."\n".'Education 4 Kids ' . "\n". 'http://edushop.edu4kids.com/' . "\n");
define('EMAIL_TEXT_CUST', "\n\n".'Firstoff, we would like to thank you for having purchased from Education 4 Kids in the past. Secondly, we noticed in your recent visit to Education 4 Kids that you placed the following item(s) in your shopping cart, but didn\'t complete the transaction with us. ' . "\n\n" . 'Cart Contents:'."\n\n".'%s' . "\n\n" . 'We are always interested in knowing what happened and if there was a reason that you decided to not purchase with Education 4 Kids at this time. If you could be so kind as to let us know if you had any issues or concerns we would like to address them as getting this feedback from you and others is how we can help make your experience at Education 4 Kids better. '."\n\n". 'Again, thank you for your time and consideration in helping us make Education 4 Kids a better place.'."\n\n".'JM Ivler'."\n".'Education 4 Kids ' . "\n". 'http://edushop.edu4kids.com/' . "\n");

?>

 

Am I supposed to combine the two together? Do I ad it to the top of your version of Scart.php?

Edited by Goanna
Link to comment
Share on other sites

Thats what I thought, I added just your version and it worked, but then where does this fit in?

 

<snip code>

 

Am I supposed to combine the two together? Do I ad it to the top of your version of Scart.php?

Okay, there are three files.

 

1) scart.php that goes in the top level of your admin (latest version was posted by defender39)

2) scart.php that goes in the /includes/languages/english/ directory (that's the one you copied - posted by me)

3) the readme file that tells you what you have to add to application_top.php and has the SQL for the new table (posted by me in the same post as #2)

 

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

 

And in a completly different note, There will be at least one update coming out. We are adding a new field and new checkbox. This checkbox allows you to set a customer as "phoned" so you will have a visual indicator that you have talked to the customer. I'm also looking at a way to modify the Customers "Contact Us" so that it will store a flag (that displays in the report) when a customer has contacted you as well (so you will know not to send them an e-mail).

 

I was thinking about allowing a pulldown of all current coupons so you could add a coupon by pulldown, but not everyone has that contrib installed, so I'm not too hot on that one.

 

Come on folks, give up some ideas...

Link to comment
Share on other sites

okay, I renamed them both to scart and they work now, but I have to enter the URL to access them. I cant access it through the admin.

 

Do I have to change anything in the other files that where updated last time (english.php), reports.php) since I am now using a different filename? Or was the addition of the code in your readme file supposed to ad the link for me?

 

Also, is there a certain area in application_top.php where I should be pasting that code?

Edited by Goanna
Link to comment
Share on other sites

Edit, I got it working.

 

I had to use

define('FILENAME_UNSOLD_CARTS', 'scart.php');

instead of the one you posted.

 

Thanks for the help guys.

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

Off topic, but why can we only edit our posts once? Wouldnt that be better for the forum space wise instead of us having to put down a new post whenever we have an update?

Link to comment
Share on other sites

okay, I renamed them both to scart and they work now, but I have to enter the URL to access them. I cant access it through the admin.

 

Do I have to change anything in the other files that where updated last time (english.php), reports.php) since I am now using a different filename? Or was the addition of the code in your readme file supposed to ad the link for me?

 

Also, is there a certain area in application_top.php where I should be pasting that code?

 

hmmm, that's defender39's piece, I call it by URL and don't have it in reports (of course with the changes that have been made in it, I would place it into tools now :-) ). My guess is that there are changes to reports.php (you will have to change the filename it calls)

 

As for the application_top. I have it after one of the other contrib add-ons I added (I believe I added it after my visitors contrib addons.).

Link to comment
Share on other sites

Off topic, but why can we only edit our posts once? Wouldnt that be better for the forum space wise instead of us having to put down a new post whenever we have an update?
Two problems:

 

1. It interferes with how the news server version of the forums works (IIRC, edited posts never make it to the news server, just the originals).

 

2. It wouldn't show the edited post as a new post in any useful fashion, so no one would know to read it.

 

Hth,

Matt

Link to comment
Share on other sites

scart.php and unsold_carts.php are the same thing...

 

I prefer the name unsold_carts but the programmer can call it whatever he wants...not sure what the s stands for

Well, I was going to call it abandoned_carts.php (or acarts.php), but that group of carts is much higher than what we are looking at. We are reviewing only those carts that were abandoned in which we have contact data. I know of no word that defined these types of carts so I coined the term "stranded". These carts have owners who have "stranded" them (as in "cut off or left behind"). So, that's where the "s" came in.

 

So, in actuality the report title should be "Stranded Cart Report", but who, besides me, would have understood that reference? :D

Link to comment
Share on other sites

Blah!

 

I had about a zillion parse errors in /admin/scart.php and then when I got all of those fixed... I ended up with this:

 

1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near '.customers_basket_date_added as bdate, cus.customers_firstname

 

select cb.customers_id as cid, cb.products_id as pid, cb.customers_basket_quantity as qty,? cb.customers_basket_date_added as bdate, cus.customers_firstname as fname, cus.customers_lastname as lname, cus.customers_telephone as phone, cus.customers_email_address as email from customers_basket as cb, customers as cus where cb.customers_basket_date_added >= '20031016' and cb.customers_id = cus.customers_id order by cb.customers_basket_date_added desc, cb.customers_id

 

[TEP STOP]

 

 

Any ideas? I'm running MS2 so this may be the entire problem :-(

 

I wish there was some kind of "foundation" from with all of us were working from. I'm having the worst time adding many of these wonderful contribs because I seem to be using the wrong version (although it is the "standard" stable release???)

 

::L'sigh::

 

Khim~

Do not meddle in the affairs of Dragons, for you are crunchy and good with ketchup :-)

Link to comment
Share on other sites

NM the above post :-)

 

After I deleted the extra spaces in the code, it works like a charm! So the concensus is... it works for MS2!!!!

 

Weeee!

 

Khim~

Do not meddle in the affairs of Dragons, for you are crunchy and good with ketchup :-)

Link to comment
Share on other sites

Here's a copy of the language file with all the proper variables plugged in:

 

<?php
/*
$Id: scart.php,v 2.0 2003/10/24 21:01:31 $

scart contrib: JM Ivler (c)
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Released under the GNU General Public License

*/

define('HEADING_TITLE1', 'Abandoned Cart Report');
define('HEADING_TITLE2', 'Abandoned Cart E-Mail');


define('TABLE_HEADING_CUSTOMERS', 'Customers.');
define('TABLE_HEADING_EMAIL', 'E-Mail');
define('TABLE_HEADING_CART', 'Cart');
define('EMAIL_TTL', '90');

define('EMAIL_SEPARATOR', '------------------------------------------------------');
define('EMAIL_TEXT_SUBJECT', 'Question from ' . STORE_NAME);
define('EMAIL_TEXT_NEWCUST', "\n\n".'Thank you for stopping by ' . STORE_NAME . ' and considering us for your purchase. We noticed that in your visit to our store that you placed the following item(s) in your shopping cart, but did not complete the transaction with us. ' . "\n\n" . 'Cart Contents:'."\n\n".'%s' . "\n\n" . 'We are always interested in knowing what happened and if there was a reason that you decided to not purchase with' . STORE_NAME . ' at this time. If you could be so kind as to let us know if you had any issues or concerns, we would like to address them as getting this feedback from you and others is how we can help make your experience at ' . STORE_NAME . ' better. '."\n\n". 'Again, thank you for your time and consideration in helping us make ' . STORE_NAME . ' a better place.'."\n\n". STORE_OWNER ."\n". STORE_NAME . "\n". HTTP_SERVER . DIR_WS_CATALOG . "\n");
define('EMAIL_TEXT_CUST', "\n\n".'First off, we would like to thank you for having purchased from ' . STORE_NAME . ' in the past. Secondly, we noticed in your recent visit to ' . STORE_NAME . ' that you placed the following item(s) in your shopping cart, but didn\'t complete the transaction with us. ' . "\n\n" . 'Cart Contents:'."\n\n".'%s' . "\n\n" . 'We are always interested in knowing what happened and if there was a reason you decided not to purchase with ' . STORE_NAME . ' at this time. If you could be so kind as to let us know if you had any issues or concerns we would like to address them as getting this feedback from you and others is how we can help make your experience at ' . STORE_NAME . ' better. '."\n\n". 'Again, thank you for your time and consideration in helping us make ' . STORE_NAME . ' a better place.'."\n\n". STORE_OWNER ."\n". STORE_NAME . "\n". HTTP_SERVER . DIR_WS_CATALOG . "\n");

?>

Link to comment
Share on other sites

I'm still testing this, but here is a report that shows how well you have done on recapture.

 

scart-report.php (goes into the top of your admin directory).

 

<?php
/*
 $Id: scart.php,v 2.0 2003/10/24 21:01:31 $

 scart-report contrib: JM Ivler (c)
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Released under the GNU General Public License

*/

 require('includes/application_top.php');

 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

?>
<!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) {
$ts = date("U");
$rawtime = strtotime("-".$day." days", $ts);
$ndate = date("Ymd", $rawtime);
return $ndate;
}
?>
<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 colspan=5><table border="0" width="100%" cellspacing="0" cellpadding
="0">
         <tr>

<?
 $tdate = $_POST['tdate'];
 if ($_POST['tdate'] == '') $tdate = '3';
 $ndate = seadate($tdate);
//  echo $ndate; // debug line, shows the date we are seeking
?>
           <td class="pageHeading"><? echo HEADING_TITLE1; ?> </td>
           <td class="pageHeading" align="right"><form method=post action=<? ec
ho $PHP_SELF;?> > <table><tr><td>Last </td><td><input type=text size=4 width=4 v
alue=<? echo $tdate; ?> name=tdate> </td><td>Days </td><td><input type=submit va
lue="New Run"> </td></tr></table></form> <?php echo tep_draw_separator('pixel_tr
ans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>

<?php 
 $custknt = 0;
 $tdate = $_POST['tdate'];
 if ($_POST['tdate'] == '') $tdate = '3';
 $ndate = seadate($tdate);
//  echo $ndate; // debug line, shows the date we are seeking
 $conquery = tep_db_query("select * from ". TABLE_SCART ." where dateadded >= '
".$ndate."'" );
 $knt = mysql_num_rows($conquery);
 for ($i = 0; $i < $knt; $i++) {
    $inrec = tep_db_fetch_array($conquery);
// echo $inrec['dateadded']."<br>"; '' debug line
    $cid = $inrec['customers_id'];
    $query1 = tep_db_query("select cus.customers_firstname as fname, cus.custom
ers_lastname as lname from customers as cus where cus.customers_id ='".$cid."'")
;
    $crec = tep_db_fetch_array($query1);
    $cquery = tep_db_query("select * from orders where customers_id = '".$cid."
'" );
    $iknt = mysql_num_rows($cquery);
    for ($j = 0; $j < $iknt; $j++) {
      $orec = tep_db_fetch_array($conquery);
// split the date_purchased on the space
      $orderdate = explode(' ',$orec['date_purchased']);
// take the [0] and remove the "-"'s
      $odate = str_replace('-','',$orderdate[0]);
// see if they have purchased since the message 
      if ($inrec['dateadded'] <= $odate) {
        $custknt++;
        $custlist .= $crec['lname'].", ".$crec['fname']."<br>";
      }
    }
 }
  $cline = " <tr><td><b>Examined Records: </b>".$knt."</td></tr> <tr><td><b>Sal
es: </b>".$custknt."</td></tr> ";
  echo $cline;
?>
     <tr>
       <td class="smallText">
      <tr class="dataTableHeadingRow"> 
       <td class="dataTableHeadingContent">Customer</td> 
      </tr>
<?
  $cline = " <tr><tr><td>".$custlist."</td></tr> </table></td></tr>";
  echo $cline;

?>
    </tr> 
   </table> 
  </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'); ?>

 

and the associated language file scart-report.php (goes in includes/languages/english/).

<?php
/*
 $Id: scart.php,v 2.0 2003/10/24 21:01:31 $

 scart-report contrib: JM Ivler (c)
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Released under the GNU General Public License
 
*/

define('HEADING_TITLE1', 'Stranded Cart Recovery Report');
define('TABLE_HEADING_CUSTOMERS', 'Customers.');

?>

 

If this works like it should, it will give you a record count from the last X days (default is 3) of those contacted and then the number of contacted that have become sales along with the customer names that were made into sales.

 

Like I said, I'm still testing it, but in case anyone else wants to play with it, here it is.

Link to comment
Share on other sites

Tested and debugged version of the scart_report.php.

 

<?php
/*
 $Id: scart.php,v 2.0 2003/10/24 21:01:31 $

 scart-report contrib: JM Ivler (c)
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Released under the GNU General Public License

*/

 require('includes/application_top.php');

 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

?>
<!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) {
$ts = date("U");
$rawtime = strtotime("-".$day." days", $ts);
$ndate = date("Ymd", $rawtime);
return $ndate;
}
?>
<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 colspan=5><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>

<?
 $tdate = $_POST['tdate'];
 if ($_POST['tdate'] == '') $tdate = '3';
 $ndate = seadate($tdate);
//  echo $ndate; // debug line, shows the date we are seeking
?>
           <td class="pageHeading"><? echo HEADING_TITLE1; ?> </td>
           <td class="pageHeading" align="right"><form method=post action=<? echo $PHP_SELF;?> > <table><tr><td>Last </td><td><input type=text size=4 width=4 value=<? echo $tdate; ?> name=tdate> </td><td>Days </td><td><input type=submit value="New Run"> </td></tr></table></form> <?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>

<?php 
 $custknt = 0;
 $tdate = $_POST['tdate'];
 if ($_POST['tdate'] == '') $tdate = '3';
 $ndate = seadate($tdate);
//  echo $ndate; // debug line, shows the date we are seeking
 $conquery = tep_db_query("select * from ". TABLE_SCART ." where dateadded >= '".$ndate."'" );
 $knt = mysql_num_rows($conquery);
 for ($i = 0; $i < $knt; $i++) {
    $inrec = tep_db_fetch_array($conquery);
// echo $inrec['dateadded']."<br>"; '' debug line
    $cid = $inrec['customers_id'];
    $query1 = tep_db_query("select cus.customers_firstname as fname, cus.customers_lastname as lname from customers as cus where cus.customers_id ='".$cid."'");
    $crec = tep_db_fetch_array($query1);
    $cquery = tep_db_query("select * from orders where customers_id = '".$cid."'" );
    $iknt = mysql_num_rows($cquery);
    for ($j = 0; $j < $iknt; $j++) {
      $orec = tep_db_fetch_array($cquery);
// split the date_purchased on the space
      $orderdate = explode(' ',$orec['date_purchased']);
// take the [0] and remove the "-"'s
      $odate = str_replace('-','',$orderdate[0]);
// see if they have purchased since the message 
      if ($inrec['dateadded'] <= $odate) {
        $custknt++;
        $custlist .= $crec['lname'].", ".$crec['fname']."<br>";
      }
    }
 }
  $cline = " <tr><td><b>Examined Records: </b>".$knt."</td></tr> <tr><td><b>Sales: </b>".$custknt."</td></tr> ";
  echo $cline;
?>
     <tr>
       <td class="smallText">
      <tr class="dataTableHeadingRow"> 
       <td class="dataTableHeadingContent">Customer</td> 
      </tr>
<?
  $cline = " <tr><tr><td>".$custlist."</td></tr> </table></td></tr>";
  echo $cline;

?>
    </tr> 
   </table> 
  </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'); ?>

 

One thing possibly left to add, a piece that tells you the amount of the recaptured sale.

Link to comment
Share on other sites

I was hoping someone could help me. I had the original contribution installed and I am installing the newested version that is posted but I am having some problems.

 

Everything works ok but I have to get to the report via the url link. If I click on the link under the reports section I get a page not found error. I didn't have this problem before. Can anyone think of what I did wrong?

 

Thank you

 

Mike

Link to comment
Share on other sites

I was hoping someone could help me. I had the original contribution installed and I am installing the newested version that is posted but I am having some problems.

 

Everything works ok but I have to get to the report via the url link. If I click on the link under the reports section I get a page not found error. I didn't have this problem before. Can anyone think of what I did wrong?

 

Thank you

 

Mike

where is your URL taking you to get the error? probably because the original was renamed from acart.php to scart.php

Link to comment
Share on other sites

I guess I am missing something here. There is a contrib for unsold carts, I do not see scart of acart in the downloads -> contributions. Is it really just from the posts here that this currently exists, i.e. a contrib has not been made yet?

Steve

Link to comment
Share on other sites

I guess I am missing something here. There is a contrib for unsold carts, I do not see scart of acart in the downloads -> contributions. Is it really just from the posts here that this currently exists, i.e. a contrib has not been made yet?

A contrib was made from my initial code. Someone made it nice with a install and readme and directions to link it from reports.

 

All nice and good.

 

Then there was a series of comments and things that I wanted to do as well, and this begat the latest version (posted again within this thread).

 

This version has a few differences.

 

1) it is no longer "just a report", it is a sales tool.

2) it now requires changes in the database (a new table)

3) it now has a languages/english/ file

4) it now has (as of the posting above) it's own reporting tool so you can track how well it is recapturing sales.

 

as for the name... as I said before, these carts aren't truly "abandoned" as that happens with guests as well as people who go through signup. A better way to think of these are as a sub-set of abandoned carts, or "stranded" carts. Thus the name scart.php which stands for "stranded carts"

 

Now, as to how and where to install this. You have a couple of choices. First the files themselves.

 

scart.php (the code) goes into your admin area

scart.php (the language file) goes into your /includes/languages/english/

scart_report.php goes into your admin area

 

You will have to make three changes to admin/includes/application_top.php

You will have to run the SQL to add the new table.

 

You *may* want to link the code into the left hand navigation side of the admin pages. Wether you choose to add it to Reports or Tools is up to you. In order to add it, just cut and paste a current line from the section that you want to place it in and change the filename to scart.php to run the tool (or if you want to run the report scart_report.php).

 

Now, I'm sure someone else will re-explain all this in better style. :)

 

It's all rather simple really. You could consider this a separate contribution at this time since the first (the one that was wrapped up as a contribution for me by someone else) was a report only, and this one is a full sales tool (with it's own report).

 

Does that help?

Link to comment
Share on other sites

Hallo Met00,

 

your contribution could be very usefull for me. I have already installed the report from the downloadarea.

 

But the new functions you described above are very usefull !

 

Will you upload everything as contribution ? (if yes - when you think it's ready)

If not, you perhaps can send me everything per mail ?

Thanks Matthias

Link to comment
Share on other sites

i've copy and pasted all the code I could find. only i'm still looking for the sql statements.

 

if somebody can be so kind... thanks...

 

or is there maybe already a "beta"-contribution... thanks?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...