public function getContent(array $data)
    {
        $result = &gplcart_static(gplcart_array_hash(array('cart.get.content' => $data)));

        if (isset($result)) {
            return $result;
        }

        $this->hook->attach('cart.get.content.before', $data, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $data['order_id'] = 0;

        $items = $this->getList($data);

        if (empty($items)) {
            return array();
        }

        $result = array(
            'store_id' => $data['store_id'],
            'currency' => $this->currency->getCode()
        );

        $total = $quantity = 0;

        foreach ((array) $items as $item) {
            $prepared = $this->prepareItem($item, $result);
            if (!empty($prepared)) {
                $result['items'][$item['sku']] = $prepared;
                $total += (int) $prepared['total'];
                $quantity += (int) $prepared['quantity'];
            }
        }

        $result['total'] = $total;
        $result['quantity'] = $quantity;

        $this->hook->attach('cart.get.content.after', $data, $result, $this);
        return $result;
    }
public function getContent(array $data)
    {
        $result = &gplcart_static(gplcart_array_hash(array('cart.get.content' => $data)));

        if (isset($result)) {
            return $result;
        }

        $this->hook->attach('cart.get.content.before', $data, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $data['order_id'] = 0;

        $items = $this->getList($data);

        if (empty($items)) {
            return array();
        }

        $result = array(
            'store_id' => $data['store_id'],
            'currency' => $this->currency->getCode()
        );

        $total = $quantity = 0;

        foreach ((array) $items as $item) {
            $prepared = $this->prepareItem($item, $result);
            if (!empty($prepared)) {
                $result['items'][$item['sku']] = $prepared;
                $total += (int) $prepared['total'];
                $quantity += (int) $prepared['quantity'];
            }
        }

        $result['total'] = $total;
        $result['quantity'] = $quantity;

        $this->hook->attach('cart.get.content.after', $data, $result, $this);
        return $result;
    }
public function getContent ( array $ data ) { $ result = & gplcart_static ( gplcart_array_hash ( array ( 'cart.get.content' => $ data ) ) ) ; if ( isset ( $ result ) ) { return $ result ; } $ this -> hook -> attach ( 'cart.get.content.before' , $ data , $ result , $ this ) ; if ( isset ( $ result ) ) { return $ result ; } $ data [ 'order_id' ] = 0 ; $ items = $ this -> getList ( $ data ) ; if ( empty ( $ items ) ) { return array ( ) ; } $ result = array ( 'store_id' => $ data [ 'store_id' ] , 'currency' => $ this -> currency -> getCode ( ) ) ; $ total = $ quantity = 0 ; foreach ( ( array ) $ items as $ item ) { $ prepared = $ this -> prepareItem ( $ item , $ result ) ; if ( ! empty ( $ prepared ) ) { $ result [ 'items' ] [ $ item [ 'sku' ] ] = $ prepared ; $ total += ( int ) $ prepared [ 'total' ] ; $ quantity += ( int ) $ prepared [ 'quantity' ] ; } } $ result [ 'total' ] = $ total ; $ result [ 'quantity' ] = $ quantity ; $ this -> hook -> attach ( 'cart.get.content.after' , $ data , $ result , $ this ) ; return $ result ; }
Returns a cart content
@param array $data
@return array
Returns a cart content