0

i am trying to get grand total of wishlist item. when we update quantity of wishlist item then total will show in price column and display the all item grand total at bottom. anybody knows answer please help me. your help will be appreciated.

app\design\frontend\rwd\default\template\wishlist\item\list.phtml

<?php
$columns = $this->getColumns();
?>
<table class="clean-table linearize-table" id="wishlist-table">
<thead>
    <tr>
        <?php
            /* @var $column  Mage_Wishlist_Block_Customer_Wishlist_Item_Column */
            foreach ($columns as $column):
                $_blockName = str_replace('.','-',strtolower($column->getNameInLayout()));
        ?>
            <th class="<?php echo $_blockName; ?>"><?php echo $column->getTitle();?></th>
        <?php endforeach; ?>
    </tr>
</thead>
<tbody>
    <?php if (count($this->getItems())): ?>
        <?php foreach ($this->getItems() as $item): ?>
            <tr id="item_<?php echo $item->getId();?>">
                <?php
                    foreach ($columns as $key => $column):
                        $_blockName = str_replace('.','-',strtolower($column->getNameInLayout()));

                        /* Override default column title in layout, useful for certain cases like select all box */
                        if ($column->getRwdTitle()) {
                            $_rwdLabel = $column->getRwdTitle();
                        } else {
                            $_rwdLabel = ($column->getTitle()) ? $column->getTitle() : false;
                        }
                ?>
                    <td class="<?php echo 'wishlist-cell'.$key; ?> <?php echo $_blockName; ?>"<?php if($_rwdLabel): ?> data-rwd-label="<?php echo $_rwdLabel; ?>"<?php endif; ?>><?php $column->setItem($item); echo $column->toHtml($item);?></td>
                <?php endforeach; ?>
            </tr>
        <?php endforeach ?>
    <?php else: ?>
        <td colspan="<?php echo count($columns);?>" class="wishlist-empty"><?php echo $this->__('This quote has no Items');?></td>
    <?php endif; ?>
</tbody>
 </table>
   <?php foreach ($columns as $column): ?>
   <?php echo $column->getAdditionalHtml();?>
   <?php endforeach; ?>
<script type="text/javascript">
   //<![CDATA[
   decorateTable('wishlist-table');

  <?php foreach ($columns as $column): ?>
   <?php echo $column->getJs();?>
  <?php endforeach; ?>
  //]]>

  • I think you have to work on loops to get the total of wishlist there is no core function for getting the total. – Athul Vijayan Jul 18 '17 at 9:12
2

You can achieve this by updating following file. app\design\frontend\YOUR_PACKAGE\YOUR_THEME\template\wishlist\item\list.phtml replace your file code with below.

<?php
$columns = $this->getColumns();
$wishListTotal = 0;
?>
<table class="clean-table linearize-table" id="wishlist-table">
<thead>
    <tr>
        <?php
            /* @var $column  Mage_Wishlist_Block_Customer_Wishlist_Item_Column */
            foreach ($columns as $column):
                $_blockName = str_replace('.','-',strtolower($column->getNameInLayout()));
        ?>
            <th class="<?php echo $_blockName; ?>"><?php echo $column->getTitle();?></th>
        <?php endforeach; ?>
    </tr>
</thead>
<tbody>
    <?php if (count($this->getItems())): ?>
        <?php foreach ($this->getItems() as $item): 
                    $_product = $item->getProduct();
                    $_priceIncludingTax = Mage::helper('tax')->getPrice($_product, $_product->getFinalPrice());
                    $wishListTotal += $item->getQty() * $_priceIncludingTax;?>
            <tr id="item_<?php echo $item->getId();?>">
                <?php
                    foreach ($columns as $key => $column):
                        $_blockName = str_replace('.','-',strtolower($column->getNameInLayout()));

                        /* Override default column title in layout, useful for certain cases like select all box */
                        if ($column->getRwdTitle()) {
                            $_rwdLabel = $column->getRwdTitle();
                        } else {
                            $_rwdLabel = ($column->getTitle()) ? $column->getTitle() : false;
                        }
                ?>
                    <td class="<?php echo 'wishlist-cell'.$key; ?> <?php echo $_blockName; ?>"<?php if($_rwdLabel): ?> data-rwd-label="<?php echo $_rwdLabel; ?>"<?php endif; ?>><?php $column->setItem($item); echo $column->toHtml($item);?></td>
                <?php endforeach; ?>
            </tr>
        <?php endforeach ?>
    <?php else: ?>
        <td colspan="<?php echo count($columns);?>" class="wishlist-empty"><?php echo $this->__('This quote has no Items');?></td>
    <?php endif; ?>
</tbody>
<tfoot style="border-top:1px solid #c0c0c0;">
    <tr>
        <td colspan="3" class="product-name a-right"><?php echo $this->__("Grand Total");?></th>
        <td class="product-name cart-cell"><?php echo Mage::helper('core')->currency($wishListTotal, true, false); ?></th>
        <td colspan="2">&nbsp;</td>
    </tr>
</tfoot>
 </table>
   <?php foreach ($columns as $column): ?>
   <?php echo $column->getAdditionalHtml();?>
   <?php endforeach; ?>
<script type="text/javascript">
   //<![CDATA[
   decorateTable('wishlist-table');

  <?php foreach ($columns as $column): ?>
   <?php echo $column->getJs();?>
  <?php endforeach; ?>
  //]]>
</script>

ADD SUBTOTAL COLUMN

Open app\design\frontend\rwd\default\layout\wishlist.xml and Replace <wishlist_index_index> tag with below code.

<wishlist_index_index translate="label">
    <label>Customer My Account My Wishlist</label>
    <!-- Mage_Wishlist -->
    <update handle="customer_account" />
    <reference name="my.account.wrapper">
        <block type="wishlist/customer_wishlist" name="customer.wishlist" template="wishlist/view.phtml">
            <action method="setTitle" translate="title">
                <title>My Wishlist</title>
            </action>
            <block type="wishlist/customer_wishlist_items" name="customer.wishlist.items" as="items" template="wishlist/item/list.phtml">
                <block type="wishlist/customer_wishlist_item_column_image" name="customer.wishlist.item.image" template="wishlist/item/column/image.phtml" />
                <block type="wishlist/customer_wishlist_item_column_comment" name="customer.wishlist.item.info" template="wishlist/item/column/info.phtml">
                    <block type="wishlist/customer_wishlist_button" name="customer.wishlist.button.update" template="wishlist/button/update.phtml" />
                </block>
                <block type="wishlist/customer_wishlist_item_column_cart" name="customer.wishlist.item.quantity" template="wishlist/item/column/quantity.phtml">
                    <action method="setTitle" translate="title">
                        <title>Qty</title>
                    </action>
                    <block type="wishlist/customer_wishlist_item_options" name="customer.wishlist.item.options" />
                </block>
                <block type="wishlist/customer_wishlist_item_column_cart" name="customer.wishlist.item.price" template="wishlist/item/column/price.phtml">
                    <action method="setTitle" translate="title">
                        <title>Price</title>
                    </action>
                    <block type="wishlist/customer_wishlist_item_options" name="customer.wishlist.item.options" />
                </block>
                <block type="wishlist/customer_wishlist_item_column_cart" name="customer.wishlist.item.subtotal" template="wishlist/item/column/subtotal.phtml">
                    <action method="setTitle" translate="title">
                        <title>Sub Total</title>
                    </action>
                    <block type="wishlist/customer_wishlist_item_options" name="customer.wishlist.item.options" />
                </block>
                <block type="wishlist/customer_wishlist_item_column_cart" name="customer.wishlist.item.cart" template="wishlist/item/column/cart.phtml">
                    <block type="wishlist/customer_wishlist_item_options" name="customer.wishlist.item.options" />
                </block>
                <block type="wishlist/customer_wishlist_item_column_remove" name="customer.wishlist.item.remove" template="wishlist/item/column/remove.phtml" />
            </block>
            <block type="core/text_list" name="customer.wishlist.buttons" as="control_buttons">
                <block type="wishlist/customer_wishlist_button" name="customer.wishlist.button.share" template="wishlist/button/share.phtml" />
                <block type="wishlist/customer_wishlist_button" name="customer.wishlist.button.toCart" template="wishlist/button/tocart.phtml" />
                <block type="wishlist/customer_wishlist_button" name="customer.wishlist.button.update" template="wishlist/button/update.phtml" />
            </block>
        </block>
    </reference>
    <reference name="right">
        <action method="unsetChild"><name>wishlist_customer_sidebar</name></action>
    </reference>
</wishlist_index_index>

Now create a new file app\design\frontend\rwd\default\template\wishlist\item\column\subtotal.phtml with below code.

<?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>
  • it showing only grand total i need to show product list also – Neeya Jul 18 '17 at 10:05
  • @Neeya You mean you need to add a new column which will show sub total of product price and its quantities? – Jaimin Sutariya Jul 18 '17 at 10:10
  • see my list.phtml file update your answer in that – Neeya Jul 18 '17 at 10:13
  • @Neeya, Please check updated answer. Also, do you need to add a new column which will show sub total of product price and its quantities? – Jaimin Sutariya Jul 18 '17 at 10:17
  • 1
    hi please tell me how to display grand total including tax – Neeya Sep 15 '17 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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