Welcome Guest, Not a member yet? Register   Sign In
cart library sometimes works, sometimes not
#1

[eluser]penta997[/eluser]
Hello. I'm using a cart library to get orders in my web bookstore. But when I call a addCart function on one of my book it's works, but not all the time. Please, help

There is my model function:
Code:
function get_books_by_ID($id)
        {
            $this->db->where('BOOK_ID', $id);

            $query =  $this->db->get('books');
            return $query;
            echo vardump($query);
        }


Controller function:
Code:
function addCards()
       {
          
           $id = $this->uri->segment(3);

           $query = $this->Kategorie_model->get_books_by_ID($id);
          
           if($query->num_rows() > 0)
           {
                foreach($query->result() as $item)
                {
                    $data = array(
                    'id'      => $item->BOOK_ID,
                    'qty'     => 1,
                    'price'   => $item->BOOK_Price,
                    'name'    => $item->BOOK_Title

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

           }

            
       }

And part of view
Code:
<tr>
        <td class="color"><b>Cena: </b>&lt;?php echo $data->BOOK_Price;?&gt;zł</td><td class="border" id="koszyk" >&lt;?php echo anchor('ksiegarnia/addCards/'.$data->BOOK_ID.'/', 'Koszyk'); ?&gt;</td>
    </tr>
     <tr>

and index view, where I displaing a cart total and total_items
Code:
<tr>
                    <td>&lt;?php echo $this->cart->total().'zł';?&gt;</td><td>&lt;?php echo $this->cart->total_items();?&gt;</td>
                </tr>


Messages In This Thread
cart library sometimes works, sometimes not - by El Forum - 01-24-2011, 01:01 PM
cart library sometimes works, sometimes not - by El Forum - 01-24-2011, 04:41 PM
cart library sometimes works, sometimes not - by El Forum - 01-24-2011, 05:05 PM
cart library sometimes works, sometimes not - by El Forum - 01-24-2011, 05:16 PM
cart library sometimes works, sometimes not - by El Forum - 01-24-2011, 05:21 PM
cart library sometimes works, sometimes not - by El Forum - 01-25-2011, 05:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB