src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php
private function getValidProductPriceForItem($item, $currency)
    {
        $product = $item->getCalcProduct();
        $specialPriceValue = null;
        $bulkPriceValue = null;

        //get special price
        $specialPrice = $this->priceManager->getSpecialPriceForCurrency($product, $currency);
        if ($specialPrice) {
            $specialPriceValue = $specialPrice->getPrice();
        }

        //get bulk price
        $bulkPrice = $this->priceManager->getBulkPriceForCurrency($product, $item->getCalcQuantity(), $currency);
        if ($bulkPrice) {
            $bulkPriceValue = $bulkPrice->getPrice();
        }

        //take the smallest
        if(!empty($specialPriceValue) && !empty($bulkPriceValue)) {
            $priceValue = $specialPriceValue;
            if ($specialPriceValue > $bulkPriceValue) {
                $priceValue = $bulkPriceValue;
            }
        } elseif (!empty($specialPriceValue)) {
            $priceValue = $specialPriceValue;
        } else {
            $priceValue = $bulkPriceValue;
        }

        // no price set - return 0
        if (empty($priceValue)) {
            return 0;
        }

        return $priceValue;
    }
private function getValidProductPriceForItem($item, $currency)
    {
        $product = $item->getCalcProduct();
        $specialPriceValue = null;
        $bulkPriceValue = null;

        //get special price
        $specialPrice = $this->priceManager->getSpecialPriceForCurrency($product, $currency);
        if ($specialPrice) {
            $specialPriceValue = $specialPrice->getPrice();
        }

        //get bulk price
        $bulkPrice = $this->priceManager->getBulkPriceForCurrency($product, $item->getCalcQuantity(), $currency);
        if ($bulkPrice) {
            $bulkPriceValue = $bulkPrice->getPrice();
        }

        //take the smallest
        if(!empty($specialPriceValue) && !empty($bulkPriceValue)) {
            $priceValue = $specialPriceValue;
            if ($specialPriceValue > $bulkPriceValue) {
                $priceValue = $bulkPriceValue;
            }
        } elseif (!empty($specialPriceValue)) {
            $priceValue = $specialPriceValue;
        } else {
            $priceValue = $bulkPriceValue;
        }

        // no price set - return 0
        if (empty($priceValue)) {
            return 0;
        }

        return $priceValue;
    }
private function getValidProductPriceForItem ( $ item , $ currency ) { $ product = $ item -> getCalcProduct ( ) ; $ specialPriceValue = null ; $ bulkPriceValue = null ; //get special price $ specialPrice = $ this -> priceManager -> getSpecialPriceForCurrency ( $ product , $ currency ) ; if ( $ specialPrice ) { $ specialPriceValue = $ specialPrice -> getPrice ( ) ; } //get bulk price $ bulkPrice = $ this -> priceManager -> getBulkPriceForCurrency ( $ product , $ item -> getCalcQuantity ( ) , $ currency ) ; if ( $ bulkPrice ) { $ bulkPriceValue = $ bulkPrice -> getPrice ( ) ; } //take the smallest if ( ! empty ( $ specialPriceValue ) && ! empty ( $ bulkPriceValue ) ) { $ priceValue = $ specialPriceValue ; if ( $ specialPriceValue > $ bulkPriceValue ) { $ priceValue = $ bulkPriceValue ; } } elseif ( ! empty ( $ specialPriceValue ) ) { $ priceValue = $ specialPriceValue ; } else { $ priceValue = $ bulkPriceValue ; } // no price set - return 0 if ( empty ( $ priceValue ) ) { return 0 ; } return $ priceValue ; }
Returns the valid product price for item

@param object $item
@param string $currency

@return int
Returns the valid product price for item