Zen Cart Logo
Forums / All Other Contributions/Addons / Recover Cart [Support Thread]

Recover Cart [Support Thread]

Views: 219,166

Results 301 to 320 of 662
19 Jul 2010, 6:53 PM
#301
tmdelia avatar

tmdelia

New Zenner

Join Date:
May 2005
Posts:
69
Plugin Contributions:
0

Recover Cart [Support Thread]

Does anyone have a working CRON script for this? I had one, but it just quit working. And I can't for the life of me remember where it came from.

Here's my Cron:

cd "/home/fakedir/public_html/fakeadmin/" php -f ./rcs_cron.php -- rcs_cron=1

Using fakedir and fakeadmin to be safe, but I assure you, the paths are correct.

Here is the script I have in the admin folder:

<?php

/** RECOVER CART SALES -- AUTOMATED SCRIPT FOR CRON PROCESSING
 *
 * Proper use:
 * -----------
 *   php -f ./rcs_cron.php -- rcs-cron=1 [tdate=x]
 *
 * where [tdate=x] is an optional parameter, with x being the number of days (history) you wish to process for.
 *
 * NOTE: it's expected that you will run this script from inside the admin folder.  
 *       (ie: chdir to admin folder, then run this script)
 */

// process command-line vars into GET vars:
if ($argc > 0) {
  for ($i=1; $i<$argc; $i++) {
    $it = split("=", $argv[$i]);
    $_GET[$it[0]] = $it[1];
  }
}
// Check whether has been started with required parameters:
if (!isset($_GET['rcs_cron'])) {
  echo "\n Recover Cart Sales (RCS) \n Automated processing script\n ===========================\n Proper use:\n -----------\n   php -f ./rcs_cron.php -- rcs-cron=1 [tdate=x]\n\n where [tdate=x] is an optional parameter, with x being the number of days (history) you wish to process for.\n NOTE: it's expected that you will run this script from inside the admin folder.\n\n\n";
  exit();
}

// set some prerequisites:
define('RCS_CRON_USERID', 100);
$tdate = (isset($_GET['tdate'])) ? $_GET['tdate'] : '';

// load the Zen Cart core:
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . FILENAME_MAIL . '.php');
require(DIR_WS_LANGUAGES . $_SESSION['language'] . '/recover_cart_sales.php');
require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();

// begin RCS processing:
echo 'RCS processing for date range: past ' .  ($tdate != '' ? $tdate : RCS_BASE_DAYS) . ' days.' . "\n";
doUnattendedRCS($tdate);
echo 'Finished.' . "\n\n";

I also found this bit of code in my fakeadmin/includes/init_includes/overrides/init_admin_auth.php and don't know if it is what is causing the prob:

  if (!isset($_SESSION['admin_id']) && $_GET['rcs_cron'] == 1 && defined('RCS_CRON_USERID')) {

    $_SESSION['admin_id'] = RCS_CRON_USERID;

    $bypass_additional_auth = true;

  }
24 Jul 2010, 12:40 PM
#302
econcepts avatar

econcepts

Totally Zenned

Join Date:
Dec 2005
Posts:
1,505
Plugin Contributions:
2

Re: Recover Cart [Support Thread]

@tmdelia,

A few questions.

  1. Do you know when it stopped working?
  2. Where any upgrades etc... added that may have made it stop?
  3. Did anything on your server change (php verison, etc...)?

Typically code doesn't just stop working when it was previously unless something else changed outside the code to make it stop.

Let me know that and I'll see if I can find out why it quit on you.

24 Jul 2010, 12:45 PM
#303
econcepts avatar

econcepts

Totally Zenned

Join Date:
Dec 2005
Posts:
1,505
Plugin Contributions:
2

Re: Recover Cart [Support Thread]

Another thing to consider. It looks like the actual processing part of the script refers to a function. That function is not defined in the script. Is there a "extra functions" file hanging out there somewhere as well that this refers to?

Can you set your mail server up to send you a log of the CRON job when it runs? This should provide you with an error message if there are problems anywhere.

26 Jul 2010, 5:08 PM
#304
tmdelia avatar

tmdelia

New Zenner

Join Date:
May 2005
Posts:
69
Plugin Contributions:
0

Re: Recover Cart [Support Thread]

econcepts,

Thanks so much for replying. Your post led me to track down the missing admin/includes/functions/extra_functions file. I'm posting it here for other users interested in the rcs_cron functionality. I had to comment out lines 38-50 and 52-57 because the functions zen_cart_date_short and zen_GetCustomerOnline because they are already defined in admin/includes/functions/extra_functions/functions_recover_cart_sales.php. Working perfectly now! Thanks for your help.

Here's the functions_recover_cart_sales.php code:

<?php
/**
 * stems from:
 * @version $ Id: recover_cart_sales.php 2.12 17.09.2006 22:25 Andrew Berezin $
 */

function rcs_delete_entry($custID) {
// Delete Entry Begin
  if ($_GET['action'] == 'delete') {
	$customer = $db->Execute("SELECT customers_firstname, customers_lastname
														FROM " . TABLE_CUSTOMERS . "
														WHERE customers_id ='" . (int)$custID. "' LIMIT 1");
	$db->Execute("DELETE FROM " . TABLE_CUSTOMERS_BASKET . " WHERE customers_id='" . (int)$custID . "'");
	$db->Execute("DELETE FROM " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " WHERE customers_id='" . (int)$custID . "'");
	$messageStack->add(MESSAGE_STACK_CART_CUSTOMER . $customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname'] . ' (ID ' . $custID . ')' . MESSAGE_STACK_DELETE_SUCCESS, 'success');
  }
// Delete Entry End
}

// Set Contacted Begin
function rcs_set_contacted($custID, $displayMsgs = TRUE) {
  if (!is_array($custID)) $custID = array($custID);
  foreach($custID as $customer) {
	$customer = $db->Execute("SELECT customers_firstname, customers_lastname
														FROM " . TABLE_CUSTOMERS . "
														WHERE customers_id ='" . (int)$customer . "' LIMIT 1");
	// See if a record for this customer already exists; if not create one and if so update it
	$donequery = $db->Execute("SELECT * FROM ". TABLE_SCART ." WHERE customers_id = '" . (int)$customer . "'");
	if ($donequery->RecordCount() == 0)
		$db->Execute("INSERT INTO " . TABLE_SCART . " (customers_id, dateadded, datemodified) VALUES ('" . (int)$customer . "', '" . date('Ymd') . "', '" . date('Ymd') . "')");
	else
		$db->Execute("UPDATE " . TABLE_SCART . " SET datemodified = '" . date('Ymd') . "' WHERE customers_id = " . (int)$customer);
	if ($displayMsgs) $messageStack->add(MESSAGE_STACK_CUSTOMER . $customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname'] . ' (ID ' . $customer . ')' . MESSAGE_STACK_SETCONACTED, 'success');
  }
}
// Set Contacted End

//This function already in admin/includes/functions/extra_functions/functions_recover_cart_sales.php
// function zen_cart_date_short($raw_date) {
//	if ($raw_date <= 0)
//		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)));
//	}
//}

//This function already in admin/includes/functions/extra_functions/functions_recover_cart_sales.php
// This will return a list of active customers
//function zen_GetCustomerOnline() {
//	global $db;
//  $members = array();
// Set expiration time, default is 1200 secs (20 mins)
  $xx_mins_ago = (time() - 1200);
  $whos_online_query = $db->Execute("SELECT customer_id
                                     FROM " . TABLE_WHOS_ONLINE . "
                                     WHERE time_last_click > '" . $xx_mins_ago . "'");
  while (!$whos_online_query->EOF) {
    if ($whos_online_query->fields['customer_id'] != 0) {
    	$members[] = $whos_online_query->fields['customer_id'];
    }
    $whos_online_query->MoveNext();
  }
  return $members;
//
function rcs_send_recover_cart_emails($emails_array, $tdate, $messageHTML = '', $messageTEXT = '', $subject = '', $from = '') {
  global $db, $currencies;
    $file = DIR_FS_SQL_CACHE . '/' . 'RecoverCartSales-' . date('Ymd-His') . '-log.html';

    $fp = @fopen($file, 'a');
    @fwrite($fp, '<table><tr><td>Recover Cart Sales - LOG</td></tr><tr><td>' . date('M-d-Y h:i:s') . '</td></tr></table><hr>');
    @fwrite($fp, '<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td class="pageHeading" align="left" colspan=6>'. HEADING_EMAIL_SENT.'</td>
  </tr>
  <tr class="dataTableHeadingRow">
    <td class="dataTableHeadingContent" align="left" colspan="1" width="15%">'.TABLE_HEADING_CUSTOMER.'</td>
    <td class="dataTableHeadingContent" align="left" colspan="1" width="30%"> </td>
    <td class="dataTableHeadingContent" align="left" colspan="1" width="25%"> </td>
    <td class="dataTableHeadingContent" align="left" colspan="1" width="10%"> </td>
    <td class="dataTableHeadingContent" align="left" colspan="1" width="10%"> </td>
    <td class="dataTableHeadingContent" align="left" colspan="1" width="10%"> </td>
  </tr>
  <tr class="dataTableHeadingRow">
    <td class="dataTableHeadingContent" align="left"   colspan="1"  width="15%">'. TABLE_HEADING_MODEL.'</td>
    <td class="dataTableHeadingContent" align="left"   colspan="2"  width="55%">'. TABLE_HEADING_DESCRIPTION.'</td>
    <td class="dataTableHeadingContent" align="center" colspan="1"  width="10%"> '. TABLE_HEADING_QUANTY.'</td>
    <td class="dataTableHeadingContent" align="right"  colspan="1"  width="10%">'. TABLE_HEADING_PRICE.'</td>
    <td class="dataTableHeadingContent" align="right"  colspan="1"  width="10%">'. TABLE_HEADING_TOTAL.'</td>
  </tr>');
    @fclose($fp);


	$messageHTML = ($messageHTML == '') ? zen_db_prepare_input($_POST['message_html']) : $messageHTML;
	$messageTEXT = ($messageTEXT == '') ? zen_db_prepare_input($_POST['message']) : $messageTEXT;
	$from = ($from == '') ? zen_db_prepare_input($_POST['from']) : $from; // STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS
	$subject = ($subject == '') ? zen_db_prepare_input($_POST['subject']) : $subject; // EMAIL_TEXT_SUBJECT

	foreach ($emails_array as $cid) {
		$mline = '';
		$cline = '';
		$lastcid = 0;
		$tprice = 0;

		$basket = $db->Execute("SELECT    cb.products_id,
																			cb.customers_basket_quantity,
																			cb.customers_basket_date_added,
																			cus.customers_firstname fname,
																			cus.customers_lastname lname,
																			cus.customers_email_address email
														FROM      " . TABLE_CUSTOMERS_BASKET . " cb,
																			" . TABLE_CUSTOMERS . " cus
														WHERE     cb.customers_id = cus.customers_id AND
																			cus.customers_id ='" . $cid . "'
														ORDER BY  cb.customers_basket_date_added DESC ");
		while (!$basket->EOF) {

		// set new cline and curcus
			if ($lastcid != $cid) {
				if ($lastcid != "") {
					$cline .= "
					<tr>
						<td class='dataTableContent' align='right' colspan='6'><b>" . TABLE_CART_TOTAL . "</b>" . $currencies->format($tprice) . "</td>
					</tr>
					<tr>
						<td colspan='6' align='right'><a href=" . zen_href_link(FILENAME_RECOVER_CART_SALES, "action=delete&customer_id=" . $cid . "&tdate=" . $tdate) . ">" . zen_image_button('button_delete.gif', IMAGE_DELETE) . "</a></td>
					</tr>\n";
					echo $cline;
				}
				$cline .= "<tr> <td class='dataTableContent' align='left' colspan='6'><a href='" . zen_href_link(FILENAME_CUSTOMERS, 'search=' . $basket->fields['lname']) . "'>" . $basket->fields['fname'] . " " . $basket->fields['lname'] . "</a>".$customer."</td></tr>";
				$tprice = 0;
			}
			$lastcid = $cid;

			$products = $db->Execute("SELECT p.products_model model,
																				pd.products_name name
																FROM " . TABLE_PRODUCTS . " p,
																		 " . TABLE_PRODUCTS_DESCRIPTION . " pd
																WHERE p.products_id = '" . $basket->fields['products_id'] . "'
																  AND pd.products_id = p.products_id
																  AND pd.language_id = " . (int)$_SESSION['languages_id']);

			$sprice = zen_get_products_actual_price($basket->fields['products_id']);

			$tprice += $basket->fields['customers_basket_quantity'] * $sprice;

			$cline .= "<tr class='dataTableRow'>
									 <td class='dataTableContent' align='left' width='15%'>" . $products->fields['model'] . "</td>
											<td class='dataTableContent' align='left' colspan='2' width='55%'><a href='" . zen_href_link(FILENAME_CATEGORIES, 'action=new_product_preview&read=only&pID=' . $basket->fields['products_id'] . '&origin=' . FILENAME_RECOVER_CART_SALES . '?page=' . $_GET['page']) . "'>" . $products->fields['name'] . "</a></td>
											<td class='dataTableContent' align='center' width='10%'>" . $basket->fields['customers_basket_quantity'] . "</td>
											<td class='dataTableContent' align='right' width='10%'>" . $currencies->format($sprice) . "</td>
											<td class='dataTableContent' align='right' width='10%'>" . $currencies->format($basket->fields['customers_basket_quantity'] * $sprice) . "</td>
									 </tr>";

			$mline .= $basket->fields['customers_basket_quantity'] . ' x ' . $products->fields['name'] . "\n";
			$mline .= '   <blockquote><a href="' . zen_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id='. $basket->fields['products_id']) . '">' . zen_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id='. $basket->fields['products_id']) . "</a></blockquote>\n\n";
			$basket->MoveNext();
		}

		$cline .= "</td></tr>";

		// E-mail Processing - Requires EMAIL_* defines in the
		// includes/languages/english/recover_cart_sales.php file
		$email = '';

		if (RCS_EMAIL_FRIENDLY == 'true'){
			$email .= EMAIL_TEXT_SALUTATION . $basket->fields['fname'] . ' ' . $basket->fields['lname'] . ",";
		} else {
			$email .= STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n";
		}

		$cquery = $db->Execute("SELECT * FROM " . TABLE_ORDERS . " WHERE customers_id = '" . $cid . "'" );
		if ($cquery->RecordCount() < 1) {
			$email .= sprintf(EMAIL_TEXT_NEWCUST_INTRO, $mline);
		} else {
			$email .= sprintf(EMAIL_TEXT_CURCUST_INTRO, $mline);
		}

		$email .= EMAIL_TEXT_BODY_HEADER . $mline . EMAIL_TEXT_BODY_FOOTER;

		if( EMAIL_USE_HTML == 'true' )
			$email .= '<a href="' . zen_catalog_href_link(FILENAME_DEFAULT) . '">' . STORE_OWNER . "\n" . zen_catalog_href_link(FILENAME_DEFAULT)  . '</a>';
		else
			$email .= STORE_OWNER . "\n" . zen_catalog_href_link(FILENAME_DEFAULT);

		$email .= "\n\n";

		$email .= "\n" . EMAIL_SEPARATOR . "\n\n";
		$email .= EMAIL_TEXT_LOGIN;

		if( EMAIL_USE_HTML == 'true' )
			$email .= '  <a href="' . zen_catalog_href_link(FILENAME_LOGIN, '', 'SSL') . '">' . zen_catalog_href_link(FILENAME_LOGIN, '', 'SSL') . '</a>';
		else
			$email .= '  (' . zen_catalog_href_link(FILENAME_LOGIN, '', 'SSL') . ')';

		$custname = $basket->fields['fname']." ".$basket->fields['lname'];
		$outEmailAddr = '"' . $custname . '" <' . $basket->fields['email'] . '>';
		if( zen_not_null(RCS_EMAIL_COPIES_TO) )
			$outEmailAddr .= ', ' . RCS_EMAIL_COPIES_TO;
$html_msg['EMAIL_MESSAGE_HTML'] = $email;

		$email = strip_tags($email . "\n\n" . zen_db_prepare_input($messageTEXT));
		zen_mail('', $outEmailAddr, $subject, $email, '', $from, $html_msg);


// LOGGING INSTEAD OF EMAIL
$fp = @fopen(DIR_FS_SQL_CACHE . '/RCSmessages-'.time().'.txt', 'a');
@fwrite($fp, date("Y-m-d h:m:s") . ' - RCS Message to: ' . $outEmailAddr . "\n\tSubject: " . $subject . "\n\tFrom: " . $from . "\n\t Message: " . $email . "\n\n");
@fclose($fp);



		$mline = "";

		// See if a record for this customer already exists; if not create one and if so update it
		$donequery = $db->Execute("SELECT * FROM ". TABLE_SCART ." WHERE customers_id = '" . $cid . "'");
		if ($donequery->RecordCount() == 0)
			$db->Execute("INSERT INTO " . TABLE_SCART . " (customers_id, dateadded, datemodified) VALUES ('" . $cid . "', '" . date('Ymd') . "', '" . date('Ymd') . "')");
		else
			$db->Execute("UPDATE " . TABLE_SCART . " SET datemodified = '" . date('Ymd') . "' WHERE customers_id = " . $cid );


        $fp = @fopen($file, 'a');
        @fwrite($fp, $cline . "\n\n");
        @fclose($fp);

	//	echo $cline;
	//	$cline = "";
	}
    $fp = @fopen($file, 'a');
    @fwrite($fp, '          <tr><td colspan=8 align="right" class="dataTableContent"><b>' .  TABLE_CART_TOTAL  . $currencies->format($tprice) . '</td> </tr>
          <tr><td colspan=6 align="right"><a href="'. zen_href_link(FILENAME_RECOVER_CART_SALES, "action=delete&customer_id=" . $cid . "&tdate=" . $tdate).'">'. zen_image_button('button_delete.gif', IMAGE_DELETE).'</a></td></tr>
          <tr><td colspan=6 align=center><a href="'. zen_href_link(FILENAME_RECOVER_CART_SALES).'">'. TEXT_RETURN.'</a></td></tr>
        </table>');
    @fwrite($fp, '<div>Finished: '. date('Y-m-d h:m:s') . '</div>');
    @fclose($fp);

  return $cline;
}


function doUnattendedRCS($tdate = '') {
  global $db;
  $tdate = ($tdate == '') ? RCS_BASE_DAYS : $tdate;
  $custArray = array();
	$cust_ses_ids = zen_GetCustomerOnline();
	$basket = $db->Execute("SELECT cb.customers_id,
																 cb.products_id,
																 cb.customers_basket_quantity,
																 cb.customers_basket_date_added,
																 cus.customers_firstname,
																 cus.customers_lastname,
																 cus.customers_telephone,
																 cus.customers_email_address,
																 sc.datemodified
													FROM " . TABLE_CUSTOMERS_BASKET . " cb
														LEFT JOIN " . TABLE_CUSTOMERS . " cus ON (cb.customers_id = cus.customers_id)
														LEFT JOIN " . TABLE_SCART . " sc ON (cb.customers_id = sc.customers_id)
													WHERE cb.customers_basket_date_added >= '" . date('Ymd', time()-$tdate*24*60*60) . "'
														AND cb.customers_id NOT IN ('" . implode(", ", $cust_ses_ids) . "')
													ORDER BY cb.customers_id ASC, cb.customers_basket_date_added DESC");
	$curcus = 0;
	$skip = false;

	while (!$basket->EOF) {

	// If this is a new customer, create the appropriate HTML
		if ($curcus != $basket->fields['customers_id']) {

			$curcus = $basket->fields['customers_id'];

			$checked = 1; // assume we'll send an email
			$skip = false;
			$sentdate = "";
			$customer = $basket->fields['customers_firstname'] . " " . $basket->fields['customers_lastname'];
			if ((time()-(RCS_EMAIL_TTL*24*60*60)) <= strtotime($basket->fields['datemodified'])) {
				$sentdate = $basket->fields['datemodified'];
				$checked = 0;
			}
			// See if the customer has purchased from us before
			// Customers are identified by either their customer ID or name or email address
			// If the customer has an order with items that match the current order, assume
			// order completed, bail on this entry!
			$orec = $db->Execute('SELECT orders_id, orders_status
														FROM ' . TABLE_ORDERS . '
														WHERE (customers_id = ' . (int)$curcus . '
																		OR customers_email_address like "' . $basket->fields['customers_email_address'] .'"
																		OR customers_name like "' . $basket->fields['customers_firstname'] . ' ' . $basket->fields['customers_lastname'] . '")
															AND date_purchased >= "' . $basket->fields['customers_basket_date_added'] . '"' );
			if ($orec->RecordCount() > 0) {
				// We have a matching order; assume current customer but not for this order
				// Now, look to see if one of the orders matches this current order's items
				while(!$orec->EOF) {
					$ccquery = $db->Execute('SELECT products_id
					                         FROM ' . TABLE_ORDERS_PRODUCTS . '
					                         WHERE orders_id = ' . (int)$orec->fields['orders_id'] . '
					                           AND products_id = ' . (int)(int)$basket->fields['products_id'] );
					if( $ccquery->RecordCount() > 0 ) {
						if( $orec->fields['orders_status'] > RCS_PENDING_SALE_STATUS )
							$checked = 0;
						// OK, we have a matching order; see if we should just skip this or show the status
						if( RCS_SKIP_MATCHED_CARTS == 'true' && !$checked ) {
							$skip = true; // reset flag & break us out of the while loop!
							break;
						}
					}
					$orec->MoveNext();
				}
				if( $skip )
					continue; // got a matched cart, skip to next one
			}
			// flag this customer to be auto-processed
      if ($checked) $custArray[] = $curcus;
		}

		$basket->MoveNext();
	}
  if (sizeof($custArray) > 0) {
    echo 'Preparing to send emails to ' . sizeof($custArray) . ' recipients ...' . "\n";
    rcs_send_recover_cart_emails($custArray, RCS_BASE_DAYS, ' ', ' ', EMAIL_TEXT_SUBJECT, STORE_OWNER_EMAIL_ADDRESS);
    // rcs_set_contacted($custArray, FALSE);
  } else {
    echo 'No recipients to process.' . "\n";
  }

}

define('RCS_TEXT_MESSAGE_SAMPLE', 'Please pardon the interruption.  We noticed that you began a shopping session at our store, but did not complete your checkout.  If you encountered a technical problem, please telephone us at the number below so we can help you finish your purchase or answer any questions you may have about our products. ' . "\n\n" . 'If you abandoned your shopping cart in favor of better prices elsewhere, please let us know so we can have an opportunity to match or better those prices.' . "\n\n" . 'If you left your shopping cart for a more opportune time, we invite you to come back and complete your shopping session. We understand that sometimes it\'s not convenient to complete a purchase because of distractions or not having payment details handy.  If that\'s the case for you, please consider this just a friendly reminder that  your shopping cart is still sitting here waiting for you. ' . "\n\n" . 'Once again, please pardon us for sending you this email. We simply want to make sure your shopping experience with us is as efficient as possible.  We will not be bothering you about this particular shopping session again.' . "\n\n" . 'Have a great day!');
27 Jul 2010, 12:29 PM
#305
econcepts avatar

econcepts

Totally Zenned

Join Date:
Dec 2005
Posts:
1,505
Plugin Contributions:
2

Re: Recover Cart [Support Thread]

tmdelia,

So are those the only files (2 total) that are used? I noticed the addition to the admin auth file for bypassing the authentication but was curious as to where that was placed in the file?

This is an interesting mod that I have been looking at using for sometime but wanted to make sure I have all the components in place.

4 Aug 2010, 5:50 PM
#306
danilyn22 avatar

danilyn22

Zen Follower

Join Date:
Dec 2008
Location:
California
Posts:
102
Plugin Contributions:
0

Re: Recover Cart [Support Thread]

Hello

First let me say I love this mod. Thank you for it.

I have a store built with 1.3.9d. I installed Recover Cart and it did not work. So I found the Upgrade Sql. I have tried running it from the Admin Install Sql Patches both using the upload and then just pasting the Sql Statement into the box. Both times I received this error

"1062 Duplicate entry 'RCS_CHECK_REPEAT' for key 'unq_config_key_zen'
in:
[INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (NULL, 'Ignore Repeat Customers', 'RCS_CHECK_REPEAT', 'false', 'Setting this to true will cause recover cart sales to ignore abandoned carts by repeat customers', @configuration_group_id, 45, NULL, NOW(), NULL, 'zen_cfg_select_option(array('true', 'false'),');]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields."

I dont know anything about SQL. Can someone point me in the correct direction to fix this issue.

Thanks in advance

5 Aug 2010, 2:29 PM
#307
econcepts avatar

econcepts

Totally Zenned

Join Date:
Dec 2005
Posts:
1,505
Plugin Contributions:
2

Re: Recover Cart [Support Thread]

danilyn22:

Hello

First let me say I love this mod. Thank you for it.

I have a store built with 1.3.9d. I installed Recover Cart and it did not work. So I found the Upgrade Sql. I have tried running it from the Admin Install Sql Patches both using the upload and then just pasting the Sql Statement into the box. Both times I received this error

"1062 Duplicate entry 'RCS_CHECK_REPEAT' for key 'unq_config_key_zen'
in:
[INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (NULL, 'Ignore Repeat Customers', 'RCS_CHECK_REPEAT', 'false', 'Setting this to true will cause recover cart sales to ignore abandoned carts by repeat customers', @configuration_group_id, 45, NULL, NOW(), NULL, 'zen_cfg_select_option(array('true', 'false'),');]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields."

I dont know anything about SQL. Can someone point me in the correct direction to fix this issue.

Thanks in advance

This just means that you already ran that portion of SQL and that it won't re-add that item to the database. No need to worry about the error, it shouldn't affect the performance of the mod.

So, you say it doesn't work. To help you better let me know what seems to not work with the mod and I'll see if I can get you up and running. It should work on 1.3.9 just fine (got it running on that version on a few sites.)

5 Aug 2010, 4:20 PM
#308
danilyn22 avatar

danilyn22

Zen Follower

Join Date:
Dec 2008
Location:
California
Posts:
102
Plugin Contributions:
0

Re: Recover Cart [Support Thread]

Thank for helping. I am not getting an error but I am not getting anything showing up. I placed an order for myself and abandoned the cart, and it did not show up in Tools/Recover Cart Sales. I use it for a different ZenCart Store (1.3.8) and it works great but on this one I am getting nothing.

How can I tell if the sql Update actually took?

6 Aug 2010, 2:49 PM
#309
econcepts avatar

econcepts

Totally Zenned

Join Date:
Dec 2005
Posts:
1,505
Plugin Contributions:
2

Re: Recover Cart [Support Thread]

A couple things to look at (comparing the two sites).

  1. Are PHP versions the same on both sites?
  2. Is the MySQL version the same on both sites?

In response to your question:

If you look in your DB and see the table 'scart' AND if you log into your admin and look at the "Configuration" menu item (you should see a "recover cart sales" option) then the SQL took ok.

I don't think that is your issue. If the SQL did not take you would be getting other errors when it tried to run saying "tables were missing etc..." and that is not the case.

Did you make sure that you in fact did upload all files and that they are in the correct directories? I would double check that as another alternative just to cover all the bases.

Try this (if you already haven't).

Add an item to your cart ... login to your test account and then exit the page (close the browser.) I just want to see if it is indeed going to catch the abandon this way. You'll have to wait a while (up to 20 minutes possibly) for the record to show in the abandon carts area. This is because the session has to die for it to be placed in the abandoned carts area.

Check the abandoned carts tolls area to see if the record shows. make sure you have the days set to something that will pick it up (something other than "0" of course).

**As a final test, **check your settings in the Configuration > Recover Cart Sales section.

For testing set the following:

Ignore Customers with Sessions = FALSE

Skip carts w/Matched Orders = FALSE (I recommend you set this to "true" in a live environment after testing is complete.)

And if you really want to see if it is recording data, look into the "scart" table mentioned earlier to see if it contains records. If so the system is working ... you just have to find the right settings to make it show.

6 Aug 2010, 9:34 PM
#310
danilyn22 avatar

danilyn22

Zen Follower

Join Date:
Dec 2008
Location:
California
Posts:
102
Plugin Contributions:
0

Re: Recover Cart [Support Thread]

Thanks econcepts

I went through all your steps and checked everything. Finding nothing wrong I redownloaded and reinstalled the whole Mod and IT WORKED!! Yippee. Thanks for taking the time to help me.

7 Aug 2010, 1:05 PM
#311
econcepts avatar

econcepts

Totally Zenned

Join Date:
Dec 2005
Posts:
1,505
Plugin Contributions:
2

Re: Recover Cart [Support Thread]

danilyn22:

Thanks econcepts

I went through all your steps and checked everything. Finding nothing wrong I redownloaded and reinstalled the whole Mod and IT WORKED!! Yippee. Thanks for taking the time to help me.

Super. It sounds like there may have been some missing or corrupt files from the original install.

Glad you got it working.

28 Aug 2010, 3:12 PM
#312
deathman2006 avatar

deathman2006

New Zenner

Join Date:
Apr 2010
Location:
London, UK
Posts:
38
Plugin Contributions:
0

Re: Recover Cart [Support Thread]

Hi all, Ive just installed this mod and have to say i think its great !!!

One query though, would it be possible to get this to work for non registered customers that abandon carts too?
The reason for this is although you cant contact them (as they arent registered) it might shed some light on problems that caused them to abandon the cart.

Thanks in advance for any help to do this :)

28 Aug 2010, 3:40 PM
#313
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: Recover Cart [Support Thread]

deathman2006:

Hi all, Ive just installed this mod and have to say i think its great !!!

One query though, would it be possible to get this to work for non registered customers that abandon carts too?
The reason for this is although you cant contact them (as they arent registered) it might shed some light on problems that caused them to abandon the cart.

Thanks in advance for any help to do this :)

If they don't register you haven't collected their email address yet.

29 Aug 2010, 12:16 AM
#314
deathman2006 avatar

deathman2006

New Zenner

Join Date:
Apr 2010
Location:
London, UK
Posts:
38
Plugin Contributions:
0

Re: Recover Cart [Support Thread]

I know i wont be able to get thier email .. as i said that is obvious, but its more about seeing why ppl abandon carts.

29 Aug 2010, 2:41 AM
#315
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: Recover Cart [Support Thread]

deathman2006:

I know i wont be able to get thier email ..

Then how do you plan on contacting them?

29 Aug 2010, 2:04 PM
#316
deathman2006 avatar

deathman2006

New Zenner

Join Date:
Apr 2010
Location:
London, UK
Posts:
38
Plugin Contributions:
0

Re: Recover Cart [Support Thread]

did you not read my post at all???
i already stated that i know i wouldnt be able to contact them... but it might show something that would help to figure out why they abandoned the cart... patterns etc.

29 Aug 2010, 3:19 PM
#317
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: Recover Cart [Support Thread]

I'm not aware of a Zen Module that does this, but you can create a pop-up to open when a visitor leaves your site that would ask why. Of course, if they are browsing with multiple tabs, as more and more people do, this approach wouldn't work so well.

30 Aug 2010, 12:38 PM
#318
econcepts avatar

econcepts

Totally Zenned

Join Date:
Dec 2005
Posts:
1,505
Plugin Contributions:
2

Re: Recover Cart [Support Thread]

deathman2006:

did you not read my post at all???
i already stated that i know i wouldnt be able to contact them... but it might show something that would help to figure out why they abandoned the cart... patterns etc.

To be honest, you should be able to easily gather the data you need to determine why people abandon just from those that "have" already registered. Providing you have analytics installed correctly, and you have the proper funnels setup for the checkout process, this is usually a really good indicator of where your problem spots are.

If they aren't registering and you want to track the problem there, then you can easily assume that the problem lies somewhere BEFORE the checkout process itself. How? Because once they get past page 1 of the checkout, you have their email and they now will be included in the Recover Cart report (if they abandon.)

If they aren't registering it's obvious that the issue is before the checkout.

You have to determine what point that is (home page, product pages, etc...) and the way to do this is by reading what your analytics program is reporting.

So, yes, you can track them and all of your problem spots if you have analytics installed correctly. Once they get past step one in the checkout they end up in your Recover cart report. If your funnel is setup correctly there you'll be able to tell why those abandons occur as well (using analytics.)

It all comes down to analytics. When installed correctly, you should be able to tell the exact problem points on your site even without an email address, registration, etc...

Check your analytics reports up to the point of the registration to find the exact points and issues of abandon where visitors do not end up creating an account.

Hope that helps.

31 Aug 2010, 4:21 PM
#319
imfsub12 avatar

imfsub12

Zen Follower

Join Date:
Aug 2008
Location:
Halifax, NS
Posts:
274
Plugin Contributions:
0

Re: Recover Cart [Support Thread]

Just installed this for my client - and first of all looks great..

Even does back from 2 years ago.. wow..

When I go and say click my TEST account and add in Additional PS Message:

And send the email - I DON"T GET what i put in the Additional PS Message: both the HTML and the TEXT don't show up in the EMAIL..

How do we solve this..

RIck

31 Aug 2010, 5:31 PM
#320
imfsub12 avatar

imfsub12

Zen Follower

Join Date:
Aug 2008
Location:
Halifax, NS
Posts:
274
Plugin Contributions:
0

Re: Recover Cart [Support Thread]

I think i didnt' LOOK hard enough on it its way way way down at the bottom - VERY SMALL - it show its