Magento - Have different set of fields and labels for cart and checkout (order review) screens

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 08:27:09

From your previous question you already know the output comes from the file template/tax/checkout/grandtotal.phtml. It's decision to show a 1 or 3 totals lines is based on this snippet:

<?php if ($this->includeTax() && $this->getTotalExclTax()>=0):?>

I would suggest changing it to...

<?php if ($this->includeTax() && $this->getTotalExclTax()!=$this->getTotal()):?>

Here, when the address is unknown and tax is zero, the two grand totals are equal and so only one is shown.

This is doubly beneficial, when an address is supplied by the "Shipping and Tax Estimate" form then the cart can still go back to the 3-line output automatically which is smooth.

You have several options

  1. You can sniff the location of the user with GeoIp and set at least the country in quote billing address so you'll get the tax estimates to display. For example to get the UK estimates you can do (if quote exists) <?php $this->getQuote()->getBillingAddress()->setCountryId('UK');?> or <?php $this->getQuote()->getShippingAddress()->setCountryId('UK');?>
  2. You can change the template file to be different in cart and in checkout by modifying the checkout.xml layout file and make your conditions in separate files
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!