6
votes

Original prices not showing on sales order view in magento 1.8.1?

Dear all my original price is 299 and sell sell price is 149 but in original price and sale price showing same 149 what do for viewing original price? my code is here kindly help me for how to display original price app\design\adminhtml\default\default\template\sales\order\view\items\renderer/default.phtml

enter link description here
(source: suditi.in)

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     default_default
 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php $_item = $this->getItem() ?>
<?php $this->setPriceDataObject($_item) ?>
<tr<?php if (!$this->canDisplayGiftmessage()): ?> class="border"<?php endif; ?>>
    <td>
        <?php if ($this->canDisplayContainer()): ?>
        <div id="<?php echo $this->getHtmlId() ?>" class="item-container">
        <?php endif; ?>
        <div class="item-text">
            <?php echo $this->getColumnHtml($_item, 'name') ?>
        </div>
        <?php if ($this->canDisplayContainer()): ?>
        </div>
        <?php endif ?>
    </td>
    <td class="a-center"><?php echo $_item->getStatus() ?></td>
    <td class="a-right"><?php echo $this->displayPriceAttribute('original_price') ?></td>
    <td class="a-right">
        <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
            <span class="price-excl-tax">
                <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
                    <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
                <?php endif; ?>

                <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
                    <?php
                    echo $this->displayPrices(
                        $_item->getBasePrice()+$_item->getBaseWeeeTaxAppliedAmount()+$_item->getBaseWeeeTaxDisposition(),
                        $_item->getPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()
                    );
                    ?>
                <?php else: ?>
                    <?php echo $this->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?>
                <?php endif; ?>


                <?php if (Mage::helper('weee')->getApplied($_item)): ?>
                    <br />
                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></small></span>
                        <?php endforeach; ?>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php endif; ?>

                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <br />
                        <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br />
                        <?php
                        echo $this->displayPrices(
                            $_item->getBasePrice()+$_item->getBaseWeeeTaxAppliedAmount()+$_item->getBaseWeeeTaxDisposition(),
                            $_item->getPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()
                        );
                        ?>
                        </span>
                    <?php endif; ?>
                <?php endif; ?>
            </span>
            <br />
        <?php endif; ?>
        <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
            <span class="price-incl-tax">
                <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
                    <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
                <?php endif; ?>
                <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
                <?php $_baseIncl = $this->helper('checkout')->getBasePriceInclTax($_item); ?>

                <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
                    <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
                <?php else: ?>
                    <?php echo $this->displayPrices($_baseIncl-$_item->getBaseWeeeTaxDisposition(), $_incl-$_item->getWeeeTaxDisposition()) ?>
                <?php endif; ?>

                <?php if (Mage::helper('weee')->getApplied($_item)): ?>
                    <br />
                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></small></span>
                        <?php endforeach; ?>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php endif; ?>

                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <br />
                        <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseWeeeTaxInclTax($_item) , $_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
                    <?php endif; ?>
                <?php endif; ?>
            </span>
        <?php endif; ?>

    </td>
    <td><?php echo $this->getColumnHtml($_item, 'qty') ?></td>

    <td class="a-right">
        <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
            <span class="price-excl-tax">
                <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
                    <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
                <?php endif; ?>

                <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
                    <?php
                    echo $this->displayPrices(
                        $_item->getBaseRowTotal()+$_item->getBaseWeeeTaxAppliedRowAmount()+$_item->getBaseWeeeTaxRowDisposition(),
                        $_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()
                    );
                    ?>
                <?php else: ?>
                    <?php echo $this->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
                <?php endif; ?>


                <?php if (Mage::helper('weee')->getApplied($_item)): ?>
                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></small></span>
                        <?php endforeach; ?>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php endif; ?>

                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <br />
                        <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br />
                        <?php
                        echo $this->displayPrices(
                            $_item->getBaseRowTotal()+$_item->getBaseWeeeTaxAppliedRowAmount()+$_item->getBaseWeeeTaxRowDisposition(),
                            $_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()
                        );
                        ?>
                        </span>
                    <?php endif; ?>
                <?php endif; ?>
            </span>
            <br />
        <?php endif; ?>
        <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
            <span class="price-incl-tax">
                <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
                    <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
                <?php endif; ?>
                <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
                <?php $_baseIncl = $this->helper('checkout')->getBaseSubtotalInclTax($_item); ?>
                <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
                    <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseRowWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
                <?php else: ?>
                    <?php echo $this->displayPrices($_baseIncl-$_item->getBaseWeeeTaxRowDisposition(), $_incl-$_item->getWeeeTaxRowDisposition()) ?>
                <?php endif; ?>


                <?php if (Mage::helper('weee')->getApplied($_item)): ?>

                    <br />
                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></small></span>
                        <?php endforeach; ?>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php endif; ?>

                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <br /><span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseRowWeeeTaxInclTax($_item),$_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
                    <?php endif; ?>
                <?php endif; ?>
            </span>
        <?php endif; ?>
    </td>
    <td class="a-right"><?php echo $this->displayPriceAttribute('tax_amount') ?></td>
    <td class="a-right"><?php echo $this->displayTaxPercent($_item) ?></td>
    <td class="a-right"><?php echo $this->displayPriceAttribute('discount_amount') ?></td>
    <td class="a-right last">
        <?php echo $this->displayPrices(
            $_item->getBaseRowTotal() + $_item->getBaseTaxAmount() + $_item->getBaseHiddenTaxAmount() + Mage::helper('weee')->getBaseRowWeeeAmountAfterDiscount($_item) - $_item->getBaseDiscountAmount(),
            $_item->getRowTotal() + $_item->getTaxAmount() + $_item->getHiddenTaxAmount() + Mage::helper('weee')->getRowWeeeAmountAfterDiscount($_item) - $_item->getDiscountAmount()
        ); ?>
    </td>
</tr>
1
you have to show some code through which you are getting original price is 299 and sell sell price is 149 , or show it somewhere live. then only anyone can help you. this much text not going to help you in any manner.Anant Kumar Singh
Hi anant Kumar singh i put codeuser4472956
also can you comment on which line you are getting your original and sell price.no need of that much code. just 4-5 lines where that price is comming.Anant Kumar Singh
Indent your code, not your question text.deceze
Are you sure that the provided code is actually producing the output and that it has not been overridden by a file in local? You shouldn't be editing the core file directly anyhow.Jon Holland

1 Answers

1
votes

Edit: Added a simplified answer at the bottom. My explanation is a bit confusing without it.

Welcome to the confusion that is Magento. The Original Price and Price that is displaying in your order is actually correct. For a very quick answer as to why that is Click Here and view a blog entry that briefly explains it. For more details read on:

A products original price is calculated in steps. If an item is a simple product that does not belong to a configurable product or group, calculation ends. Whatever is in the price tab of that product is used; Price, Special Price, MSRP, and so on.

If a product is part of a configurable product then extra steps are taken. Basically the products price tab is ignored and the price tab of the configurable product is used as a starting point. Then the configurable product checks its associated products tab and performs the appropriate calculations.


Example:
Here is an example from my website using a mattress (9LTXMT-004) that as a simple product cost $1203 (That would be its original price). However, I have added this product to a configurable product (Parent) and set that cost as $782. So now $782 overrides $1203 as my original cost and then the calculations (If any) from the associated products tab are added to this. In my case (pictures below) it adds $472 to the configurable products price and this becomes the Original Price of the product, $1254. Not $1675 which would be the simple products price + the extra $472 from the configurable product.

Magento configurable product associated product tab

Here you see (Pt. 1) the original price as I explained. And you also so (Pt. 2) what your order should look like if they used a discount code. This too is normal Magento operation. Order placed in Magento


Back to the Answer:
Original Price and Price will always display what Magento calculated the cost to the user as. In your post you told us that its sell price is $149 so that is exactly what it will display to you in an order. The only time Original Price and Price will differ is if you apply an admin side discount on the product. So after Magento calculates the cost you would have a rule (maybe a promotion?) that gives uses say a 10% discount on the original price.

You should be able to print reports though that show this difference. "Customer X bought product Y for $$$ but it really cost $$$". If you can not find a report already built into Magento to do this already it is not to much work to create your own report and add it to the system vs. hacking the core code to get this unusual feature added.

I get your point though. It would be nice to just have the true original product price and what we sold it as on the order page because that is what we invoice and print. But that is not default Magento. Maybe you should request it to Magento Community Developers.

Edit, Simplified Answer:

What you are asking for in your post is not the default Magento way of displaying prices; see explanations above. You only have three options:

  1. Code your own solution; a custom extension or hack the core code (not recommended)
  2. Create your own report that can be generated by Magento. May not be what you want but is the proper way to handle this type of situation.
  3. Ask in the Magento CE forums to have this feature added.