magento 1.8.1 的销售订单视图中未显示原始价格?
Posted
技术标签:
【中文标题】magento 1.8.1 的销售订单视图中未显示原始价格?【英文标题】:Original prices not showing on sales order view in magento 1.8.1? 【发布时间】:2015-06-18 14:54:04 【问题描述】:亲爱的,我的原价是299,卖价是149,但原价和售价显示相同的149,查看原价怎么办?我的代码在这里请帮助我如何显示原价 app\design\adminhtml\default\default\template\sales\order\view\items\renderer/default.phtml
(来源: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 license@magentocommerce.com 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>
【问题讨论】:
你必须显示一些代码,通过这些代码你得到原始价格是 299 和卖卖价格是 149 ,或者在现场展示它。那么只有任何人可以帮助你。这么多文字对您没有任何帮助。 嗨 anant Kumar singh 我输入了代码 你也可以评论你在哪一行得到你的原始价格和售价。不需要那么多代码。价格只有 4-5 行。 缩进你的代码,而不是你的问题文本。 您确定所提供的代码实际上正在生成输出并且它没有被本地文件覆盖吗?无论如何,您不应该直接编辑核心文件。 【参考方案1】:编辑:在底部添加了一个简化的答案。没有它我的解释有点混乱。
欢迎来到 Magento 的困惑。您订单中显示的原始价格和价格实际上是正确的。要快速回答为什么是Click Here,并查看简要解释它的博客条目。更多详情请阅读:
产品原价是分步计算的。如果项目是不属于可配置产品或组的简单产品,则计算结束。使用该产品价格标签中的任何内容;价格、特价、建议零售价等。
如果产品是可配置产品的一部分,则需要采取额外的步骤。基本上,产品价格选项卡被忽略,可配置产品的价格选项卡用作起点。然后可配置产品检查其关联的产品选项卡并执行适当的计算。
示例: 这是我网站上使用床垫(9LTXMT-004)的一个例子,作为一个简单的产品,售价为 1203 美元(这将是它的原价)。但是,我已将此产品添加到可配置产品(父级)中,并将成本设置为 782 美元。因此,现在 782 美元覆盖了 1203 美元作为我的原始成本,然后将相关产品选项卡中的计算(如果有)添加到此。在我的例子中(下图),它为可配置产品的价格增加了 472 美元,这成为产品的原价,即 1254 美元。不是 1675 美元,这将是简单产品的价格 + 可配置产品的额外 472 美元。
您在这里看到 (Pt. 1) 我解释的原价。如果他们使用折扣代码,您也可以(第 2 部分)您的订单应该是什么样子。这也是正常的 Magento 操作。
回到答案: 原始价格和价格将始终显示 Magento 计算给用户的成本。在您的帖子中,您告诉我们它的售价是 149 美元,所以这正是它将在订单中显示给您的价格。唯一一次原始价格和价格会有所不同的是,如果您对产品应用管理员方面的折扣。因此,在 Magento 计算出成本之后,您将有一个规则(可能是促销?),它为用户提供比原价 10% 的折扣。
您应该能够打印显示这种差异的报告。 “客户 X 以 $$$ 购买了产品 Y,但它确实花了 $$$”。如果您找不到已经内置于 Magento 的报告来执行此操作,那么创建您自己的报告并将其添加到系统与破解核心代码以添加这个不寻常的功能相比,工作量并不大。
我明白你的意思。最好能在订单页面上获得真正的原始产品价格和我们出售的价格,因为这是我们开具发票和打印的价格。但这不是默认的 Magento。也许您应该向 Magento 社区开发人员提出请求。
编辑,简化答案:
您在帖子中要求的不是 Magento 显示价格的默认方式;见上面的解释。你只有三个选择:
-
编写您自己的解决方案;自定义扩展或破解核心代码(不推荐)
创建可由 Magento 生成的您自己的报告。可能不是您想要的,但却是处理此类情况的正确方法。
在 Magento CE 论坛中请求添加此功能。
【讨论】:
以上是关于magento 1.8.1 的销售订单视图中未显示原始价格?的主要内容,如果未能解决你的问题,请参考以下文章