【问题标题】:magento add tax on custom attribute based pricemagento 对基于自定义属性的价格加税
【发布时间】:2013-06-28 06:39:35
【问题描述】:

我们销售一堆产品,我们需要显示每个价格的产品和整个盒子的价格。因此,我创建了每个价格的属性并在产品页面上调用它。所以产品的主要价格将是盒子价格和每个价格将从属性显示。但是现在我添加税时,我可以看到包含税和不含税的主要价格,但是如何将该税应用于基于属性的价格?

这将是每个产品的价格

<?php echo $_product->getResource()->getAttribute('each_price')->getFrontend()-  >getValue($_product)?>

这将是整箱价格

   <?php echo $this->getPriceHtml($_product, true);?>

【问题讨论】:

    标签: magento attributes


    【解决方案1】:

    可以做一些类似的事情来实现这个。请看下面的代码

      <?php $txrate= $_product->getData('tax_percent');
                       if($txrate!=""):
                       echo '<div class="each-inc-tax">';
                         $ech_price= $_product->getResource()->getAttribute('each_price')->getFrontend()->getValue($_product);
                         $tx=($txrate*$ech_price)/100;
                         $each_tax=$ech_price+$tx;
                         echo  ' <b>Each Price Including Tax:</b> <b>'. $each_tax.'</b>';
                        echo '</div>';
                       endif;
    

    【讨论】:

      【解决方案2】:

      我在我的 magento 中使用 MSRP 属性并存储不包括税的值,但希望在前端显示包括税。

      我使用了以下代码...

      <?php
      $_finalPriceExclTax = $this->helper('tax')->getPrice($_product, $_product->getPrice(), false);
      $_finalPriceInclTax = $this->helper('tax')->getPrice($_product, $_product->getFinalPrice(), true);
      $_taxpercent = $_finalPriceInclTax / $_finalPriceExclTax;
      $_msrpPrice = $_product->getMsrp() * $_taxpercent;
      ?>
      

      【讨论】:

        猜你喜欢
        • 2012-11-30
        • 1970-01-01
        • 1970-01-01
        • 2013-04-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-02-06
        相关资源
        最近更新 更多