Question

When a customer clicks print invoice in their account now it shows the (crappy styled) invoice on screen and a print dialog

I would prefer to not use this and instead when a user clicks the print invoice button, that a pdf is shown which can be saved or printed.

Is that possible?

Was it helpful?

Solution

There is no way with plain magento to prepare a download response by clicking the print invoice button.

You could overwrite the controller action in a custom module like this:

require Mage::getModuleDir('controllers','Mage_Sales') . DS . 'OrderController.php';

class Namespace_Module_Sales_OrderController extends Mage_Sales_OrderController{

    /**
     * Print Order Action
     */
    public function printAction()
    {
        if (!$this->_loadValidOrder()) {
            return;
        }
        /**
         * your custom code for download pdf here
         */
    }
}

and in config.xml you need to populate the controller for mage sales:

[...]
</global>
<frontend>
    <routers>
        <sales>
            <args>
                <modules>
                    <namespace_module before="Mage_Sales">Namespace_Module_Sales</namespace_module>
                </modules>
            </args>
        </sales>
    </routers>
</frontend>
[...]
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top