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


PHP Shopp::roundprice方法代码示例

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


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

示例1: roundprice

/**
 * @deprecated Use Shopp::roundprice()
 **/
function roundprice($amount, $format = array())
{
    return Shopp::roundprice($amount, $format);
}
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:7,代码来源:Core.php

示例2: variant

 /**
  * Provides product varient input markup or properties for the current variant in the variants loop
  *
  * Used with `shopp('product.variants')` looping.
  *
  * @api `shopp('product.variant')`
  * @since 1.1
  *
  * @param string       $result  The output
  * @param array        $options The options
  * - **discounts**: `on` (on,off) When used with the **saleprice** property, shows the discounted price of the variant
  * - **input**: `null` (text,checkbox,radio,hidden) Sets the type of input to create
  * - **money**: `on` (on, off) Format the amount in the current currency format
  * - **number**: `off` (on, off) Provide the unformatted number (floating point)
  * - **separator**: ` ` The separator to use between properties when requesting multiple properties
  * - **taxes**: `null` (on,off) Include or exclude taxes from prices
  * - **units**: `on` (on,off) Include the weight unit when weight is requested as a property
  * @param ShoppProduct $O       The working object
  * @return string The variant input markup or property value
  **/
 public static function variant($result, $options, $O)
 {
     $defaults = array('discounts' => 'on', 'money' => 'on', 'number' => 'off', 'separator' => ' ', 'taxes' => null, 'units' => 'on');
     $options = array_merge($defaults, $options);
     extract($options, EXTR_SKIP);
     if (isset($promos)) {
         $discounts = $promos;
     }
     // support for deprecated `promos` option
     $weightunit = Shopp::str_true($units) ? shopp_setting('weight_unit') : '';
     $variation = current($O->prices);
     $taxes = isset($taxes) ? Shopp::str_true($taxes) : null;
     $_ = array();
     if (array_key_exists('id', $options)) {
         $_[] = $variation->id;
     }
     if (array_key_exists('label', $options)) {
         $_[] = $variation->label;
     }
     if (array_key_exists('type', $options)) {
         $_[] = $variation->type;
     }
     if (array_key_exists('sku', $options)) {
         $_[] = $variation->sku;
     }
     if (array_key_exists('stock', $options)) {
         $_[] = $variation->stock;
     }
     if (array_key_exists('price', $options)) {
         $price = Shopp::roundprice(self::_taxed((double) $variation->price, $O, $variation->tax, $taxes));
         if (Shopp::str_true($money)) {
             $_[] = money($price);
         } else {
             $_[] = $price;
         }
     }
     if (array_key_exists('saleprice', $options)) {
         $saleprice = Shopp::str_true($discounts) ? $variation->promoprice : $variation->saleprice;
         $saleprice = Shopp::roundprice(self::_taxed((double) $saleprice, $O, $variation->tax, $taxes));
         if (Shopp::str_true($money)) {
             $_[] = money($saleprice);
         } else {
             $_[] = $saleprice;
         }
     }
     if (array_key_exists('weight', $options)) {
         $_[] = round($variation->weight, 3) . ($weightunit ? " {$weightunit}" : false);
     }
     if (array_key_exists('shipfee', $options)) {
         $shipfee = Shopp::roundprice($variation->shipfee);
         if (Shopp::str_true($money)) {
             $_[] = money($shipfee);
         } else {
             $_[] = $shipfee;
         }
     }
     if (array_key_exists('sale', $options)) {
         return Shopp::str_true($variation->sale);
     }
     if (array_key_exists('shipping', $options)) {
         return Shopp::str_true($variation->shipping);
     }
     if (array_key_exists('tax', $options)) {
         return Shopp::str_true($variation->tax);
     }
     if (array_key_exists('inventory', $options)) {
         return Shopp::str_true($variation->inventory);
     }
     return join($separator, $_);
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:90,代码来源:product.php

示例3: _money

 /**
  * Filter callback to add standard monetary option behaviors
  *
  * @internal
  * @since 1.2
  *
  * @param string        $result    The output
  * @param array         $options   The options
  * - **money**: `on` (on, off) Format the amount in the current currency format
  * - **number**: `off` (on, off) Provide the unformatted number (floating point)
  * @param string    $property  The tag property name
  * @param ShoppPurchase $O         The working object
  * @return ShoppPurchase The active ShoppPurchase context
  **/
 public static function _money($result, $options, $property, $O)
 {
     // Passthru for non-monetary results
     $monetary = array('freight', 'subtotal', 'discount', 'shipping', 'itemaddon', 'itemtotal', 'itemunitprice', 'tax', 'total');
     if (!in_array($property, $monetary) || !is_numeric($result)) {
         return $result;
     }
     // Special case for purchase.item-addon `unitprice` option
     if ('itemaddon' == $property && !in_array('uniprice', $options)) {
         return $result;
     }
     // @deprecated currency parameter
     if (isset($options['currency'])) {
         $options['money'] = $options['currency'];
     }
     $defaults = array('money' => 'on', 'number' => false);
     $options = array_merge($defaults, $options);
     extract($options);
     if (Shopp::str_true($number)) {
         return $result;
     }
     if (Shopp::str_true($money)) {
         $result = Shopp::money(Shopp::roundprice($result));
     }
     return $result;
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:40,代码来源:purchase.php


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