Welcome Guest, Not a member yet? Register   Sign In
Debugging Cart
#1

[eluser]Parahi[/eluser]
Hello, could I have some help with this please. This is a add to cart function with a function gett_product in Models. I cannot see what is wrong here, could someone help me please. Parahi

This is in Models which connects to database and used in Controllers with Function add_cart
function get_product()
{
$product_id = $this->input->post('product_id');

$query = $this->db->select('product_id, product_name, description, price, photopath');
$query = $this->db->from('product');
$query = $this->db->where('product_id', $product_id);
$query = $this->db->get('');
return $query->result_array();
}

This is in the Controller called Function add_cart:
public function add_cart()
{

$thisProduct = $this->Cart_model->add_product();

if($thisProduct->num_rows() > 0)
{

$data = array('id' => $thisProduct['product_id'],
'qty' => 1,
'price' => $thisProduct['price'],
'name' => $thisProduct['product_name'],
'description' => $thisProduct['description']
);

$this->cart->insert($data);

}

$this->load->view("site_header");
$this->load->view("site_nav");
$this->load->view("shoppingcart", $data);
$this->load->view("site_footer");
}

#2

[eluser]Parahi[/eluser]
h




Theme © iAndrew 2016 - Forum software by © MyBB