Calculate all prices

@return \Symfony\Component\HttpFoundation\JsonResponse
485455
public function loadConvertedPrices()
    {
        $product_sale_element_id  = \intval($this->getRequest()->get('product_sale_element_id', 0));
        $currency_id = \intval($this->getRequest()->get('currency_id', 0));

        $price_with_tax = $price_without_tax = $sale_price_with_tax = $sale_price_without_tax = 0;

        if (null !== $pse = ProductSaleElementsQuery::create()->findPk($product_sale_element_id)) {
            if ($currency_id > 0
                &&
                $currency_id != Currency::getDefaultCurrency()->getId()
                &&
                null !== $currency = CurrencyQuery::create()->findPk($currency_id)) {
                // Get the default currency price
                $productPrice = ProductPriceQuery::create()
                    ->filterByCurrency(Currency::getDefaultCurrency())
                    ->filterByProductSaleElementsId($product_sale_element_id)
                    ->findOne()
                ;

                // Calculate the converted price
                if (null !== $productPrice) {
                    $price_without_tax = $productPrice->getPrice() * $currency->getRate();
                    $sale_price_without_tax = $productPrice->getPromoPrice() * $currency->getRate();
                }
            }

            if (null !== $product = $pse->getProduct()) {
                $price_with_tax = $this->computePrice($price_without_tax, 'with_tax', $product);
                $sale_price_with_tax = $this->computePrice($sale_price_without_tax, 'with_tax', $product);
            }
        }

        return new JsonResponse(array(
            'price_with_tax'         => $this->formatPrice($price_with_tax),
            'price_without_tax'      => $this->formatPrice($price_without_tax),
            'sale_price_with_tax'    => $this->formatPrice($sale_price_with_tax),
            'sale_price_without_tax' => $this->formatPrice($sale_price_without_tax)
        ));
    }
1000307
public function getVarMinPrice()
    {
        if (!\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_perfLoadPrice') || !$this->_blLoadPrice) {
            return;
        }

        $oPrice = null;
        $dPrice = $this->_calculateVarMinPrice();

        $oPrice = $this->_getPriceObject();
        $oPrice->setPrice($dPrice);

        $this->_calculatePrice($oPrice);

        return $oPrice;
    }
1269318
public function allValues()
    {
        $raw = $this->_parameters['_raw'];
        $values = explode(',', $raw);
        $result = ArrayMethods::trim($values);
        return $result;
    }
44738
public function all()
    {
        if ($this->all) {
            return $this->all;
        }

        $this->all = $this->loader()->all()->addOrder('news_date', 'desc')->load();

        return $this->all;
    }
438356
public function priceCalculator()
    {
        $return_price = 0;

        $price      = \floatval($this->getRequest()->query->get('price', 0));
        $product_id = \intval($this->getRequest()->query->get('product_id', 0));
        $action     = $this->getRequest()->query->get('action', ''); // With ot without tax
        $convert    = \intval($this->getRequest()->query->get('convert_from_default_currency', 0));

        if (null !== $product = ProductQuery::create()->findPk($product_id)) {
            if ($action == 'to_tax') {
                $return_price = $this->computePrice($price, 'without_tax', $product);
            } elseif ($action == 'from_tax') {
                $return_price = $this->computePrice($price, 'with_tax', $product);
            } else {
                $return_price = $price;
            }

            if ($convert != 0) {
                $return_price = $price * Currency::getDefaultCurrency()->getRate();
            }
        }

        return new JsonResponse(array('result' => $this->formatPrice($return_price)));
    }
1059983
private function runCalculations()
    {
        //$this->resetCalculations(); //TODO: REMOVE THIS TEMPORARY LINE
        if (!empty($this->shopCalculations)) return $this->shopCalculations;
        $cacheKey = $this->calculationsCacheKey;
        if (Config::get('shop.cache_calculations')
            && Cache::has($cacheKey)
        ) {
            $this->shopCalculations = Cache::get($cacheKey);
            return $this->shopCalculations;
        }

        $this->shopCalculations = DB::table($this->table)
            ->select([
                DB::raw('sum(' . DB::getTablePrefix() . Config::get('shop.item_table') . '.quantity) as itemCount'),
                DB::raw('sum(' . DB::getTablePrefix() . Config::get('shop.item_table') . '.price * ' . DB::getTablePrefix() . Config::get('shop.item_table') . '.quantity) as totalPrice'),
                DB::raw('sum(' . DB::getTablePrefix() . Config::get('shop.item_table') . '.tax * ' . DB::getTablePrefix() . Config::get('shop.item_table') . '.quantity) as totalTax'),
                DB::raw('sum(' . DB::getTablePrefix() . Config::get('shop.item_table') . '.shipping * ' . DB::getTablePrefix() . Config::get('shop.item_table') . '.quantity) as totalShipping'),
                DB::raw('sum(' . DB::getTablePrefix() . Config::get('shop.item_table') . '.discount * ' . DB::getTablePrefix() . Config::get('shop.item_table') . '.quantity) as totalDiscount')
            ])
            ->join(
                Config::get('shop.item_table'),
                Config::get('shop.item_table') . '.' . ($this->table == Config::get('shop.order_table') ? 'order_id' : $this->table . '_id'),
                '=',
                $this->table . '.id'
            )
            ->where($this->table . '.id', $this->attributes['id'])
            ->first();

        if(!is_null(session('coupon'))) {
            $this->setCoupon(session('coupon'));
        }
        $basePrice = $this->shopCalculations->totalPrice;

        //Apply cash discount
        if ($this->coupon['value']) {
            $this->shopCalculations->totalPrice -= $this->coupon['value'];
        }
        $this->shopCalculations->cashDiscount = $this->coupon['value'];

        //Apply % discount
        if ($this->coupon['percent']) {
            $this->shopCalculations->totalPrice -= $this->shopCalculations->totalPrice * $this->coupon['percent'] / 100;
            $this->shopCalculations->percentageDiscount = $basePrice - $this->shopCalculations->totalPrice;
        } else {
            $this->shopCalculations->percentageDiscount = 0;
        }

        $this->shopCalculations->totalDiscount = $this->shopCalculations->cashDiscount + $this->shopCalculations->percentageDiscount;

        if (Config::get('shop.cache_calculations')) {
            Cache::put(
                $cacheKey,
                $this->shopCalculations,
                Config::get('shop.cache_calculations_minutes')
            );
        }
        return $this->shopCalculations;
    }
990163
public function all()
    {
        $keys = glob($this->path.'/*.json');
        $data = [];
        foreach ($keys as $key) {
            $data[] = $this->get(basename($key, '.json'));
        }

        return $data;
    }
597345
public function getSumPrice()
	{
		$price = clone $this->_price;

		$price->setValue( $price->getValue() * $this->_values['quantity'] );
		$price->setCosts( $price->getCosts() * $this->_values['quantity'] );
		$price->setRebate( $price->getRebate() * $this->_values['quantity'] );

		return $price;
	}
416785
public function all()
    {
        $table = trim(self::$table);
        if (!empty($table)) {
            $query = /** @lang text */
                "SELECT * FROM {$table}";


            if(!empty($this->groupby)){
                $query.=' GROUP BY '.$this->groupby;
            }

            if (!empty($this->order)) {
                $query .= $this->order;
            }


            //execute the query and return the data or error message
              return  $this->fetch($query);


        } else {
            static::$response["status"] = "error";
            static::$response["response"] = "Table name cannot be empty";
            static::$response["code"] = 5000;
            return static::terminate(static::$response);
        }
    }
561047
public function getFPrice()
    {
        if ($this->_fPrice == null) {
            $this->_fPrice = false;
            if ($dArtPrice = $this->getPrice()) {
                $myLang = \OxidEsales\Eshop\Core\Registry::getLang();
                $oThisCurr = $this->getPriceAlarmCurrency();
                $this->_fPrice = $myLang->formatCurrency($dArtPrice, $oThisCurr);
            }
        }

        return $this->_fPrice;
    }
768635
public static function all() {
        $request = array_merge(self::paramFilter($_GET), self::paramFilter($_POST));
        return $request;
    }
126104
public function getDefaultPrice()
    {
        $prices = $this->getPrices();
        foreach ($prices as $price) {
            if ($price->from == 1) {
                return $price->value;
            }
        }
    }
904677
public function getPrice()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        // 0002030 No need to return price if it disabled for better performance.
        if (!$myConfig->getConfigParam('bl_perfLoadPrice')) {
            return;
        }

        if ($this->_oPrice === null) {
            $this->_oPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
            if (($dPrice = $this->_getGroupPrice())) {
                $dPrice = $this->modifyGroupPrice($dPrice);
                $this->_oPrice->setPrice($dPrice, $this->_dVat);

                $this->_applyParentVat($this->_oPrice);
                $this->_applyCurrency($this->_oPrice);
                // apply discounts
                $this->_applyParentDiscounts($this->_oPrice);
            } elseif (($oParent = $this->getParent())) {
                $this->_oPrice = $oParent->getPrice();
            }
        }

        return $this->_oPrice;
    }
96651
public function listJsonAction()
    {
        $em = $this->getDoctrine()->getManager();
        $adminManager = $this->get('admin_manager');
        /** @var \AdminBundle\Services\DataTables\JsonList $jsonList */
        $jsonList = $this->get('json_list');
        $jsonList->setRepository($em->getRepository('EcommerceBundle:Product'));
        $user = $this->container->get('security.token_storage')->getToken()->getUser();
        if ($user->isGranted('ROLE_USER')) {
            $jsonList->setActor($user);
        }
        
        $response = $jsonList->get();

        return new JsonResponse($response);
    }
1179784
protected function _calcItemsPrice()
    {
        // resetting
        $this->setSkipDiscounts(false);
        $this->_iProductsCnt = 0; // count different types
        $this->_dItemsCnt = 0; // count of item units
        $this->_dWeight = 0; // basket weight

        $this->_oProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
        $this->_oDiscountProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
        $this->_oNotDiscountedProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);

        $oDiscountList = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class);

        /** @var \oxBasketItem $oBasketItem */
        foreach ($this->_aBasketContents as $oBasketItem) {
            $this->_iProductsCnt++;
            $this->_dItemsCnt += $oBasketItem->getAmount();
            $this->_dWeight += $oBasketItem->getWeight();

            if (!$oBasketItem->isDiscountArticle() && ($oArticle = $oBasketItem->getArticle(true))) {
                $oBasketPrice = $oArticle->getBasketPrice($oBasketItem->getAmount(), $oBasketItem->getSelList(), $this);
                $oBasketItem->setRegularUnitPrice(clone $oBasketPrice);

                if (!$oArticle->skipDiscounts() && $this->canCalcDiscounts()) {
                    // apply basket type discounts for item
                    $aDiscounts = $oDiscountList->getBasketItemDiscounts($oArticle, $this, $this->getBasketUser());
                    reset($aDiscounts);
                    /** @var \oxDiscount $oDiscount */
                    foreach ($aDiscounts as $oDiscount) {
                        $oBasketPrice->setDiscount($oDiscount->getAddSum(), $oDiscount->getAddSumType());
                    }
                    $oBasketPrice->calculateDiscount();
                } else {
                    $oBasketItem->setSkipDiscounts(true);
                    $this->setSkipDiscounts(true);
                }

                $oBasketItem->setPrice($oBasketPrice);
                $this->_oProductsPriceList->addToPriceList($oBasketItem->getPrice());

                //P collect discount values for basket items which are discountable
                if (!$oArticle->skipDiscounts()) {
                    $this->_oDiscountProductsPriceList->addToPriceList($oBasketItem->getPrice());
                } else {
                    $this->_oNotDiscountedProductsPriceList->addToPriceList($oBasketItem->getPrice());
                    $oBasketItem->setSkipDiscounts(true);
                    $this->setSkipDiscounts(true);
                }
            } elseif ($oBasketItem->isBundle()) {
                // if bundles price is set to zero
                $oPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
                $oBasketItem->setPrice($oPrice);
            }
        }
    }
309939
public function totals()
    {
        $totals = Collection::make();

        foreach (Arr::except($this->footer(), 'all') as $level => $count) {
            $totals->put($level, [
                'label'     => $this->translate("levels.$level"),
                'value'     => $count,
                'color'     => $this->color($level),
                'highlight' => $this->color($level),
            ]);
        }

        return $totals;
    }
542550
public function getAddonPrices()
    {
        $addonPrices = [];
        if ($this->addonPrices) {
            foreach ($this->addonPrices as $addonPrice) {
                $addonPrices[] = new AddonPrice($addonPrice, $this->locale, $this->priceFormatter);
            }
        }

        return $addonPrices;
    }