0

I wants to show tax percentage of each item on wishlist page.

This is my wishlist product div please suggest me how to show tax percentage for each item.

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

Thanks in advance

1
  • anybody have any idea? please help
    – Neeya
    Aug 29, 2017 at 9:26

1 Answer 1

1

For showing tax rate for each item you need to modify different phtml

('app/design/frontend/base/dafault/template/wishlist/item/list.phtml'). Inside foreach loop of wishlist items you need to write below code:

$product = Mage::getModel('catalog/product')->load($item->getProductId());
$store = Mage::app()->getStore('default');
$request = Mage::getSingleton('tax/calculation')->getRateRequest(null, null, null, $store);
$tax_class_id = $product->getData('tax_class_id');
$rate = Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($tax_class_id));

You will get tax rate in $rate variable.

3
  • i showing error like "Call to a member function getProductId() on a non-object"
    – Neeya
    Aug 31, 2017 at 7:37
  • please update same code in my file
    – Neeya
    Aug 31, 2017 at 7:38
  • please resolve my issue
    – Neeya
    Sep 6, 2017 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.