Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

"Cannot modify header information"


matiasobera

Recommended Posts

Im using the DineroMail contribution to make payments on my ecommrce site.

Whenever I make a purchase it works up to the point where it takes me to the dineromail site, I make the payment and it accepts it, but when I click continue instead of redirecting me to my website as it is supposed to do, i get this error message:

 

 

Warning: Cannot modify header information - headers already sent by (output started at /home/rimcom/public_html/catalog/includes/modules/payment/dineromail.php:1) in /home/rimcom/public_html/catalog/includes/functions/general.php on line 33

 

 

I've tried looking for white spaces in the files involved and others, but nothing so far.

 

This is what I have on line 33 on general.php

 

header('Location: ' . $url);

 

And this is my dineromail.php

 

<?php
/*
$Id: dineromail.php,v 0.05 2008/04/12 15:20:15 fajs Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

class dineromail {
var $code, $title, $description, $enabled;


function dineromail() {
global $order;

$this->code = 'dineromail';
$this->title = MODULE_PAYMENT_DINEROMAIL_TEXT_TITLE;
$this->description = MODULE_PAYMENT_DINEROMAIL_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_DINEROMAIL_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_DINEROMAIL_STATUS == 'True') ? true : false);

if ((int)MODULE_PAYMENT_DINEROMAIL_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_DINEROMAIL_ORDER_STATUS_ID;
}

if (is_object($order)) $this->update_status();

$this->form_action_url = 'https://www.dineromail.com/Shop/Shop_Ingreso.asp';
}

function update_status() {
global $order;

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_DINEROMAIL_ZONE > 0) ) {
$check_flag = false;
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_DINEROMAIL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
while ($check = tep_db_fetch_array($check_query)) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
}

if ($check_flag == false) {
$this->enabled = false;
}
}
}

function javascript_validation() {
return false;
}

function selection() {
return array('id' => $this->code,
'module' => $this->title);
}

function pre_confirmation_check() {
return false;
}

function confirmation() {
return false;
}

function process_button() {
global $order, $currencies, $currency;

$my_currency = $currency;

$a = $order->info['total'];
$b = $order->info['shipping_cost'];
$c = $currencies->get_value($my_currency);
$d = $currencies->get_decimal_places($my_currency);
$total = $a * $c;
$precio = number_format($total, $d, '.', '');

$productos = "Compra en " . STORE_NAME . ": ";

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
$productos .= "// " .  $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'];
}
if ($my_currency == 'USD'){ 
$TipoMoneda = '2';}else{
$TipoMoneda = '1';}


$process_button_string = tep_draw_hidden_field('NombreItem', $productos) .
tep_draw_hidden_field('TipoMoneda', $TipoMoneda) .
tep_draw_hidden_field('PrecioItem', $precio) .
tep_draw_hidden_field('usr_nombre', $order->customer['firstname']) .
tep_draw_hidden_field('usr_apellido', $order->customer['lastname']) .
tep_draw_hidden_field('usr_tel_numero', $order->customer['telephone']) .
tep_draw_hidden_field('usr_email', $order->customer['email_address']) .
tep_draw_hidden_field('E_Comercio', MODULE_PAYMENT_DINEROMAIL_ID) .
tep_draw_hidden_field('trx_id', MODULE_PAYMENT_DINEROMAIL_ID) .
tep_draw_hidden_field('image_url', ''). 
tep_draw_hidden_field('DireccionEnvio', '0' ) .
tep_draw_hidden_field('DireccionExito', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'NONSSL')) .
tep_draw_hidden_field('DireccionFracaso', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

return $process_button_string;
}

function before_process() {
return false;
}

function after_process() {
return false;
}

function output_error() {
return false;
}

function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_DINEROMAIL_STATUS'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}

function install() {
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable dineromail Module', 'MODULE_PAYMENT_DINEROMAIL_STATUS', 'True', 'Habilitar DineroMail como Medio de Pago?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('E_Comercio', 'MODULE_PAYMENT_DINEROMAIL_ID', '02893258', 'Numero de Cuenta', '6', '4', now())");	
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_DINEROMAIL_SORT_ORDER', '0', 'Orden', '6', '0', now())");

}

function remove() {
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

function keys() {
return array('MODULE_PAYMENT_DINEROMAIL_STATUS', 'MODULE_PAYMENT_DINEROMAIL_ID',  'MODULE_PAYMENT_DINEROMAIL_SORT_ORDER', );
}
}
?>

 

The purchased is made, as the information is found on my admin, but having that error message pisses me off!

 

HELP PLEASE!

Link to comment
Share on other sites

what do u use to edit the files?

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

I use notepad
Try opening it in WordPad and see if it looks different (with whitespace at the beginning). Notepad doesn't recognize Linux line feeds and so ignores them.

Always back up before making changes.

Link to comment
Share on other sites

Try opening it in WordPad and see if it looks different (with whitespace at the beginning). Notepad doesn't recognize Linux line feeds and so ignores them.

 

I opened it with wordpad and it's the same, no white spaces at the beg or end

Link to comment
Share on other sites

click me

 

Different file.

 

Same problem, same solution.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

click me

 

Different file.

 

Same problem, same solution.

 

Thanks for the reply but there are NO white spaces in any of the files involved.

 

I looked at them with notepad AND WordPad

 

This function used to work but I guess I modified something. I cannot remember what though.

 

What else could be the problem here?

Link to comment
Share on other sites

have u checked the files u are viewing are the same as those on the server? (check dates)

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

have u checked the files u are viewing are the same as those on the server? (check dates)

 

Yes, they are the same.

 

If I change something in general.php the error moves from line 33 to line 29.

Link to comment
Share on other sites

No doubt some corruption crept in somewhere.

 

 

Moto: Never assume, always check!!

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Today, I just found out about Byte Order Marks. Apparently a byte order mark is part of the UTF-8 spec but is not handled properly by PHP. Instead of ignoring the byte order mark, PHP treats it like white space. Since the byte order mark always appears at the beginning of the file (before the <?php or anything else), it triggers the header already sent problem.

 

The solution? When saving a file as UTF-8, save it as UTF-8 without BOM.

 

The reason why you can't see the byte order mark is that text editors which read it correctly, will treat it as part of the character encoding of the file.

 

It's possible that this is not what caused this particular problem, but the problem description matches.

Always back up before making changes.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...