Question

I wants to display tax rate of each wishlist item. when we open wishlist it should be display tax rate in front of each product. i.e i need to one extra column of wishlist page. i already tried this How to get Tax Rate for a product but no result so please help.thanks in advance.

<?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>

Updated

enter image description here

subtotal.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>
Was it helpful?

Solution

Please follow this instructions.

Add below code at app/design/frontend/package(your package)/theme(your theme)/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>

After Add below code at app/design/frontend/package(your package)/theme(your theme)/template/wishlist/item/column/taxrates.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>

OTHER TIPS

Please add this code at your wishlist template

    echo $this->getLayout()->createBlock('catalog/product')->getPriceHtml($_product);
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top