I have a really strange behaviour of CodeIgniter's Shopping Cart Class. I have set the ci_session table in my database and already have changed the sess_use_database to TRUE.
What is happening is that when i add items to the Shopping Cart everything is fine: i see my total items counter going up and everything. When i go to my shopping cart page the first time i see all my items there, where they should be. I have also provided delete item button and an Empty Cart button. The strange things happen here: when i click to remove an item, the page refreshes (due to the redirect i think) but the item is still there! Then if i manually refresh the page of the cart, i see that same item i had removed disappear. It's like, when i use redirect, i get the cache of the page, not the actual page with the fresh information on it.
Anyway, here are some links:
Try to add some items from this page: http://www.pantanishoes.it/Niko/index.php/store/linea/urban Clicking on the big dark button on bottom of every item description.
Then try to go to Carrello on the menu on top and try to delete some of the items or Svuota(which does a simple destroy()) and see what happens! Any help would be greatly appreciated! Thanks in advice!
Here is some code of the Cart.
function add() {
$item = $this->store_model->get_item($this->input->post('id'));
$data = array(
'id' => $this->input->post('id'),
'name' => $item->modello,
'qty' => $this->input->post('qty'),
'price' => $item->prezzo,
'options' => array(
'taglia' => $this->input->post('taglia'),
'linea' => $item->linea,
'modello' => $item->modello,
'foto' => $item->foto1
)
);
$this->cart->insert($data);
$linea = str_replace(' ', '-', $item->linea);
redirect('/store/linea/' . $linea . '/', 'location');
}
function remove() {
$rowid = $this->uri->segment(3);
$data = array(
'rowid' => $rowid,
'qty' => 0
);
$this->cart->update($data);
redirect('cart');
}
function destroy() {
$this->cart->destroy();
redirect('cart');
}
On localhost everything was working great! When i loaded the website to the server, it started to have this issues. Really really strange! Is there some config thing I'm missing?
Chrome says: Request URL:http://www.pantanishoes.it/Niko/index.php/cart/remove/fb1b4a9869de6f24aa620e2307192d93 Request Method:GET Status Code:302 Moved Temporarily (from cache)