Post by ulrslo » Fri Mar 16, 2018 6:16 pm

Hi!
I have an error in our checkout.
"Warning: Cannot modify header information - headers already sent by (output started at /customers/0/1/d/idusforlag.se/httpd.www/catalog/language/swedish/payment/invoice_lite.php:1) in /customers/0/1/d/idusforlag.se/httpd.www/catalog/controller/module/d_link_cart.php on line 100"

I can´t solve it. I have added some text just above the button "Bekräfta beställning". The page is www.idusforlag.se and then put something in the basket, go to checkout, add some details so you can confirm order. When it is possible to confirm order the error appears on the top.

I will be very greatful if someone know what is wrong!
Best regards Ulrika

Here is the file:
/customers/0/1/d/idusforlag.se/httpd.www/catalog/controller/module/d_link_cart.php
<?php
/*
location: catalog/controller/module/
*/
class ControllerModuleDLinkCart extends Controller {

private $error = array();
private $id = 'd_link_cart';
private $route = 'module/d_link_cart';
private $mbooth = '';
private $config_file = '';
private $prefix = '';
private $store_id = 0;

public function __construct($registry){
parent::__construct($registry);

$this->load->model($this->route);
$this->mbooth = $this->model_module_d_link_cart->getMboothFile($this->id, $this->sub_versions);
$this->config_file = $this->model_module_d_link_cart->getConfigFile($this->id);
$this->model_module_d_link_cart->installDependencies($this->mbooth);

if (isset($this->request->get['store_id'])) {
$this->store_id = $this->request->get['store_id'];

}
}

/**
* prints out the button for creating the hash link
*/
public function index($setting) {

$status = $this->config->get('d_link_cart_status');

$this->load->language($this->route);


if(!empty($status)){
$this->load->model('setting/setting');
$this->load->model($this->route);
$setting = $this->config->get('d_link_cart_setting');
$setting['link'] = $this->model_module_d_link_cart->getBaseUrl();

//text
$setting['text_modal_title'] = $this->language->get('text_modal_title');
$setting['text_link_success'] = $this->language->get('text_link_success');
$setting['text_share'] = $this->language->get('text_share');
$setting['text_copy_link'] = $this->language->get('text_copy_link');
$setting['text_close_button'] = $this->language->get('text_close_button');
$setting['text_link_copied'] = $this->language->get('text_link_copied');



if(VERSION >= '2.2.0.0'){
$template = 'module/d_link_cart';
} elseif (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . 'template/module/d_link_cart.tpl')) {
$template = $this->config->get('config_template') . 'template/module/d_link_cart.tpl';
} else {
$template = 'default/template/module/d_link_cart.tpl';
}
return $this->load->view($template, $setting);
}
}

/**
* Function to process the request for the specoified has in the url.
*/
public function process(){

$status = $this->config->get('d_link_cart_status');

if(!empty($status)){
$this->load->model('setting/setting');
$this->load->model($this->route);
$setting = $this->config->get('d_link_cart_setting');
$setting['link'] = $this->model_module_d_link_cart->getBaseUrl();
$hash = '';
if(isset($this->request->get['_route_'])){
if(strlen($this->request->get['_route_']) == 8){
$hash = $this->request->get['_route_'];
}
} elseif(isset($this->request->get['lc'])){
$hash = $this->request->get['lc'];
}else{
$uri = $this->request->server['REQUEST_URI'];
$data = explode("/", $uri);

$data = end($data);

if(strlen($data) == 8){
$hash = $data;
}

}

if($hash){
//Stat
if(isset($this->request->cookie['lc'])){
setcookie('lc', $this->request->cookie['lc'], time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']);
}else{
setcookie('lc', $hash, time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']);
}
//Action
$result = $this->model_module_d_link_cart->getLink($hash);


if($result){
$cart_data = unserialize($result['cart_data']);

$this->model_module_d_link_cart->updateViewed($result['link_id']);


if(VERSION > '2.0.3.1'){
foreach ($cart_data as $key => $value) {
if(is_array($value)){
$this->cart->add($value['product_id'],$value['quantity'],$value['option'],$value['quantity']);
}
}

$this->session->data = $cart_data + $this->session->data;
} else {
foreach ($cart_data as $key => $value) {
if($key != 'cart'){
$flag = false;
foreach ($this->session->data['cart'] as $key_session => $value_session) {
if($key == $key_session){
$this->session->data['cart'][$key_session] = $value_session + $value['quantity'];
$flag = true;
}
}
if(!$flag) {
$this->cart->add($value['product_id'],$value['quantity'],$value['option']);
}
}
}
}

if($setting['target_page']){
$this->response->redirect($setting['target_page']);
}else{
$this->response->redirect($result['url']);
print_r($result['url']);
}

}
}
}
}
/**
* Generates the hash url
*/
public function create(){

$this->load->model($this->route);

$session = $this->session->data;

$get_from_session = array('vouchers', 'cart', 'coupon', 'voucher', 'advanced_coupon');
$products = $this->cart->getProducts();

$data = array();
$data['cart_data']=$products;
foreach ($get_from_session as $key) {

if(isset($session[$key])){
$data['cart_data'][$key] = $session[$key];
}
}


if(isset($this->request->post['url'])){
$data['url'] = htmlspecialchars_decode(urldecode($this->request->post['url']));
}else{
$data['url'] = $this->request->server['REQUEST_URI'];
}

$data['user_id'] = (!empty($this->session->data['user_id'])) ? $this->session->data['user_id'] : 0;
$data['store_id'] = $this->config->get('config_store_id');
$data['ip'] = $this->request->server['REMOTE_ADDR'];
$data['hash'] = hash('adler32', serialize($data));
$this->model_module_d_link_cart->addLink($data);

if($this->model_module_d_link_cart->htaccess_exists()){
$data['lc'] = '';
}else{
$data['lc'] = '?lc=';
}


if (file_exists(DIR_SYSTEM.'library/json.php')) {
$this->load->library('json');
$this->response->setOutput(Json::encode($data));
} else {
$this->response->setOutput(json_encode($data));
}

}


}
?>

New member

Posts

Joined
Wed Mar 30, 2011 2:25 pm

User avatar
Active Member

Posts

Joined
Fri Mar 16, 2012 10:18 am
Location - Canada, QC

Post by ulrslo » Sat Mar 17, 2018 3:11 pm

Tankyou very much.
Best regards Ulrika

New member

Posts

Joined
Wed Mar 30, 2011 2:25 pm

Post by ulrslo » Mon Mar 19, 2018 5:53 pm

Thankyou again Agatha65, this solved the problem!
Best regards Ulrika

New member

Posts

Joined
Wed Mar 30, 2011 2:25 pm
Who is online

Users browsing this forum: No registered users and 29 guests