[eluser]vincej[/eluser]
On my development server I do not get this problem, however, I have recently moved my site onto an ISP in a testing environment and now I am getting a nasty error:
Code:
Message: Cannot modify header information - headers already sent by (output started at /services9/webpages/g/r/my-site.com/public/CLFarms/system/core/Exceptions.php:185)
I have looked that the controller being called and indeed there are 3 redirects, but I do not understand why they don't give me an error locally but they do on my remote ISP testing server,
What is also relevant is that if you reload the page the errors go away and the page loads normally.
Can someone with more experience give me advice as to where I am going wrong ?
MANY MANY THANKS !
Controller
Code:
function cart($productid=0){
if (!isset($_SESSION['userid'])){
$this->session->set_flashdata('error', 'You will need to login to place an order' );
redirect('welcome/index','refresh') ;}
if ($productid > 0){ // IF PRODUCT PRESENT THEN ADDS TO CART
$productid = $this->uri->segment(3);
$fullproduct = $this->MProducts->getProductUserCode($productid);
$this->MOrders->updateCart($productid,$fullproduct); // UPDATE CART ADDS ONE ITEM TO CART IF THERE IS NONE AND INCREMENTS COUNT +1 IF ITEM IS IN CART ALREADY.
redirect('welcome/product/'.$productid, 'refresh');
}
else{ // GOES TO 'VIEW CART' AND SHOWS CONTENTS OF CART
$data['title'] = "MY SITE | Shopping Cart";
if (count($_SESSION['cart'])){
$data['main'] = 'shoppingcart';
$data['location'] = $this->MCustomer->GetCustomerPickupLocation(); // This delivers a full text version of the location not an ID //
$data['deliverydates'] = $this->MPickup->GetLocationDates($data['location']);
$data['navlist'] = $this->MCats->getCategoriesNav();
$this->load->vars($data);
$this->load->view('template');
}else{
redirect('welcome/index','refresh');
}
}
}