/** * Get formatted by currency tier price * * @param float $qty * @param Product $product * @return array|float * @deprecated */ public function getFormatedTierPrice($qty, $product) { $price = $product->getTierPrice($qty); if (is_array($price)) { foreach (array_keys($price) as $index) { $price[$index]['formated_price'] = $this->priceCurrency->convertAndFormat($price[$index]['website_price']); } } else { $price = $this->priceCurrency->format($price); } return $price; }
/** * Apply tier price for bundle * * @param \Magento\Catalog\Model\Product $product * @param float $qty * @param float $finalPrice * @return float */ protected function _applyTierPrice($product, $qty, $finalPrice) { if ($qty === null) { return $finalPrice; } $tierPrice = $product->getTierPrice($qty); if (is_numeric($tierPrice)) { $tierPrice = $finalPrice - $finalPrice * ($tierPrice / 100); $finalPrice = min($finalPrice, $tierPrice); } return $finalPrice; }
/** * See detailed tests at \Magento\Catalog\Model\Product\Type*_PriceTest */ public function testGetTierPrice() { $this->assertEquals([], $this->_model->getTierPrice()); }
/** * {@inheritdoc} */ public function getTierPrice($qty = null) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getTierPrice'); if (!$pluginInfo) { return parent::getTierPrice($qty); } else { return $this->___callPlugins('getTierPrice', func_get_args(), $pluginInfo); } }
/** * Get formatted by currency tier price * * @param float $qty * @param Product $product * @return array|float * @deprecated */ public function getFormatedTierPrice($qty, $product) { $price = $product->getTierPrice($qty); if (is_array($price)) { foreach (array_keys($price) as $index) { $price[$index]['formated_price'] = $this->_storeManager->getStore()->convertPrice($price[$index]['website_price'], true); } } else { $price = $this->_storeManager->getStore()->formatPrice($price); } return $price; }