Cart di code igniter tidak mau tampil

assalamu'alaikum saya mau tanya nih master2

function add_to_cart(){ //fungsi Add To Cart
		$data = array(
			'id' => $this->input->post('produk_id'),
			'name' => $this->input->post('produk_nama'),
			'price' => $this->input->post('produk_harga'),
			'qty' => $this->input->post('quantity'),
		);
		$this->cart->insert($data);
		redirect('home');
		// echo $this->show_cart(); //tampilkan cart setelah added
	}

	function show_cart(){ //Fungsi untuk menampilkan Cart
		$output = '';
		$no = 0;
		foreach ($this->cart->contents() as $items) {
			$no++;
			$output .='
				<tr>
				<td>'.$items['id'].'</td>
					<td> '.$items['name'].'</td>
					<td> '.number_format($items['price']).' </td>
					<td> '.$items['qty'].'</td>
					<td> '.number_format($items['subtotal']).' </td>
					<td><button type="button" id="'.$items['rowid'].'" class="hapus_cart btn btn-danger btn-xs">Batal</button></td>
				</tr>
			';
		}
		$output .= '
			<tr>
				<th colspan="3">Total</th>
				<th colspan="2">'.'Rp '.number_format($this->cart->total()).'</th>
			</tr>
		';
		return $output;
	}

avatar bari0205
@bari0205

1 Kontribusi 0 Poin

Dipost 3 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban