|
|
' .
'';
// toggle switch for editor
echo '  ' . TEXT_EDITOR_INFO . zen_draw_form('set_editor_form', FILENAME_RECOVER_CART_SALES, '', 'get') . ' ' . zen_draw_pull_down_menu('reset_editor', $editors_pulldown, $current_editor_key, 'onChange="this.form.submit();"') .
zen_hide_session_id() .
zen_draw_hidden_field('action', 'set_editor') .
'';
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 .= "
" . TABLE_CART_TOTAL . "" . $currencies->format($tprice) . " |
" . zen_image_button('button_delete.gif', IMAGE_DELETE) . " |
\n";
echo $cline;
}
$cline = " " . $basket->fields['fname'] . " " . $basket->fields['lname'] . "".$customer." | ";
$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 .= "
" . $products->fields['model'] . " |
fields['products_id'] . '&origin=' . FILENAME_RECOVER_CART_SALES . '?page=' . $_GET['page']) . "'>" . $products->fields['name'] . " |
" . $basket->fields['customers_basket_quantity'] . " |
" . $currencies->format($sprice) . " |
" . $currencies->format($basket->fields['customers_basket_quantity'] * $sprice) . " |
";
$mline .= $basket->fields['customers_basket_quantity'] . ' x ' . $products->fields['name'] . "\n";
$mline .= ' ' . zen_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id='. $basket->fields['products_id']) . " \n\n";
$basket->MoveNext();
}
$cline .= "";
// 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 .= '' . STORE_OWNER . "\n" . zen_catalog_href_link(FILENAME_DEFAULT) . '';
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 .= ' ' . zen_catalog_href_link(FILENAME_LOGIN, '', 'SSL') . '';
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'] = nl2br($email) . zen_db_prepare_input($_POST['message_html']);
$email = strip_tags($email . "\n\n" . zen_db_prepare_input($_POST['message']));
$from = zen_db_prepare_input($_POST['from']); // STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS
$subject = zen_db_prepare_input($_POST['subject']); // EMAIL_TEXT_SUBJECT
zen_mail('', $outEmailAddr, $subject, $email, '', $from, $html_msg);
$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 );
echo $cline;
$cline = "";
}
?>
' . TABLE_CART_TOTAL . '' . $currencies->format($tprice); ?> |
"> |
|
|
|
|
|
|
|
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");
$results = 0;
$curcus = 0;
$tprice = 0;
$totalAll = 0;
$first_line = true;
$skip = false;
while (!$basket->EOF) {
//echo '';var_export($basket->fields);echo ' ';
// If this is a new customer, create the appropriate HTML
if ($curcus != $basket->fields['customers_id']) {
$totalAll += $tprice;
if ($curcus != 0 && !$skip) {
?>
' . TABLE_CART_TOTAL . ' ' . $currencies->format($tprice); ?> |
|
fields['customers_id'];
$tprice = 0;
// change the color on those we have contacted add customer tag to customers
$fcolor = RCS_UNCONTACTED_COLOR;
$checked = 1; // assume we'll send an email
$new = 1;
$skip = false;
$sentdate = "";
$beforeDate = RCS_CARTS_MATCH_ALL_DATES ? '0' : $basket->fields['customers_basket_date_added'];
$customer = $basket->fields['customers_firstname'] . " " . $basket->fields['customers_lastname'];
$status = "";
if ((time()-(RCS_EMAIL_TTL*24*60*60)) <= strtotime($basket->fields['datemodified'])) {
$sentdate = $basket->fields['datemodified'];
$fcolor = RCS_CONTACTED_COLOR;
$checked = 0;
$new = 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) {
// skip repeat customers
if (RCS_CHECK_REPEAT == 'true') {
$skip = true;
} else {
// We have a matching order; assume current customer but not for this order
$customer = '' . $customer . '';
// 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;
} else {
// It's rare for the same customer to order the same item twice, so we probably have a matching order, show it
$fcolor = RCS_MATCHED_ORDER_COLOR;
$srec = $db->Execute("SELECT orders_status_name
FROM " . TABLE_ORDERS_STATUS . "
WHERE language_id = " . (int)$_SESSION['languages_id'] . "
AND orders_status_id = " . (int)$orec->fields['orders_status'] );
if( $srec )
$status = ' [' . $srec->fields['orders_status_name'] . ']';
else
$status = ' ['. TEXT_CURRENT_CUSTOMER . ']';
}
}
$orec->MoveNext();
}
}
if( $skip )
continue; // got a matched cart, skip to next one
}
?>
|
|
fields['customers_basket_date_added']); ?> |
|
fields['customers_email_address']); ?>" target="_blank">fields['customers_email_address']; ?> |
fields['customers_telephone']; ?> |
fields['customers_basket_quantity'] > 0) {
// Get the product information (name, price, etc)
$products = $db->Execute("SELECT p.products_model model,
p.products_type,
pd.products_name name
FROM " . TABLE_PRODUCTS . " p
LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON (pd.products_id = p.products_id AND pd.language_id = '" . (int)$_SESSION['languages_id'] . "')
WHERE p.products_id = '" . (int)$basket->fields['products_id'] . "'");
// Check to see if the product is on special, and if so use that pricing
$sprice = zen_get_products_actual_price( (int)$basket->fields['products_id'] );
// BEGIN OF ATTRIBUTE DB CODE
$prodAttribs = ''; // DO NOT DELETE
if (RCS_SHOW_ATTRIBUTES == 'true') {
$attribrecs = $db->Execute("SELECT cba.products_id,
po.products_options_name poname,
pov.products_options_values_name povname
FROM " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " cba,
" . TABLE_PRODUCTS_OPTIONS . " po,
" . TABLE_PRODUCTS_OPTIONS_VALUES . " pov,
" . TABLE_LANGUAGES . " l
WHERE cba.products_id ='" . $basket->fields['products_id'] . "'
AND cba.customers_id = " . $curcus . "
AND po.products_options_id = cba.products_options_id
AND pov.products_options_values_id = cba.products_options_value_id
AND po.language_id =" . (int)$_SESSION['languages_id'] . "
AND pov.language_id =" . (int)$_SESSION['languages_id']);
$hasAttributes = false;
if ($attribrecs->RecordCount() > 0){
$hasAttributes = true;
$prodAttribs = ' ';
while (!$attribrecs->EOF){
$prodAttribs .= ' - ' . $attribrecs->fields['poname'] . ' ' . $attribrecs->fields['povname'] . ' ';
$attribrecs->MoveNext();
}
}
}
// END OF ATTRIBUTE DB CODE
$tprice += $basket->fields['customers_basket_quantity'] * $sprice;
$ib++;
?>
|
fields['model']; ?> |
fields['products_type'] . "&cPath=" . zen_get_product_path((int)$basket->fields['products_id']) . "&pID=" . (int)$basket->fields['products_id'] . "&action=new_product"); ?>" target="_blank">fields['name']; ?> |
fields['customers_basket_quantity']; ?> |
format($sprice); ?> |
format($basket->fields['customers_basket_quantity'] * $sprice); ?> |
MoveNext();
}
if ($curcus != 0) {
$totalAll += $tprice;
?>
' . TABLE_CART_TOTAL . '' . $currencies->format($tprice); ?> |
|
' . TABLE_GRAND_TOTAL . '' . $currencies->format($totalAll); ?> |
|
|
|
|
|
|
'), 'size="60"'); ?> |
|
|
|
Value = stripslashes($_POST['message_html']) ;
$oFCKeditor->Width = '97%' ;
$oFCKeditor->Height = '350' ;
// $oFCKeditor->Create() ;
$output = $oFCKeditor->CreateHtml() ; echo $output;
} else { // using HTMLAREA or just raw "source"
echo zen_draw_textarea_field('message_html', 'soft', '100%', '25', stripslashes($_POST['message_html']), 'id="message_html"');
}
} ?>
|
|
|
|
|
|
|