本文整理汇总了PHP中Isotope\Isotope::calculatePrice方法的典型用法代码示例。如果您正苦于以下问题:PHP Isotope::calculatePrice方法的具体用法?PHP Isotope::calculatePrice怎么用?PHP Isotope::calculatePrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Isotope\Isotope
的用法示例。
在下文中一共展示了Isotope::calculatePrice方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPrice
/**
* Return calculated price for this shipping method
* @param IsotopeProductCollection
* @return float
*/
public function getPrice(IsotopeProductCollection $objCollection = null)
{
if (null === $objCollection) {
$objCollection = Isotope::getCart();
}
$strPrice = $this->arrData['price'];
if ($this->isPercentage()) {
$fltSurcharge = (double) substr($strPrice, 0, -1);
$fltPrice = $objCollection->subTotal / 100 * $fltSurcharge;
} else {
$fltPrice = (double) $strPrice;
}
//Make Call to UPS API to retrieve pricing
$fltPrice += $this->getLiveRateQuote($objCollection);
return Isotope::calculatePrice($fltPrice, $this, 'fedex', $this->arrData['tax_class']);
}
示例2: getPrice
/**
* Return calculated price for this shipping method
* @return float
*/
public function getPrice(IsotopeProductCollection $objCollection = null)
{
if (null === $objCollection) {
$objCollection = Isotope::getCart();
}
if ($this->isPercentage()) {
$fltPrice = $objCollection->getSubtotal() / 100 * $this->getPercentage();
} else {
$fltPrice = (double) $this->arrData['price'];
}
if ($this->flatCalculation == 'perProduct' || $this->flatCalculation == 'perItem') {
$arrItems = $objCollection->getItems();
$intMultiplier = 0;
foreach ($arrItems as $objItem) {
if (!$objItem->hasProduct() || $objItem->getProduct()->isExemptFromShipping()) {
continue;
}
$intMultiplier += $this->flatCalculation == 'perProduct' ? 1 : $objItem->quantity;
}
$fltPrice = $fltPrice * $intMultiplier;
}
return Isotope::calculatePrice($fltPrice, $this, 'price', $this->arrData['tax_class']);
}
示例3: getPrice
/**
* Return calculated price for this shipping method
* @return float
*/
public function getPrice(IsotopeProductCollection $objCollection = null)
{
if (null === $objCollection) {
$objCollection = Isotope::getCart();
}
if ($this->or_pricing == '1') {
$fltAltPrice = $objCollection->subTotal - $objCollection->subTotal / (1 + floatval($this->alternative_price) / 100);
switch ($this->alternative_price_logic) {
case '1':
//less
$fltPrice = $this->arrData['price'] < $fltAltPrice ? $this->arrData['price'] : $fltAltPrice;
break;
case '2':
//greater
$fltPrice = $this->arrData['price'] > $fltAltPrice ? $this->arrData['price'] : $fltAltPrice;
break;
}
return $fltPrice;
} else {
return $this->arrData['price'];
}
return Isotope::calculatePrice($fltPrice, $this, 'price', $this->arrData['tax_class']);
}
示例4: generateTable
/**
* Generate HTML table for associative array values
* @param array
* @param IsotopeProduct
* @return string
*/
protected function generateTable(array $arrValues, IsotopeProduct $objProduct)
{
$arrFormat = $GLOBALS['TL_DCA']['tl_iso_product']['fields'][$this->field_name]['tableformat'];
$last = count($arrValues[0]) - 1;
$strBuffer = '
<table class="' . $this->field_name . '">
<thead>
<tr>';
foreach (array_keys($arrValues[0]) as $i => $name) {
if ($arrFormat[$name]['doNotShow']) {
continue;
}
$label = $arrFormat[$name]['label'] ? $arrFormat[$name]['label'] : $name;
$strBuffer .= '
<th class="head_' . $i . ($i == 0 ? ' head_first' : '') . ($i == $last ? ' head_last' : '') . (!is_numeric($name) ? ' ' . standardize($name) : '') . '">' . $label . '</th>';
}
$strBuffer .= '
</tr>
</thead>
<tbody>';
foreach ($arrValues as $r => $row) {
$strBuffer .= '
<tr class="row_' . $r . ($r == 0 ? ' row_first' : '') . ($r == $last ? ' row_last' : '') . ' ' . ($r % 2 ? 'odd' : 'even') . '">';
$c = -1;
foreach ($row as $name => $value) {
if ($arrFormat[$name]['doNotShow']) {
continue;
}
if ($arrFormat[$name]['rgxp'] == 'price') {
$intTax = (int) $row['tax_class'];
$value = Isotope::formatPriceWithCurrency(Isotope::calculatePrice($value, $objProduct, $this->field_name, $intTax));
} else {
$value = $arrFormat[$name]['format'] ? sprintf($arrFormat[$name]['format'], $value) : $value;
}
$strBuffer .= '
<td class="col_' . ++$c . ($c == 0 ? ' col_first' : '') . ($c == $i ? ' col_last' : '') . ' ' . standardize($name) . '">' . $value . '</td>';
}
$strBuffer .= '
</tr>';
}
$strBuffer .= '
</tbody>
</table>';
return $strBuffer;
}
示例5: getLowestAmount
/**
* Get lowest amount of all tiers
*
* @param array $arrOptions
*
* @return float
*/
public function getLowestAmount(array $arrOptions = array())
{
if (!$this->hasTiers()) {
return $this->getAmount();
}
return Isotope::calculatePrice(min($this->arrTiers), $this, 'price', $this->tax_class, null, $arrOptions);
}
示例6: getPrice
/**
* Return calculated price for this shipping method
* @return float
*/
public function getPrice(IsotopeProductCollection $objCollection = null)
{
if (null === $objCollection) {
$objCollection = Isotope::getCart();
}
if ($this->isPercentage()) {
$fltPrice = $objCollection->getSubtotal() / 100 * $this->getPercentage();
} else {
$fltPrice = (double) $this->arrData['price'];
}
return Isotope::calculatePrice($fltPrice, $this, 'price', $this->arrData['tax_class']);
}
示例7: getAmount
/**
* Return calculated price for this attribute option
*
* @param float $fltPrice The product base price
* @param int $intTaxClass Tax ID of the product
*
* @return float
*/
public function getAmount($fltPrice, $intTaxClass)
{
if ($this->isPercentage()) {
return $fltPrice / 100 * $this->getPercentage();
}
return Isotope::calculatePrice($this->price, $this, 'price', $intTaxClass);
}
示例8: getPrice
/**
* Return calculated price for this attribute option
*
* @param IsotopeProduct $objProduct
*
* @return float
*/
public function getPrice(IsotopeProduct $objProduct = null)
{
if ($this->isPercentage() && null !== $objProduct) {
/** @type ProductPrice|ProductPrice[] $objPrice */
$objPrice = $objProduct->getPrice();
if (null !== $objPrice) {
if ($objPrice instanceof ProductPriceCollection) {
$fltPrice = null;
foreach ($objPrice as $objPriceModel) {
$fltAmount = $objPriceModel->getAmount();
if (null === $fltPrice || $fltAmount < $fltPrice) {
$fltPrice = $fltAmount;
}
}
} else {
$fltPrice = $objPrice->getAmount();
}
return $fltPrice / 100 * $this->getPercentage();
}
} else {
/** @type ProductPrice|ProductPrice[] $objPrice */
if (null !== $objProduct && ($objPrice = $objProduct->getPrice()) !== null) {
return Isotope::calculatePrice($this->price, $this, 'price', $objPrice->tax_class);
} else {
return Isotope::calculatePrice($this->price, $this, 'price');
}
}
return $this->price;
}