Bonsoir tout le monde,

Voila une capture du mon probléme:
Nom : 7T11Hzy.png
Affichages : 67
Taille : 103,7 Ko

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
 
class Panier extends CI_Controller { // Our Cart class extends the Controller class
 
	function __Panier()
	{
		parent::__Panier(); // We define the the Controller class is the parent.	
		$this->load->model('cart_model'); // Load our cart model for our entire class
	}
 
	function index()
 
	{
	    $this->db->select('*');
	    $this->db->where('parent_id','0');
		$data['categories']=$this->db->get('produit_categorie');
 
		$this->db->select('*');
	    $this->db->limit(3);
		$data['newproduit']=$this->db->get('produit');
 
		$data['produit'] = $this->cart_model->retrieve_products(); // récupérer les produits
 
		$data['content'] = 'cart/products';
 
		$this->load->view('header');
		$this->load->view('left'); 
		$this->load->view('panier_vue', $data); // affichage de la  page
		$this->load->view('right');
		$this->load->view('footer');
	}
 
	function add_cart_item(){
 
		if($this->cart_model->validate_add_cart_item() == TRUE){
 
			if($this->input->post('ajax') != '1'){
				redirect('panier'); // If javascript is not enabled, reload the page with new data
			}else{
				echo 'true'; // If javascript is enabled, return true, so the cart gets updated
			}
		}
 
	}
 
	function update_cart(){
		$this->cart_model->validate_update_cart();
		redirect('panier/index');
	}
 
	function show_cart(){
		$this->load->view('cart/cart2');
	}
 
	function empty_cart(){
		$this->cart->destroy();
		redirect('panier');
	}
}
 
/* End of file cart.php */
/* Location: ./application/controllers/cart.php */
?>

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php 
 
class Cart_model extends Model {
 
	// Function to retrieve an array with all product information
	function retrieve_products(){
	     $this->db->select('*');        
		$this->db->where('prix','');
		$query = $this->db->get('produit',3);
		return $query->result_array();
	}
 
	// Updated the shopping cart
	function validate_update_cart(){
 
		// Get the total number of items in cart
		$total = $this->cart->total_items();  ///fonction prédefini dans CI
 
		// Retrieve the posted information
		$item = $this->input->post('rowid');
	    $qty = $this->input->post('qty');
 
	                                        // Cycle true all items and update them
		for($i=0;$i < $total;$i++)
		{
			// Create an array with the products rowid's and quantities. 
			$data = array(
               'rowid' => $item[$i],
               'qty'   => $qty[$i]
            );
 
            // Update the cart with the new information
			$this->cart->update($data);
		}
 
	}
 
	// Add an item to the cart
	function validate_add_cart_item(){
 
		$id = $this->input->post('produit_id'); // Assign posted product_id to $id
		$cty = $this->input->post('quantite'); // Assign posted quantity to $cty
 
		$this->db->where('id', $id); // Select where id matches the posted id
		$query = $this->db->get('products', 1); // Select the products where a match is found and limit the query by 1
 
		// Check if a row has been found
		if($query->num_rows > 0){
 
			foreach ($query->result() as $row)
			{
			    $data = array(
               		'id'      => $id,
               		'qty'     => $cty,
               		'prix'   => $row->prix,
               		'nom'    => $row->titre
            	);
 
				$this->cart->insert($data); 
 
				return TRUE;
			}
 
		// Nothing found! Return FALSE!	
		}else{
			return FALSE;
		}
	}
 
	// Needed?
	//function cart_content(){
	//	return $this->cart->total();
	//}
 
}
 
 
/* End of file cart_model.php */
/* Location: ./application/models/cart_model.php */
Merci Bien pour votre aide