2
votes

I'm deploying a Magento 1.7 store, but I don't want that customers can see and download invoices from the frontend, accessing to their account. I will manage the invoicing process using a third party application, and I will send it to the customers not involving Magento. I would like to use the "Invoice" button in the admin interface to flag an order as paid and to put the order in the "complete" status, but I need to avoid that customers can access the Magento invoice because it's not the real invoice and does not comply with European law. I found this workaround: I copied the /app/design/frontend/base/default/layout/sales.xml into my template folder and I edited it removing all the lines like

<action method="addLink" translate="label" module="sales"><name>invoice</name><path>*/*/invoice</path><label>Invoices</label></action>

Now in the frontend account all "invoices" links are disappeared, but I'm not sure that's the best solution because I can access to the invoice pointing to the url http://mydomain.com/sales/order/invoice/order_id/7/ where "7" is the invoice number...

Can someone help me finding a best solution?

Thank you in advance!

2

2 Answers

0
votes

You can overload the frontend controller with your own that does nothing. Something like:

<global>
<rewrite>

        <mynamespace_mymodule_invoice_cart>
            <from><![CDATA[#^/sales/order/invoice/#]]></from>
            <to>/mymodule/cnewcontroller/</to>
        </mynamespace_mymodule_invoice_cart>
    </rewrite>
<global>

And then add a frontend controller for mymodule/invoice

0
votes

I know its janky as it could be, but it works for me...
All I wanted to do was prevent customers from printing and viewing invoices, I use an Auto Invoice extension which then pushes the order through to third party software that I handle orders with.

In frontend\base\default\template\sales\order\invoice\items.phtml I've commented out these lines:

<!--<p class="order-links"><a href="<?php echo $this->getPrintAllInvoicesUrl($_order) ?>" onclick="this.target='_blank'" class="link-print"><?php echo $this->__('Print All Invoices') ?></a></p>-->

<!--<h2 class="sub-title"><?php echo $this->__('Invoice #') ?><?php echo $_invoice->getIncrementId(); ?> <span class="separator">|</span> <a href="<?php echo $this->getPrintInvoiceUrl($_invoice) ?>" onclick="this.target='_blank'" class="link-print"><?php echo $this->__('Print Invoice') ?></a></h2>-->

Thats removed the 'Print Invoice' and 'Print All Invoices' links.