Welcome Guest, Not a member yet? Register   Sign In
wfcart problem
#1

[eluser]dimis[/eluser]
I am trying to inegrate wfcart and codeigniter, so I make this model
Code:
class Client_order extends Model {
    protected $cart ;
    function Client_order()
    {
        parent::Model();
        $this->cart =& $this->session->set_userdata('cart');//& $_SESSION['wfcart'];
        if(!is_object($this->cart)) $this->cart = new WfCart();

    }
    function  updateCart($a,$b,$c, $d, $e,$f,$g)
    {
        $this->cart->add_item($a,$b,$c, $d, $e,$f,$g);
    }

    function count()
    {
        return  $this->cart->itemcount;
    }
}
When I put some products at my cart even i put more than one product the count is always 1.
What is wrong?
#2

[eluser]dimis[/eluser]
I change the code to
Code:
class Client_order extends Model {
    protected $cart ;
    function Client_order()
    {
        parent::Model();
        session_start();
        $this->cart =& $_SESSION['cart'];
        if(!is_object( $this->cart))  $this->cart = new wfCart();

    }
    function  updateCart($a,$b,$c, $d, $e,$f,$g)
    {
        $this->cart->add_item($a,$b,$c, $d, $e,$f,$g);
    }

    function count()
    {
        return  $this->cart->itemcount;
    }

}
the count now seems ok.




Theme © iAndrew 2016 - Forum software by © MyBB