Welcome Guest, Not a member yet? Register   Sign In
Need Help With The Cart Class


I`m using the Cart class to build a shooping card and I want to check before Inserting to the
cart if the item exists and if so I want to increment its quantity by one , I`m using the following code , But it does not work with me , any help will be appreciated Smile

function add() {
        $Product = array_shift($this->Cart_Model->get_by_id($this->input->post('PID')));
        $data = array(
        'id' => $Product->id,
        'name' => $Product->product_name,
        'price' => $Product->price,
        'qty' => 1
        $cartCont = $this->cart->contents();
        if (!empty($cartCont) AND isset ($cartCont[md5($Product->id)])) {
        if ($this->cart->insert($data)) {

Theme © iAndrew 2016 - Forum software by © MyBB