I would like to give my customers the ability to print their order after a successful check out in Magento 1.8.
How can I achieve this?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
In checkout success page, the print link has been already available for register customer by default.
In success.phtml file,there is a condition which will only work for logged in customer.
See this excerpt from
success.phtml file, which is the key template file in order success page.
<?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?> <p> <?php echo $this->__('Click <a href="%s" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?> <?php echo $this->getChildHtml() ?> </p> <?php endif;?>
It is clear from the above code that, print link will be shown only when
$this->getCanViewOrder() && $this->getCanPrintOrder() is true. In short, this will become true only when follwing conditions are met.
By default, these are the visible states in Magento:
And invisible states are:
This means, all states except
pending_payment are in visible mode and most of the cases, a new order state will be either
This makes customer logged in status vital to show print order link.
Hope that helps.