Good day.

For the shopping cart I use the standard codeigniter - cart class codeigniter - cart . In the header of the site there is a quantity of goods in the basket ($this->cart->total_items()) . When adding a product to the cart, the quantity is not updated. After a while, if you refresh the page, a quantity appears. On DenWer 'e everything works fine, uploaded to the hosting, and the problems started? When deleting from the basket the same story. It feels like the page is cached and pulls data from the cache when updated.

It's simple: There is a form that is sent by the post method.

 public function addToCart() { $logged_in = $this->session->userdata('logged_in'); if ($logged_in != true) { redirect('/welcome/login'); }; $this->load->model('product_model'); $Product = $this->product_model->get_product_byid($_POST['productId']); $data = array( array( 'id' => $_POST['productId'], 'qty' => $_POST['quantity'], 'name' => $_POST['productId'], 'price' => $Product->price)); $this->cart->insert($data); redirect($_SERVER['HTTP_REFERER']); } 

And in heder I use:

 echo $this->cart->total_items() 
  • tried to add salt ? - Saidolim
  • Do you add / remove products to the basket not through AJAX, by any chance? - Alexander Soloshenko
  • Not. I don't use AJAX. Salt using - Artem Kolos
  • On PHP 5.5 hosting. Hosting smarterasp. - Artem Kolos
  • Ask your hosting provider for support. - Visman

0