1

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>

2 Answers 2

1

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>
2
  • i have added screenshot please have a look
    – Neeya
    Commented Sep 9, 2017 at 6:59
  • so you need tax like sutotal from subtotal column -(minus) product price from price column... ? right? Commented Sep 9, 2017 at 7:01
1

Please add this code at your wishlist template

    echo $this->getLayout()->createBlock('catalog/product')->getPriceHtml($_product);
7
  • it showing error in Call to a member function getProductId() on a non-object in app\code\core\Mage\Catalog\Block\Pro‌​duct.php
    – Neeya
    Commented Sep 9, 2017 at 5:45
  • Update your code, i can not say about issue anything untll you does post a code Commented Sep 9, 2017 at 5:58
  • please see updated post
    – Neeya
    Commented Sep 9, 2017 at 6:02
  • ok, i will update in some time.... Commented Sep 9, 2017 at 6:07
  • Please read above answer. Commented Sep 9, 2017 at 6:50

Your Answer

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

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