Welcome Guest, Not a member yet? Register   Sign In
Shopping cart library
#3

Hi,

I don't know why but i can't do a pull request so i post it here so someone who can maybe wil doe this.

Delete single item of cart:
Code:
function destroy($row_id = FALSE)
    {
        if($row_id === FALSE){
            unset($this->_cart_contents);
            $this->_cart_contents['cart_total'] = 0;
            $this->_cart_contents['total_items'] = 0;
            $this->CI->session->unset_userdata('cart_contents');
        }else{
            unset($this->_cart_contents[$row_id]);
            $this->_save_cart();
        }
    }

Update options of cart item:
Code:
if ($this->_cart_contents[$items['rowid']]['qty'] == $items['qty'] && $this->_cart_contents[$items['rowid']]['options'] == $items['options'])
        {
            return FALSE;
        }

        // Is the quantity zero?  If so we will remove the item from the cart.
        // If the quantity is greater than zero we are updating
        if ($items['qty'] == 0)
        {
            unset($this->_cart_contents[$items['rowid']]);
        }
        else
        {
            $this->_cart_contents[$items['rowid']]['qty'] = $items['qty'];
            $this->_cart_contents[$items['rowid']]['options'] = $items['options'];
        }

        if(!$this->_cart_contents[$items['rowid']]['options'] == $items['options']){
            $this->_cart_contents[$items['rowid']]['options'] = $items['options'];
        }

Hoop someone find this useful,
Stefan Fransen
Reply


Messages In This Thread
Shopping cart library - by stefan - 11-10-2014, 05:54 AM
RE: Shopping cart library - by benedmunds - 11-11-2014, 06:04 PM
RE: Shopping cart library - by stefan - 11-18-2014, 04:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB