currencies[$currency]['value'];
if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
// $products_price = '' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . ' ' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '';
$products_price = $currencies->display_price2($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
// $products_price2 = display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
// Price without currency symbols
$products_price_clean = tep_round(tep_add_tax($new_price * $rate,tep_get_tax_rate($product_info['products_tax_class_id'])),$currencies->currencies[$currency]['decimal_places']);
} else {
$products_price = $currencies->display_price2($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
// Price without currency symbols
$products_price_clean = tep_round(tep_add_tax($product_info['products_price'] * $rate,tep_get_tax_rate($product_info['products_tax_class_id'])),$currencies->currencies[$currency]['decimal_places']);
}
$error = false;
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
include_once 'securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($_POST['captcha_code']) == false) {
// the code was incorrect
// you should handle the error so that the form processor doesn't continue
// or you can use the following code if there is no validation or you do not know how
$the_message = SECURITY_CODE_ERROR;
// exit;
}
else
{
$name = tep_db_prepare_input($HTTP_POST_VARS['name']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
$remarks = tep_db_prepare_input($HTTP_POST_VARS['remarks']);
$newprice = tep_db_prepare_input($HTTP_POST_VARS['newprice']);
$originalproductid = tep_db_prepare_input($HTTP_POST_VARS['originalproductid']);
$originalprice = tep_db_prepare_input($HTTP_POST_VARS['originalprice']);
$subject = tep_db_prepare_input($HTTP_POST_VARS['subject']);
$subject2 = tep_db_prepare_input($HTTP_POST_VARS['subject2']);
if (tep_validate_email($email_address)) {
// Calculate the lowest offer accepted depending on the percentage setting
$maxlowoffer = tep_round(($originalprice - ($originalprice * (MAO_MAX_OFFER_PERCENTAGE_ALLOWED/100))),$currencies->currencies[$currency]['decimal_places']);
// Manipulate the offer price so it always is in US notation before compare
// This must be done because the INPUT field looses the decimal values
// when using a comma for decimal seperator
// Underneath also strips all points and commas from the value typed by
// the customer to prevent all kind of problems with the calculation
// First split the $newprice in a part without and with decimal places
// Check if a decimal point or comma is used at all
if (substr($newprice,strlen($newprice)-3,1) == '.' || substr($newprice,strlen($newprice)-3,1) == ',') {
$newprice_before = substr($newprice,0,strlen($newprice)-3);
$newprice_after = substr($newprice,strlen($newprice)-2);
} else {
$newprice_before = $newprice;
$newprice_after = '00';
}
// Remove all commas and points for the non-decimal value given
$newprice_before = str_replace('.','',$newprice_before);
$newprice_before = str_replace(',','',$newprice_before);
// Put all back together again
$newprice = tep_round($newprice_before . '.' . $newprice_after,$currencies->currencies[$currency]['decimal_places']);
if ($newprice <= $newprice) {
// (Re)create the right format for the email
$newprice = number_format(tep_round($newprice,$currencies->currencies[$currency]['decimal_places']), $currencies->currencies[$currency]['decimal_places'], $currencies->currencies[$currency]['decimal_point'], $currencies->currencies[$currency]['thousands_point']);
$subject .= ' ' . $currencies->currencies[$currency]['symbol_left'] . $newprice . ' ' . $currencies->currencies[$currency]['symbol_right'] . '\n' . EMAIL_DIVIDER . '\n\n' . EMAIL_USER_REMARKS . '\n\n';
$subject = str_replace('\n',chr(13),$subject);
$subject2 .= ' ' . $currencies->currencies[$currency]['symbol_left'] . $newprice . ' ' . $currencies->currencies[$currency]['symbol_right'] . '\n\n' . EMAIL_DIVIDER . '\n' . EMAIL_USER_REMARKS . ' ' . $name . '\n' . EMAIL_DIVIDER . '\n';
$subject2 = str_replace('\n',chr(13),$subject2);
tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT_ADMIN, $subject2 . $remarks, $name, $email_address);
if ($HTTP_POST_VARS['sendemail'] == true) {
tep_mail($name, $email_address, EMAIL_SUBJECT_CUSTOMER, $subject . $remarks, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}
tep_redirect(tep_href_link(FILENAME_PREISALARM, 'action=success'));
} else {
$error = true;
// (Re)create the right format for display
$newprice = number_format(tep_round($newprice,$currencies->currencies[$currency]['decimal_places']), $currencies->currencies[$currency]['decimal_places'], $currencies->currencies[$currency]['decimal_point'], $currencies->currencies[$currency]['thousands_point']);
$messageStack->add('lowoffer', ENTRY_LOW_OFFER_CHECK_ERROR);
}
}
else {
$error = true;
$messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
}
}
}
$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PREISALARM));
?>
>