Hi,
Got a question. We want to allow for the creation of invoices by the system. I started by using the order weblog and have an invoice template.
I only show the ‘print invoice’ button when a order has a certain status. When a customer succesfully returned from PayPal the order is automatically changed to the complete status. So far so good, but this creates a problem in my case:
In the netherlands and other parts of the EU, we are required to use a sequential invoicenumbering, thus we can not use the ordernumber as an invoicenumber.
To solve this problem we would need to create a function to by using a frontend template that creates a invoice entry on the order succes page (when an order is set to complete).
But this leads to another problem. I have certain products that do not need to be invoiced. If i have only such products in my cart i do not need to show the payment gateways (since, no payment needs to be made) or use a hidden one. You could suggest that i use the Offline Payments gateway, but i already use this gateway for ‘Invoice per regular mail’ and also this gateway sets the order to complete that should trigger the creation of an invoice.
To allow for this i had the following ideas:
- check on the checkout page if a product that has a custom_field set to a certain value (in my case we have private and public products), we show different/hidden payment gateways.
{exp:weblog:entries entry_id="{exp:cartthrob:cart_entry_ids}" search:producttype="noinvoice" limit="1"}
{if "{absolute_count}" == "{exp:cartthrob:unique_items_count}"}
SHOW HIDDEN PAYMENT GATEWAY
{if:elseif no_results || "{absolute_count}" != "{exp:cartthrob:unique_items_count}"}
SHOW REGULAR PAYMENT GATEWAYS
{/if}
{/exp:weblog:entries}
I don’t know if the above works, but i think you’ll get the idea.
- create a new payment gateway, inspired on the Offline Payments module that sets a custom order status, something like Complete-no-invoice.
Any idea how to set a custom status?
- On the order complete page, we check if the status is set to complete (not complete-no-invoice) and launch the createInvoice method. This method creates a new entry in the invoices weblog and preferably relates this entry in the order entry.
Any idea to do this an easy way?
-Later in the my account section, retrieving the invoice shouldn’t be a too big of a problem.
