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


PHP Tax::calculate方法代码示例

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


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

示例1: getTotal

 public function getTotal()
 {
     $total = 0;
     foreach ($this->getProducts() as $product) {
         $total += $this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')) * $product['quantity'];
     }
     return $total;
 }
开发者ID:laiello,项目名称:hecart,代码行数:8,代码来源:cart.php

示例2: getById

 public function getById()
 {
     $product_id = $this->request->get['product_id'];
     $this->load->auto('store/product');
     $this->load->auto('image');
     $this->load->auto('tax');
     $this->load->auto('currency');
     $tax = new Tax($this->registry);
     $currency = new Currency($this->registry);
     $strProducts = '';
     $product = $this->modelProduct->getById($product_id);
     $tags = $this->modelProduct->getTags($product_id);
     if (isset($this->request->get['format']) && !empty($this->request->get['format'])) {
         $strProducts .= "Producto: " . $product['name'] . "\n";
         $strProducts .= "Precio: " . $currency->format($tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))) . "\n";
         //TODO: cureency format
         $strProducts .= "URL: " . Url::createUrl("product/product", array("product_id" => $product['product_id']), "NONSSL", HTTP_CATALOG . "/");
         if ($tags) {
             foreach ($tags as $key => $tag) {
                 $ntag = $key + 1;
                 $strProducts .= "\nTag " . $ntag . ": " . Url::createUrl("product/search", array("keyword" => $tag['tag']), "NONSSL", HTTP_CATALOG . "/") . "\n";
             }
         }
         $strProducts .= "\n";
         echo $strProducts;
     } else {
         $strProducts .= "<div style='margin:5px;padding:3px;background:#FFF;float:left;border:dotted 1px #ccc;width:100px;display:block;text-align:center'>";
         $strProducts .= "<br><p><a href='" . Url::createUrl("product/product", array("product_id" => $product['product_id']), "NONSSL", HTTP_CATALOG . "/") . "'>" . $product['name'] . "</a></p>";
         if (empty($product['image'])) {
             $strProducts .= "<a href='" . Url::createUrl("product/product", array("product_id" => $product['product_id']), "NONSSL", HTTP_CATALOG . "/") . "'>";
             $strProducts .= "<img src='" . NTImage::resizeAndSave('no_image.jpg', 50, 50) . "' alt='" . $product['name'] . "'>";
             $strProducts .= "</a>";
         } else {
             $strProducts .= "<a href='" . Url::createUrl("product/product", array("product_id" => $product['product_id'])) . "'>";
             $strProducts .= "<img src='" . NTImage::resizeAndSave($product['image'], 50, 50) . "' alt='" . $product['name'] . "'>";
             $strProducts .= "</a>";
         }
         $strProducts .= "<input type='hidden' name='" . $product['product_id'] . "' value='" . $product['product_id'] . "'>";
         $strProducts .= "<br><b>" . $currency->format($tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))) . "</b><br>";
         if ($tags) {
             foreach ($tags as $key => $tag) {
                 $strProducts .= "&nbsp;&nbsp;<a href='" . Url::createUrl("product/search", array("keyword" => $tag['tag']), "NONSSL", HTTP_CATALOG . "/") . "' style='font:normal 9px verdana'>" . $tag['tag'] . "</a>&nbsp;&nbsp;";
             }
         }
         $strProducts .= "<br></div>";
         echo $strProducts;
     }
 }
开发者ID:josueaponte7,项目名称:necotienda_standalone,代码行数:48,代码来源:newsletter.php


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