Beispiel #1
0
 /**
  * @return \Shopware\Bundle\StoreFrontBundle\Struct\Product\Unit
  */
 public function getUnit()
 {
     return $this->rule->getUnit();
 }
 /**
  * Calculates the cheapest price considering the variant min purchase
  * @param Struct\ListProduct $product
  * @param Struct\Product\PriceRule $priceRule
  * @param Struct\ProductContextInterface $context
  * @return Struct\Product\Price
  */
 private function calculateCheapestAvailablePrice(Struct\ListProduct $product, Struct\Product\PriceRule $priceRule, Struct\ProductContextInterface $context)
 {
     $priceRule->setPrice($priceRule->getUnit()->getMinPurchase() * $priceRule->getPrice());
     $priceRule->getUnit()->setPurchaseUnit($priceRule->getUnit()->getMinPurchase() * $priceRule->getUnit()->getPurchaseUnit());
     $priceRule->setPseudoPrice($priceRule->getUnit()->getMinPurchase() * $priceRule->getPseudoPrice());
     $tax = $context->getTaxRule($product->getTax()->getId());
     return $this->calculatePriceStruct($priceRule, $tax, $context);
 }