Get the number of items in the cart.

@param bool $totalItems Get all the items (when false, will return the number of rows)

@return int
492665
public function count($totalItems = true)
    {
        $items = $this->getCart();

        if (!$totalItems) {
            return $items->count();
        }

        $count = 0;

        foreach ($items as $row) {
            $count += $row->qty;
        }

        return $count;
    }
1126153
public function getItemsCount()
    {
        $itemsCount = 0;

        foreach ($this->_aBasketContents as $oBasketItem) {
            $itemsCount += $oBasketItem->getAmount();
        }

        return $itemsCount;
    }
1161482
public function getTotal()
  {
    $rawQuery = "SELECT count(*) as total FROM orders";

    // Perform the raw query.
    $rawResults = DB::select( DB::raw($rawQuery) );

    // Return the total.
    return $rawResults[0]->total;
  }
615053
private function obtainNumRows()
    {
        $count = 0;
        while (false !== $this->stmt->fetch(PDO::FETCH_NUM)) {
            $count = $count + 1;
        }
        $this->stmt->execute();
        return $count;
    }
1088423
public function getTotal()
    {
        $query = $this->getQuery()->select('COUNT(*) as total');

        $rows = $this->database->query($query, $this->database->getBinds());

        if (!isset($rows[0]['total'])) {
            return 0;
        }

        return $rows[0]['total'];
    }
726444
public function getAllRowsCount()
    {
        
        if($this->rowscount == -1){
           $this->rowscount = $this->DataSource->getItemCount() ;    
        }        
        return $this->rowscount;
    }
799146
public function getTotal()
    {
        $content = $this->getContent();

        $total = $content->reduce(function (Money $total, CartItem $cartItem) {
            return $total->add($cartItem->getTotal());
        }, new Money(0, Config::get('shoppingcart.currency')));

        return $total;
    }
627784
public function total()
        {
            $total = 0;
            $cart = $this->getContent();

            if(empty($cart->_fields)) {
                return $total;
            }

            foreach($cart->_fields as $rowId) {
                $row = $cart->$rowId;
                $total += $row->subtotal;
            }

            return $total;
        }
24702
public function process(array $items)
    {
        if (!$this->limit) {
            return $items;
        }
        $total = count($items);
        if ($this->limit > $total) {
            return $items;
        }
        for ($i = $this->limit; $i < $total; $i++) {
            if (isset($items[$i])) {
                unset($items[$i]);
            }
        }

        return $items;
    }
93048
protected function calculateTotalItemCount()
	{
		$baseCriteria=$this->model->getDbCriteria(false);
		if($baseCriteria!==null)
			$baseCriteria=clone $baseCriteria;
		$count=$this->model->count($this->getCountCriteria());
		$this->model->setDbCriteria($baseCriteria);
		return $count;
	}
69990
public final long getTotalCount()
    {
        long result = 0;
        result = result + _storedItemManager.getStatistics().getTotalCount();
        result = result + _unstoredItemManager.getStatistics().getTotalCount();
        return result;
    }
639424
public function countTotalStatsVisits()
    {
        $em = $this->getEntityManager();
        $query = $em->createQuery(
            'SELECT SUM( s.visits ) FROM  EcommerceBundle:ProductStats AS s'
        );

        $total = $query->getSingleScalarResult();

        return $total;
    }
517608
public function get_number_of_items() {
        global $DB;

        if (is_null($this->itemsavailable)) {
            $this->itemsavailable = $DB->get_field_sql('
                    SELECT MIN(qdd.itemcount)
                      FROM {question_dataset_definitions} qdd
                      JOIN {question_datasets} qd ON qdd.id = qd.datasetdefinition
                     WHERE qd.question = ?
                    ', array($this->questionid), MUST_EXIST);
        }

        return $this->itemsavailable;
    }
355470
public function totalCount()
    {
        if ($this->skipTotalRecords) {
            return true;
        }

        return $this->totalRecords ? $this->totalRecords : $this->count();
    }
450014
public function getCartTotalPrice($withItemsInPromo = true)
    {
        $total = 0;

        $cartItems = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getCartItems();

        foreach ($cartItems as $cartItem) {
            if ($withItemsInPromo || ! $cartItem->getPromo()) {
                $total += $cartItem->getRealPrice() * $cartItem->getQuantity();
            }
        }

        return $total;
    }
922618
public function getTotalPages($totalNumber = null)
    {
        if (is_null($totalNumber)) {
            $totalNumber = $this->totalNumberOfElements;
        }

        return $this->getLimit() ? (ceil($totalNumber / $this->getLimit())) : 1;
    }
1111903
public function setNumTotalResults( $total )
	{
		$total = (int)$total;
		if ( $total < 0 )
		{
			trigger_error( 'Pagination setNumTotalResults: Total must be positive.' );
			return false;
		}

		$this->items_total = $total;
	}