Jump to content
Met00

Recover Cart Sales

Recommended Posts

A quick question:

In the current version, clicking on a customer's name will open the customer list page, searching for his last name. How can this be altered so instead it goes into the specific customer's info page, based on the customer ID?

 

-Ethan

Share this post


Link to post
Share on other sites

Has anybody taken a shot at fixing some of the bugs in the recover cart report?

The tool part is working great - e-mails are sent out and I had a customer make a purchase the other day after receiving the email but the report isn't working. It looks like it's examining records but that recovered cart/sale is not appearing on the report... Any ideas on how to fix this?

Share this post


Link to post
Share on other sites

Can anybody tell me how I can format the beginning of the email that customer get from the Recovery Sales Module. I would like to address the customer by first and last name and not just first name like below in german text...

 

Many thanks

Steven

 

 

Text from email

 

 

 

Steven,

 

Vielen Dank f?r Ihren Besuch bei Discountlens.ch und Ihr uns entgegengebrachtes Vertrauen. Wir haben gesehen, da? Sie bei Ihrem Besuch in unserem Onlineshop den Warenkorb mit folgenden Artikeln gef?llt haben aber den Einkauf nicht vollst?ndig durchgef?hrt haben.

Share this post


Link to post
Share on other sites

Basic reply for urbach...

 

The code you need to change is line 259 of admin/recover_cart_sales.php...

 

$email = $inrec['fname'] . ",";

 

I'm afraid I don't know what string to use to call the surname, but this is what you need to change.

 

Personally, I have changed it to..,

 

$email = "Dear " . $inrec['fname'] . ",";

 

For a more traditional greeting (although I don'ty intend to email custoers about unpurchased carts, I just use it for incomplete transactions).


- osCommerce is fun! -

Share this post


Link to post
Share on other sites

Hi Folks,

 

I have just added the lost cart report contribution, followed each step etc, then logged in as top administrator but when I click the 'Recover Carts' link I get an access denied message:-

 

"Access Denied

 

No Right Permission Access

Please contact your Webmaster to request

more access or if you found any problem."

 

 

Do I need to change a permission somewhere? I really need this to recover a lost order, any help would be appreciated.

 

Thanks in advance,

Andy.

Share this post


Link to post
Share on other sites

Andy, if you have admin levels or similar installed, you need to go into Administrator/file access and use the store files thingumajig to add the recover_cart and recover_cart_stats (or whatever the names are) to your list of files allowed to access. Hope that makes sense.

 

 

My question is - I got the contrib all installed and working perfectly, and a bunch of non-sales popped up. I logged in today and they're not there any more. Can I not retrieve them?

Share this post


Link to post
Share on other sites

I've been editing all of the emails that OSC sends out to customers to have a uniform look, but have somehow mucked up the one that recover lost carts sends.

 

On my admin page, when I click 'send email', I get the following error message on the next page.

Warning: sprintf(): Too few arguments in /ocd/admin/recover_cart_sales.php on line 272

 

Here's my code from the /admin/recover_cart_sales.php file:

// E-mail Processing - Requires EMAIL_* defines in the
// includes/languages/english/recover_cart_sales.php file

 $cquery = tep_db_query("select * from orders where customers_id = '".$cid."'" );

 if ($IS_FRIENDLY_EMAIL_HEADER){
   $email = EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_HEADER . "\n" . EMAIL_SEPARATOR . "\n\n";
   
   $email .= $inrec['fname'] . "," . "\n\n";
 } else {
   $email .= STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . tep_catalog_href_link(FILENAME_CATALOG_LOGIN, '', 'SSL') . "\n";
 }

 if (mysql_num_rows($cquery) < 1) {
   $email .= sprintf(EMAIL_TEXT_NEWCUST_INTRO, $mline) . "\n\n";
 } else {
   $email .= sprintf(EMAIL_TEXT_CURCUST_INTRO, $mline) . "\n\n";
 }
   
   $email .= sprintf(EMAIL_TEXT_COMMON_BODY, $mline);

Line 272 is the last line shown in the code above.

 

I have all the equivalent defines in the /admin/includes/languages/english/recover_cart_sales.php file, triple checked for accuracy and they are all fine.

 

When I get the error on the admin page, it still sends out an email, but it only includes the new/current customer introduction. I'd just switch it to

$email .= EMAIL_TEXT_COMMON_BODY;

but then I don't think the items they didn't place in their cart will appear.

 

The original line in the code read:

$email .= sprintf(EMAIL_TEXT_COMMON_BODY, $mline) . "\n". $_POST['message'];

 

How can I get this working? Thanks.

Share this post


Link to post
Share on other sites

My guess would be that EMAIL_COMMON_TEXT_BODY isn't defined properly.

 

According to the function definition for sprintf(), the following is how it's supposed to be called:

string sprintf ( string format [, mixed args [, mixed ...]])

 

Since you're using the same format as the lines above the non-working line, my supposition would be that EMAIL_COMMON_TEXT_BODY is simply not defined properly. Do you have apostrophes in it, or other reserved characters? Change it to just say "test" and send yourself a test email. If that works, then go back and look for reserved characters.

 

<overly long extra response>

Here's what I do when I have problems like that:

1) search google for:

oscommerce sprintf()

2) find the link that that was returned for oscdox.com (I can't ever find this stuff by going to oscdox.com first, that's why I get it from Google)

3) find sprintf() in the page of returned functions

4) if it's defined more than once, make sure that you're referencing the right copy of sprintf in oscdox

5) look at the function definition, or any of the other files where it's called, and figure out what's supposed to be included with the function call.

 

In this case, since it's a core PHP function, we're not going to find the function definition at oscdox.com, so we search go to Google once again and search for:

zend definition sprintf()

Why Zend? Well, they call themselves "The PHP Company". I'll leave it at that.

 

You can see the function definition at http://www.zend.com/manual/function.sprintf.php, and start to figure out things from there.

</overly long response>

 

-jared

Share this post


Link to post
Share on other sites
My guess would be that EMAIL_COMMON_TEXT_BODY isn't defined properly. 

 

According to the function definition for sprintf(), the following is how it's supposed to be called:

  string sprintf ( string format [, mixed args [, mixed ...]])

 

Since you're using the same format as the lines above the non-working line, my supposition would be that EMAIL_COMMON_TEXT_BODY is simply not defined properly.  Do you have apostrophes in it, or other reserved characters?  Change it to just say "test" and send yourself a test email.  If that works, then go back and look for reserved characters.

 

-jared

 

Jared -

 

Argh! You nailed it - it was a % sign (I offer a coupon in the email, giving 10% off). Can I escape % signs the same as apostrophes?

 

Jacob

Share this post


Link to post
Share on other sites

When I try to remove a cart with the Recover Cart "Reset" button, I receive the following error:

 

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 '' at line 1

 

delete from customers_basket where customers_id=

 

[TEP STOP]

 

It appears that this line in the recover_cart_sales.php is not working properly:

 

$reset_query_raw = "delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id=$HTTP_GET_VARS[customer_id]";

 

Would someone please tell me how to fix this?

 

Thanks,

 

Donna Gordon

UKGoods

Share this post


Link to post
Share on other sites

Hi

 

first) do you use search engine safe urls?

 

and 2) do you have a website?

 

Is it neither working locally nor online?

 

The prob is that the customer_id is not found...

 

regards

Kai

Share this post


Link to post
Share on other sites

I am right in thinking that Recover Cart Sales Contrib will 'catch' carts that a customer abandons mid way i.e. before going to 3rd party payment website?

 

Will it 'catch' orders that are lost when a customer fails to complete the payment website properly.i.e not returning to confirmation page.

 

I have this contrib installed and it works great.

 

If it doesnt 'catch' any orders lost whilst away at 3rd party payment site is there a reliable contrib that will work with Recover Sales?

 

I have tried held orders & order check but seem to get major errors.

 

I am using MS2.2

 

Many thanks

 

Ian

Share this post


Link to post
Share on other sites
I love this tool!! Very handy. However, I am having one odd problem with the "report" part of the tool: It lists all the abandoned carts as coming from the SAME customer! Digging into the code a bit to see what might be causing this, but I wanted to post in case others have had this same issue.

 

thanks,

 

-beb

yeah, yeah, yeah, I know, I'm working it.... The report portion of the tool needs some work and I want to make it more useful. As it is, it's about 1/3 of what I want. Look for a new release of the "report" portion in the end of January (I hope).

 

Has any progress been made on this? The 1.4c download still has the report listing (nearly) all recovered carts as coming from the same customer. (and when it's not all from the same customer, there are usually two or three dups of the non-same ina row). Not sure if it means anything, but the "same" customer (ie, the one 95% of the entries list as the customer) is the first customer in the customer DB.

 

Also, has any progress been made on the delete customer feature you talked about in later posts?

 

Thanks!

 

PS: This does contrib does work, I have apx. a 30% recover rate according to the report.

Share this post


Link to post
Share on other sites

After posting the above messagae, I got to thinking about that 30% recovery rate (really, way to high) and looking into the data. What I discovered was that if a person abandoned a cart, the report would find ALL orders after that abandoned cart and include them as "recoveries" for the cart. So, if you had repeat customers you ended up with a false recovery rate (since, at best, only one order is a recovery). This was esp. true of my test orders (I'm the first customer in the DB and since I had a few abandoned carts and many "good" test orders, the 'recovery' list was like 50 for the first abandonded cart, 40 for the next and so on... even though there were only 5 abandoned carts!)

 

Anyway, I started looking into it and ended up pretty much re-writing the report completely. It now only counts the first order after an abandoned cart as recovered. I also wanted some more info, so Included the scart id, the date the scart was created, the date of the recovered order (to help find dups), the amount of the order and the recovered order status. I also showed the % of carts recovered and the total dollar amount recovered.

 

I also "improved" (?) the admin tool for better column alignments and made the "delete" button say delete instead of "reset" (I've seen that it's not good to delete the carts, so figured it would make accidental use of the button easier to avoid if it was named correcty).

 

I am not a great OSC coder! If you find problems, or there are better ways of doing something, please let me know! For instance, it seems there has got to be a better way of getting the customer/order info...

 

NOTE: the report can still be misleading. For instance a customer tries to order 5 times and fails (leaving abandoned carts). A week later the customer figures out the problem (bad address on a credit card, etc) and places an order. Now, ALL five "abandoned" carts will find that one subsequent order and count it. If anyone figures a way to avoid this, I'd be happy to hear it!

 

 

I've added my changes as v1.4d, available in the contribution download area for this mod. The download contains all required files (php, sql, readme w/install instructions).

Edited by lane

Share this post


Link to post
Share on other sites

I updated to v1.4d and noticed 2 problems...

 

1) The HTML coding in stats_recover_cart_sales.php is all messed up - So I fixed it. You may download the updated stats_recover_cart_sales.php file from HERE.

 

2) The other problem is the grand total of the recovered carts at the bottom. It is not rounding so $13.44 is being displayed as $13.4354

 

Is there a fix for #2 above?


L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Share this post


Link to post
Share on other sites

I installed 1.4d and noticed a couple of things. The biggest problem is that the recover cart sales report does not display the correct order status. The other issue is fairly trivial (the font doesn't match the rest of the pages). Any suggestions as to what might cause the status to be incorrect? I've got items that are in transit showing as being on backorder.

Share this post


Link to post
Share on other sites
I updated to v1.4d and noticed 2 problems...

 

1) The HTML coding in stats_recover_cart_sales.php is all messed up - So I fixed it. You may download the updated stats_recover_cart_sales.php file from HERE.

 

2) The other problem is the grand total of the recovered carts at the bottom. It is not rounding so $13.44 is being displayed as $13.4354

 

Is there a fix for #2 above?

I'm not sure why, but the original version works for me and your revised version doesn't.

Share this post


Link to post
Share on other sites
I installed 1.4d and noticed a couple of things.  The biggest problem is that the recover cart sales report does not display the correct order status.  The other issue is fairly trivial (the font doesn't match the rest of the pages).  Any suggestions as to what might cause the status to be incorrect?  I've got items that are in transit showing as being on backorder.

Well, here is where my not being knowledgable about OSC takes it's toll. What I did was use the SQL code from the "orders.php" file in the admin area, so it should display the same status as that page. If it doesn't, I'm not sure why. The code is:

$orders_query_raw = "select o.orders_id, o.customers_id, o.date_purchased, s.orders_status_name, ot.text as order_total, ot.value from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$cid . "' and o.date_purchased >= '" . $inrec['dateadded'] . "' and ot.class = 'ot_total'";

 

Maybe someone else can point out the error?

Share this post


Link to post
Share on other sites
I updated to v1.4d and noticed 2 problems...

 

1) The HTML coding in stats_recover_cart_sales.php is all messed up - So I fixed it. You may download the updated stats_recover_cart_sales.php file from HERE.

Your update seems to work for me, but so does mine. Can you tell me how my original is messed up, and in what browser under what OS? We should figure out why you have a problem with mine and baddog has a problem with yours so we can create one that works for everyone :)

 

I also am curious about the additions for "includes/menu.js" and "dhtml_menu"; what do those do?

 

Finally, one change I noticed is you reverted the top values to after the heading; I had reversed them because I found it easier to read when the #s were above each other (ie, I could relate the #s easier in that arrangement). Is there a prefered arrangment?

2) The other problem is the grand total of the recovered carts at the bottom. It is not rounding so $13.44 is being displayed as $13.4354

 

Is there a fix for #2 above?

This one is easy, I just didn't figure that money was ever over 2 decimal digits so I didn't put the round in. Here is the fix:

<?php echo $total_recovered ?>

becomes

<?php echo tep_round($total_recovered, 2) ?>

Share this post


Link to post
Share on other sites

I just put up the 1.4e release; this incorporates changes as follows:

 

-Improved layout of output table (resizes better, nice breaks, etc.)

-Fixed divide by zero when no recovered sales are found

-Changes to make work with all top browsers under Mac OS X and Windows

-Incorporated PopTheTop's changes to report

-Total $ recovered rounded to nearest "penny" (2 decimal places)

-Fix incorrect setting of date range to use (from 1.4c and earlier code I missed in 1.4d)

-Display correct order status (oops .... missed a check in the sql query)

 

Thanks to Dave "baddog" and PopTheTop for helping debug this version!

 

The fix to display the correct order status led me to find a new "issue" that I don't know how to fix:

 

"Recovered" sales can be incomplete, ie: PayPal Processing, Processing, etc. We're now beyond my technical (ok, really time) abilities to fix this... assuming it even needs to be fixed. (I would think so, as you really only want fully paid for and delivered sales to count as "recovered", right?) Anyway, hopefully someone else can take it from here :)

 

And, of course, there is still the issue where a customer tries to order 5 times and fails (leaving 5 abandoned carts). Later, after a RCS email is sent to her, the customer figures out the problem and places a good order. Now, ALL five "abandoned" carts will find that one subsequent order and count it.

Edited by lane

Share this post


Link to post
Share on other sites

Another improvement I thought of would be to have the tool part do similar lookups; if an abandonded cart can be matched (via customer as currently, or even via customer and product(s) maybe?) to a later (completed) order, then it could be marked in yellow. Then, you could have a "check all" button to check all blue (ie, no email sent yet, no matching order found) abandonded carts.

 

I currently manually search for an order by each name before selecting to send an email, this would really help.

Share this post


Link to post
Share on other sites
Your update seems to work for me, but so does mine. Can you tell me how my original is messed up, and in what browser under what OS? We should figure out why you have a problem with mine and baddog has a problem with yours so we can create one that works for everyone :)

 

Well, all I can say is to use a program like WinGrep to compare the 2 and see the changes I did. There were a lot and I can not remember them all. I do remember that a lot of the <TD>'s were incorrect and with wrong or missing colspan=xx stuff.

 

I also added a black line at the bottom of the list to break apart the totals at the bottom from the list using a HR tag.

 

 

I also am curious about the additions for "includes/menu.js" and "dhtml_menu"; what do those do?

 

I have the Admin DHTML Menus contribution installed and the menu.js is to load that. I just forgot to remove it before posting the file, sorry. Here is a picture of the Admin DHTML Menus contribution in action inside my Admin...

 

screenshot.jpg

 

 

Finally, one change I noticed is you reverted the top values to after the heading; I had reversed them because I found it easier to read when the #s were above each other (ie, I could relate the #s easier in that arrangement). Is there a preferred arrangement?

 

I do not know what you mean by "reverted the top values to after the heading"? Do you mean the heading of and values at the top being listed like this...

 

Recover Cart Sales Report

 

Notified Abandoned Carts: XX

Sales From Notifications: XX

 

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

 

I have not updated to version 1.4e yet, but I did notice that the second order is showing Pending. I updated the order status to Shipped and it is still showing Pending (see image above).

 

ALSO...

 

I send out an e-mail to that customer. Then I send a second e-mail to that same customer. When that customer submitted their order, it showed in the report that 2 orders were recovered and it was actually only 1 (also see image above). Hmmm Now that does not seem right. We need to fix that too.


L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Share this post


Link to post
Share on other sites
I have not updated to version 1.4e yet, but I did notice that the second order is showing Pending. I updated the order status to Shipped and it is still showing Pending (see image above).
This is fixed in 1.4e, still learning SQL syntax :)

 

I send out an e-mail to that customer. Then I send a second e-mail to that same customer. When that customer submitted their order, it showed in the report that 2 orders were recovered and it was actually only 1 (also see image above). Hmmm Now that does not seem right. We need to fix that too.

This is what I was referring to by

And, of course, there is still the issue where a customer tries to order 5 times and fails (leaving 5 abandoned carts). Later, after a RCS email is sent to her, the customer figures out the problem and places a good order. Now, ALL five "abandoned" carts will find that one subsequent order and count it.
I do not know how to fix this; seems like we would need to find a way to either match scarts to orders (very hard) or mark an order as "recovered" somehow so it's not chosen twice. Maybe the "mark" would tie it to an scart?

 

If only I had more time, these are fun challenges.

 

PS: I started 1.4e from your modified code (thanks!) so all of your DHTML changes are in the 1.4e release, as they didn't cause any harm even w/o the contribution installed and if someone has it "it'll just work".

Share this post


Link to post
Share on other sites

Hi Lane,

 

I have just seen this update (I have installed v1.4c). Is it just the 'files to upload' that have changed or the code changes to the other files?


'Don't go to the Dark Side! Although ignorance and prejudice are as rampant in web design as in any other human endeavour, web standards are here to stay' - Jeffrey Zeldman - Designing With Web Standards

 

Knowledge Base | Contributions | Tips & Tricks Forum

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×