Welcome Guest, Not a member yet? Register   Sign In
a problem in shopping cart
#1

[eluser]Ali Fattahi[/eluser]
hi everybody
i have a problem in shopping cart library in code igniter
i added a product to shopping cart and i got product information with $this->input->post
and all of thing is ok
but when i wanna redirect a user to their shopping cart without any posted information and saw empty shopping cart
i other word when i posted information to this function the shopping cart haven't any problem but when i typing the cart url in browser i see the basket is empty but i sent a product to shopping cart before :-(
i addition in this cart i have only one product , see in foreach () Wink
can you please help me about this problem
here is my code :
Code:
function    simplepaypost()
{
        $acc_code = $this->db->escape_str($this->input->post('acc_number'));
        $desc = $this->db->escape_str($this->input->post('desc'));
        $amount = (float) $this->db->escape_str($this->input->post('amount'));
        $owner = $this->db->select('name,family')->from('users')->where('acc_code',$acc_code)->get()->result();
        if ($this->input->post('acc_number') && $this->input->post('desc') && $amount > 100 )
        {
            $item = array(
                           'id'      => $acc_code,
                           'qty'     => 1,
                           'price'   => $amount,
                           'name'    => $desc
            );
            $test = 1;
            $this->cart->insert($item);
        }
        $prod = array();
        foreach( $this->cart->contents() as $items )
        {
            $prod['desc']= $items['name'];
            $prod['id']= $items['id'];
            $prod['price']= $items['price'];
        }
        $owner = $this->db->select('name,family')->from('users')->where('acc_code',$prod['id'])->get()->result();
        
        $data['entry'].='
                    <table class="tbl" border="0" width="98%">
                    <tr>
                        
                        <th><span lang="fa">Reciever</span></th>
                        <th style="width: 200px; height: 25px"><span lang="fa">Descriotion</span></th>
                        <th style="width: 130px; height: 25px"><span lang="fa">Amount</span></th>
                    </tr>    
                    
                    <tr>
                    <td>'.$owner[0]->name.' '.$owner[0]->family.'</td>
                    <td>'.$prod['desc'].'</td>
                    <td>'.$prod['price'].'</td>
                    </tr>
                </table>';


        $this->load->view('main_index',$data);
    }
#2

[eluser]WanWizard[/eluser]
Cart information is stored in the session. If you use CI's session library, you HAVE to use database sessions. If not, you will not have enough storage space, and the session will break.

Is the user is still logged in after the redirect (i.e. the session itself is still operational)?
#3

[eluser]Ali Fattahi[/eluser]
[quote author="WanWizard" date="1286032692"]Cart information is stored in the session. If you use CI's session library, you HAVE to use database sessions. If not, you will not have enough storage space, and the session will break.

Is the user is still logged in after the redirect (i.e. the session itself is still operational)?[/quote]

Hi WanWizard
Great Thanks
solved My Problem ,
i was not created session database's table and now i created the table and solved my problem
but already , the user was still logged after redirect Wink

Thanks Again




Theme © iAndrew 2016 - Forum software by © MyBB