当前位置: 首页>>代码示例>>PHP>>正文


PHP Isotope::calculatePrice方法代码示例

本文整理汇总了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']);
 }
开发者ID:rhymedigital,项目名称:isotope_fedexshipping,代码行数:21,代码来源:FedEx.php

示例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']);
 }
开发者ID:Aziz-JH,项目名称:core,代码行数:27,代码来源:Flat.php

示例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']);
 }
开发者ID:intelligentspark,项目名称:isotope_shipping_zones_advanced,代码行数:27,代码来源:ZonesAdvanced.php

示例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;
    }
开发者ID:bytehead,项目名称:core,代码行数:51,代码来源:Attribute.php

示例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);
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:14,代码来源:ProductPrice.php

示例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']);
 }
开发者ID:Aziz-JH,项目名称:core,代码行数:16,代码来源:Shipping.php

示例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);
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:15,代码来源:AttributeOption.php

示例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;
 }
开发者ID:rpquadrat,项目名称:core,代码行数:36,代码来源:AttributeOption.php


注:本文中的Isotope\Isotope::calculatePrice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。