本文整理汇总了PHP中Magento\Catalog\Model\Product::getTierPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getTierPrice方法的具体用法?PHP Product::getTierPrice怎么用?PHP Product::getTierPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Model\Product
的用法示例。
在下文中一共展示了Product::getTierPrice方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFormatedTierPrice
/**
* 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;
}
示例2: _applyTierPrice
/**
* 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;
}
示例3: testGetTierPrice
/**
* See detailed tests at \Magento\Catalog\Model\Product\Type*_PriceTest
*/
public function testGetTierPrice()
{
$this->assertEquals([], $this->_model->getTierPrice());
}
示例4: 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);
}
}
示例5: getFormatedTierPrice
/**
* 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;
}