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


PHP Shopp::taxrates方法代码示例

本文整理汇总了PHP中Shopp::taxrates方法的典型用法代码示例。如果您正苦于以下问题:PHP Shopp::taxrates方法的具体用法?PHP Shopp::taxrates怎么用?PHP Shopp::taxrates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shopp的用法示例。


在下文中一共展示了Shopp::taxrates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _taxed

 /**
  * Helper to apply or exclude taxes from a single amount based on inclusive tax settings and the tax option
  *
  * @author Jonathan Davis
  * @since 1.3
  *
  * @param float $amount The amount to add taxes to, or exclude taxes from
  * @param ShoppProduct $O The product to get properties from
  * @param boolean $istaxed Whether the amount can be taxed
  * @param boolean $taxoption The Theme API tax option given the the tag
  * @param array $taxrates A list of taxrates that apply to the product and amount
  * @return float The amount with tax added or tax excluded
  **/
 private static function _taxed($amount, ShoppProduct $O, $istaxed, $taxoption = null, array $taxrates = array())
 {
     if (!$istaxed) {
         return $amount;
     }
     if (empty($taxrates)) {
         $taxrates = Shopp::taxrates($O);
     }
     if (isset($taxoption)) {
         $taxoption = Shopp::str_true($taxoption);
     }
     $inclusivetax = self::_inclusive_taxes($O);
     if ($inclusivetax) {
         $adjustment = ShoppTax::adjustment($taxrates);
         if (1 != $adjustment && false !== $taxoption) {
             // Only adjust when taxes are not excluded @see #3041
             return (double) ($amount / $adjustment);
         }
     }
     // Handle inclusive/exclusive tax presentation options (product editor setting or api option)
     // If the 'taxes' option is specified and the item either has inclusive taxes that apply,
     // or the 'taxes' option is forced on (but not both) then handle taxes by either adding or excluding taxes
     // This is an exclusive or known as XOR, the lesser known brother of Thor that gets left out of the family get togethers
     if (isset($taxoption) && $inclusivetax ^ $taxoption) {
         if ($taxoption) {
             return ShoppTax::calculate($taxrates, (double) $amount);
         } else {
             return ShoppTax::exclusive($taxrates, (double) $amount);
         }
     }
     return $amount;
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:45,代码来源:product.php


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