WellCommerce\Bundle\ProductBundle\Entity\ProductInterface::getBuyPrice PHP Method

getBuyPrice() public method

public getBuyPrice ( ) : Price
return WellCommerce\Bundle\AppBundle\Entity\Price
    public function getBuyPrice() : Price;

Usage Example

コード例 #1
0
 /**
  * Recalculates buy prices for product
  *
  * @param ProductInterface $product
  */
 protected function refreshProductBuyPrices(ProductInterface $product)
 {
     $buyPrice = $product->getBuyPrice();
     $grossAmount = $buyPrice->getGrossAmount();
     $taxRate = $product->getBuyPriceTax()->getValue();
     $netAmount = TaxHelper::calculateNetPrice($grossAmount, $taxRate);
     $buyPrice->setTaxRate($taxRate);
     $buyPrice->setTaxAmount($grossAmount - $netAmount);
     $buyPrice->setNetAmount($netAmount);
 }