本文整理匯總了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;
}