Sum weight totals
@param float $total
@param array $item
@param array $order
@return null
508464
protected function sumTotalWeight(&$total, array &$item, array $order)
    {
        $product = &$item['product'];

        if ($product['weight_unit'] !== $order['weight_unit']) {

            try {
                $product['weight'] = $this->convertor->convert($product['weight'], $product['weight_unit'], $order['weight_unit']);
            } catch (Exception $ex) {
                return null;
            }

            $product['weight_unit'] = $order['weight_unit'];
        }

        $total += (float) ($product['weight'] * $item['quantity']);
        return null;
    }
191175
public function calculate(&$total, $data, &$components, array $price_rule)
    {
        try {
            $callback = Handler::get($this->getTypes(), $price_rule['value_type'], 'calculate');
            call_user_func_array($callback, array(&$total, &$components, $price_rule, $data));
        } catch (Exception $ex) {
            trigger_error($ex->getMessage());
        }
    }
1333569
public function setTotal($total) {
		if ($total instanceof Builder) {
			$this->_total = intval($total->count());
			return $this;
		}
		$this->_total = intval($total);
		return $this;
	}
1056945
protected function calculateOrderStatus($orderPayment, $order)
    {
        $orderPaymentStatusCalculator = $this->getOrderPaymentStatusCalculator();
        $orderPaymentStatusCalculator->setOrderPayment($orderPayment);
        $orderPaymentStatusCalculator->setOrder($order);

        $newOrderStatus = $orderPaymentStatusCalculator->getStatus();

        return $newOrderStatus;
    }
218596
public function calculate_totals() {

		/**
		 * @var $wpdb wpdb
		 */
		global $wpdb;

		// Set totals.
		if ( false !== $this->total_sql ) {
			$total = @current( $wpdb->get_col( $this->get_sql( $this->total_sql ) ) );
		} else {
			$total = @current( $wpdb->get_col( 'SELECT FOUND_ROWS()' ) );
		}

		$total                        = self::do_hook( 'select_total', $total, $this );
		$this->total_found            = 0;
		$this->total_found_calculated = true;

		if ( is_numeric( $total ) ) {
			$this->total_found = $total;
		}
	}
197590
public function update($sku, array $item)
    {
        if ($this->offsetExists($sku)) {
            $item = array_merge($this->offsetGet($sku), $item);

            // update sub-total
            $item[ 'subTotal' ][ 'price' ] = $item[ 'price' ] * $item[ 'quantity' ];
            $item[ 'subTotal' ][ 'weight' ] = $item[ 'weight' ] * $item[ 'quantity' ];

            $this->storage[ $sku ] = $item;

            return true;
        }

        return false;
    }
741937
protected function getListItems($key, $total, $offset = 0)
	{
		$items = array();

		for ($i = $offset; $i < $total; $i++) {
			$items[$i] = $this->database->lindex($key, $i);
		}

		return $items;
	}
588137
public function getOrderItemTotal(OrderItemInterface $item, $ati = false)
    {
        return $this->calculator->calculateOrderItemTotal($item, $ati);
    }
530302
public function offsetSet($offset, $item)
	{
		if ($offset === null)
		{
			$this->_data[] = $item;
			$this->_total = count($this->_data);
		}
		else
		{
			$this->_data[$offset] = $item;
		}
	}
72617
protected function prepareOrderAccountOrder(array &$order)
    {
        $this->setItemTotalFormatted($order, $this->price);
        $this->setItemOrderAddress($order, $this->address);
        $this->setItemOrderStoreName($order, $this->store);
        $this->setItemOrderStatusName($order, $this->order);
        $this->setItemOrderPaymentName($order, $this->payment);
        $this->setItemOrderShippingName($order, $this->shipping);
    }
790730
public function getTotalWeight()
    {
        $totalWeight = 0;

        if ($this->count()) {
            foreach ($this->storage as $id => $item) {
                if (isset($item[ 'subTotal' ][ 'weight' ])) {
                    $totalWeight += (int)$item[ 'weight' ];
                }
            }
        }

        return $totalWeight;
    }
490690
protected function addItem(Item $item, int $position = null): Item
	{
		/* @var $this IParent */
		$item->setParent($this);
		if ($position !== null) {
			Arrays::slice($this->items, $position, $item);
		} else {
			$this->items[] = $item;
		}
		return $item;
	}
187924
function _calculateTotals() {
        if (empty($this->_calculateTotals)) {
            return;
        }

        $this->addSeparator();

        $totals = array();
        foreach ($this->_data as $row) {
            if (is_array($row)) {
                foreach ($this->_calculateTotals as $columnID) {
                    $totals[$columnID] += $row[$columnID];
                }
            }
        }

        $this->_data[] = $totals;
        $this->_updateRowsCols();
    }
958501
function (total) {
            this._enabled = true;
            this._stream = false;
            this.addParticles((typeof total === "number") ? total : this.totalParticles);
            this._enabled = false;
        }
135442
public static function isAllowedSum($order, $sumReturn)
	{
		$returnsBefore = PayReturn::whereOrderId($order->id)->get();
		$sumOldReturn = 0;
		foreach ($returnsBefore as $one) {
			$sumOldReturn += $one->sum;
		}
		$possibleReturn = $order->sum - $sumOldReturn;

		return $sumReturn <= $possibleReturn;
	}
586358
protected function getTotal()
	{
		if (null == $this->_total) {
			$this->_total = 0;
			foreach ($this->types as $type) {
				if (isset($type['value'])) {
					$this->_total += $type['value'];
				}
			}
		}
		return $this->_total;
	}
207787
public function addOrderBy($sort, $order = null)
    {
        if (false !== strpos($sort, '.')) {
            return parent::addOrderBy($sort, $order);
        }

        if (true === in_array($sort, self::$joinCriteria)) {
            $sort = $this->getSectionAlias().'.'.$sort;
        } elseif (0 !== strpos($this->getAlias().'.', $sort)) {
            $sort = $this->getAlias().'.'.$sort;
        }

        return parent::addOrderBy($sort, $order);
    }