Отображать налоговую ставку каждого списка пожеланий в magento?


Я хочу отобразить налоговую ставку для каждого элемента списка пожеланий. когда мы открываем список пожеланий, перед каждым товаром должна отображаться ставка налога. т. е. мне нужна одна дополнительная колонка на странице списка пожеланий. я уже пробовал это Как получить налоговую ставку для продукта, но результата нет, поэтому, пожалуйста, помогите. заранее спасибо.

<?php if ($this->helper('wishlist')->isAllow()) : ?>
<div class="my-wishlist">
    <div class="page-title title-buttons">
        <?php if ($this->helper('wishlist')->isRssAllow() && $this->hasWishlistItems()): ?>
            <a href="<?php echo $this->helper('wishlist')->getRssUrl($this->getWishlistInstance()->getId()); ?>" class="link-rss"><?php echo $this->__('RSS Feed') ?></a>
        <?php endif; ?>
        <h1><?php echo $this->getTitle(); ?></h1>
    </div>
    <?php echo $this->getMessagesBlock()->toHtml() ?>

    <form id="wishlist-view-form" action="<?php echo $this->getUrl('*/*/update', array('wishlist_id' => $this->getWishlistInstance()->getId())) ?>" method="post">
        <?php echo $this->getChildHtml('top'); ?>
        <div class="fieldset">
            <?php if ($this->hasWishlistItems()): ?>
                    <?php echo $this->getBlockHtml('formkey');?>
                    <?php $this->getChild('items')->setItems($this->getWishlistItems()); ?>
                    <?php echo $this->getChildHtml('items');?>
                    <script type="text/javascript">decorateTable('wishlist-table')</script>
            <?php else: ?>
                <p class="wishlist-empty"><?php echo $this->__('You have no items in your quote.') ?></p>
            <?php endif ?>
            <div class="buttons-set buttons-set2">
                <?php echo $this->getChildHtml('control_buttons');?>
            </div>
        </div>
    </form>

    <form id="wishlist-allcart-form" action="<?php echo $this->getUrl('*/*/allcart') ?>" method="post">
        <?php echo $this->getBlockHtml('formkey') ?>
        <div class="no-display">
            <input type="hidden" name="wishlist_id" id="wishlist_id" value="<?php echo $this->getWishlistInstance()->getId() ?>" />
            <input type="hidden" name="qty" id="qty" value="" />
        </div>
    </form>

    <script type="text/javascript">
    //<![CDATA[
        var wishlistForm = new Validation($('wishlist-view-form'));
        var wishlistAllCartForm = new Validation($('wishlist-allcart-form'));

        function calculateQty() {
            var itemQtys = new Array();
            $$('#wishlist-view-form .qty').each(
                function (input, index) {
                    var idxStr = input.name;
                    var idx = idxStr.replace( /[^\d.]/g, '' );
                    itemQtys[idx] = input.value;
                }
            );

            $$('#qty')[0].value = JSON.stringify(itemQtys);
        }

        function addAllWItemsToCart() {
            calculateQty();
            wishlistAllCartForm.form.submit();
        }
    //]]>
    </script>
</div>
<?php echo $this->getChildHtml('bottom'); ?>
<div class="buttons-set">
    <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
</div>

Обновлено

enter image description here

Промежуточный итог.phtml

<?php
$item = $this->getItem();
$product = $item->getProduct();
$options = $this->getChild('customer.wishlist.item.options')
->setItem($item)
->getConfiguredOptions();
$_product = $item->getProduct();
$_priceIncludingTax = Mage::helper('tax')->getPrice($_product, $_product->getFinalPrice());
$wishListTotal = $item->getQty() * $_priceIncludingTax;
?>
<div class="cart-cell">
<div class="price-box">
    <span class="regular-price" id="product-price-<?php echo $item->getId(); ?>">
        <span class="price"><?php echo Mage::helper('core')->currency($wishListTotal, true, false);?></span>
    </span>
</div>

</div>
Author: Neeya, 2017-09-07

2 answers

Пожалуйста, следуйте этим инструкциям.

Добавьте приведенный ниже код в приложение/дизайн/интерфейс/пакет (ваш пакет)/тема (ваша тема)/layout/wishlist.xml

 <wishlist_index_index translate="label"> 
   <reference name="customer.wishlist.items">
       <!-- Column display tax rates -->
       <block type="wishlist/customer_wishlist_item_column_cart" name="customer.wishlist.item.taxrates" template="wishlist/item/column/taxrates.phtml">
          <action method="setTitle" translate="title">
              <title>Tax Rate</title>
          </action>
         <block type="wishlist/customer_wishlist_item_options" name="customer.wishlist.item.options" />
       </block>
       <!-- Column display tax rates -->
      </reference>
 </wishlist_index_index>

После добавления кода ниже в приложение/дизайн/интерфейс/пакет (ваш пакет)/тема (ваша тема)/шаблон/список пожеланий/элемент/столбец/налоговые ставки.phtml

    <?php
    /* @var $this Mage_Wishlist_Block_Customer_Wishlist_Item_Column_Cart */
    /* @var Mage_Wishlist_Model_Item $item */
    $item = $this->getItem();
    $product = $item->getProduct();
    ?>
    <div class="cart-cell">
        <?php
            $store = Mage::app()->getStore('default');
            $taxCalculation = Mage::getModel('tax/calculation');
            $request = $taxCalculation->getRateRequest(null, null, null, $store);
            $taxClassId = $product->getTaxClassId();
            $percent = $taxCalculation->getRate($request->setProductClassId($taxClassId));
            echo $percent.'%';

            $taxClassId = $product->getData("tax_class_id");
            $taxClasses = Mage::helper("core")->jsonDecode(Mage::helper("tax")->getAllRatesByProductClass());
            $taxRate = $taxClasses["value_" . $taxClassId];
            echo $taxRate;
        ?>
    </div>
 1
Author: Padhiyar Gaurang, 2017-09-09 06:42:59

Пожалуйста, добавьте этот код в свой шаблон списка пожеланий

    echo $this->getLayout()->createBlock('catalog/product')->getPriceHtml($_product);
 1
Author: Padhiyar Gaurang, 2017-09-09 05:27:03