Post by qtriangle » Sat Dec 17, 2011 9:23 pm

The issue is that after order confirmation, no invoice is generated for the customer.

This issue is actually due to the reason that auto invoice generation code is missing from latest version of OC.

May be this has been done purposefully, but it is very inconvenient for me.

The fix is:

Open catalog/model/checkout/order.php

Go to function

Code: Select all

confirm($order_id, $order_status_id, $comment = '', $notify = false)
Remove the line

Code: Select all

$this->db->query("UPDATE `" . DB_PREFIX . "order` SET order_status_id = '" . (int)$order_status_id . "', date_modified = NOW() WHERE order_id = '" . (int)$order_id . "'");
Add following lines in place of above line:

Code: Select all

               $query = $this->db->query("SELECT MAX(invoice_no) AS invoice_no FROM `" . DB_PREFIX . "order` WHERE invoice_prefix = '" . $this->db->escape($order_info['invoice_prefix']) . "'");
       
               if ($query->row['invoice_no']) {
                       $invoice_no = (int)$query->row['invoice_no'] + 1;
                       } else {
                               $invoice_no = 1;
                       }
                       
                       $this->db->query("UPDATE `" . DB_PREFIX . "order` SET invoice_no = '" . (int)$invoice_no . "', invoice_prefix = '" . $this->db->escape($order_info['invoice_prefix']) . "', order_status_id = '" . (int)$order_status_id . "', date_modified = NOW() WHERE order_id = '" . (int)$order_id . "'");

We hope this will help many users who are getting similar problem.

Qtriangle - Website development and web hosting solutions
http://www.qtriangle.in


Newbie

Posts

Joined
Sat Dec 17, 2011 9:04 pm

Post by roland.broersen » Mon Jan 23, 2012 6:27 am

Hi qtriangle

I’m having also the invoice_no problem.
In my error log I see

“ 2012-01-22 23:12:31 - PHP Notice: Undefined variable: invoice_no in E:\wwwroot\catalog\view\theme\Your_clothing_store\template\mail\order.tpl on line 95 “

And in the confirmation email that is sent to the customer the error text is also there.

(It’s a Dutch shop)
Uw bestelling is succesvol ontvangen en zal worden verwerkt zodra uw betaling binnen is.
Hartelijk dank voor uw bestelling. Details:Notice: Undefined variable: invoice_no in E:\HostingSpaces\wwwroot\catalog\view\theme\Your_clothing_store\template\mail\order.tpl on line 95

I’ve made the modifications as you describe, but I’m still having this problem.
I do my testing with the ordering of the gift voucher.
Am I doing something wrong?
Hope you can give me a direction to look in.
I’m trying to get my store ready, but this is one I’m struggling on for some day’s now

Regards Roland B.


Posts

Joined
Fri Jan 20, 2012 5:00 am

Post by roland.broersen » Tue Jan 24, 2012 5:25 pm

My issues with invoice_no is solved.

By new file catalog\view\theme\Your_clothing_store\template\mail\order.tpl
Fix received from template owner (Your clothing store)
I can recommend this theme. (good support)

Regards Roland B.


Posts

Joined
Fri Jan 20, 2012 5:00 am

Post by Mohaiman » Mon Feb 06, 2012 8:48 pm

add something with qtrinangle's solution-
1.Open-
catalog/model/checkout/order.php
2. find-
$template->data['text_order_id'] = $language->get('text_new_order_id');
3.add below 2 line after above line-
$template->data['invoice_no'] =$invoice_no;
$template->data['text_invoice_no'] =$language->get('text_invoice_no');

thats it.

Newbie

Posts

Joined
Mon Feb 06, 2012 8:39 pm

Post by sparegeek » Mon Feb 20, 2012 12:12 pm

Okay I almost have this working but I can't figure out why the label for the Invoice number is not right.

Instead of having this displayed in the email: Invoice No.: INV-2011-006

It reads like this: text_invoice_no INV-2011-006

In the language file it seems correct but it's not pulling the correct language.

Any ideas?

OC user since Oct. '11 - Yep I'm new to it. - OC Version 1.5.1.2


New member

Posts

Joined
Thu Feb 02, 2012 12:36 am

Post by sparegeek » Fri Feb 24, 2012 3:24 am

Still haven't been able to get this corrected.

OC user since Oct. '11 - Yep I'm new to it. - OC Version 1.5.1.2


New member

Posts

Joined
Thu Feb 02, 2012 12:36 am

Post by sparegeek » Sat Feb 25, 2012 10:01 am

Okay, for anyone else struggling with this I figured it out.

The steps above from @qtriangle and @Mohaiman are all correct however there is one step they left out!

The instuctions in the @Mohaiman post had you insert this code:

Code: Select all

$template->data['text_invoice_no'] =$language->get('text_invoice_no');
Which is fine but 'text_invoice_no' is not defined in the language file any where.

To complete the solution to make the email read: Invoice No.: INV-2011-0010

You need to go into catalog/language/english/mail/order.php and add:

Code: Select all

$_['text_invoice_no']          = 'Invoice No.:';
This will make it display correctly in the email

Hope this helps.

OC user since Oct. '11 - Yep I'm new to it. - OC Version 1.5.1.2


New member

Posts

Joined
Thu Feb 02, 2012 12:36 am

Post by allenshea » Wed Jun 11, 2014 3:45 pm

Anyone knows how to make it working on OC1.5.4? I have copied the code, but it doesnt' work.

I know nothing about PHP and SQL, but I still try my best to understand it.


Active Member

Posts

Joined
Mon Dec 14, 2009 10:01 pm
Who is online

Users browsing this forum: No registered users and 18 guests