Post by Erin Laurie » Fri Nov 05, 2010 10:55 am

I hope I am in the right place. And I have been searching for well over an hour now, but I get now search love :D so I thought I would ask.

I have the version 1.4.9.1 running on my local server. No link available.

What I would like to do is on this page
index.php?route=checkout/success where it says
Your order has been successfully processed!
You can view your order history by going to the My Account page and by clicking on History.
Please direct any questions you have to the store owner.
Thanks for shopping with us online!
I want to have a "Print Receipt" Button that let's the Customer Print a receipt/invoice with the Order ID and a list of all the items ordered.

I didn't see a module for that...

Can anyone help?

I am comfortable with PHP and could probably write something but I am not familiar with MVC so it feels a bit daunting.

Thanks in advance
Erin

Newbie

Posts

Joined
Fri Nov 05, 2010 10:28 am

Post by spikeachu » Sat Nov 06, 2010 5:01 am

I don't think there's a straightforward way of doing it.

There is a javascript window.print() function, but this is only good for the page you are currently viewing.

The information that you want to print is instantly emailed to the customer anyway on IPN, so I would have thought that if your customer wanted to print this information they would do so direct from their inbox.

Maybe someone who is in a more lateral thinking mood than me right now can think of another way, but I think you would have to send the customer to the order information in their account before being able to use a print page link.

Wedding Invitations and Stationery by Love2print

Commercial Mods
Product Colours on Category Page
Cardsave Direct Gateway
Clear Cache
Promotional Watermarks on Images
Multiple Category / Product Templates ** Popular **
Log Failed Login Attempts
Display Eligible Coupons with Products
Twitter Feeds

Have I helped you out or saved you some time? Please donate


Active Member

Posts

Joined
Fri Mar 12, 2010 6:31 am

Post by Erin Laurie » Sat Nov 06, 2010 8:29 am

Thanks. I am looking into it.

It seems really simple to pass variables onto a page. Except It's not. I really am missing something in this MVC thing.

For example...

After some digging into the code I found four files that seem to deal with the "Success" page on checkout.

catalog/controller/checkout/success.php -- actual
catalog/language/english/checkout/success.php
catalog\view\theme\default\template\checkout\success.tpl
catalog\model\checkout\order.php

So what I want to do is capture the order Id. I can see it being set in a function in order.php ($order_id)
I cannot for the life of me get it to pass to any page even when I set it in a session variable.

I even tried manipulating this function and setting my new variable as global...

Code: Select all

class ControllerCheckoutSuccess extends Controller { 
	public function index() { 
		if (isset($this->session->data['order_id'])) {
			$this->cart->clear();
			unset($this->session->data['shipping_method']);
			unset($this->session->data['shipping_methods']);
			unset($this->session->data['payment_method']);
			unset($this->session->data['payment_methods']);
			unset($this->session->data['guest']);
			unset($this->session->data['comment']);
			unset($this->session->data['order_id']);	
			unset($this->session->data['coupon']);
		}
I am not sure what is happening as far as how all the variables get passed to where and where I should add mine so that they get passed. At this point I feel pretty silly. So if anyone wants to give me a clue I really appreciate it. :-\

Newbie

Posts

Joined
Fri Nov 05, 2010 10:28 am

Post by billyggla » Sat Nov 06, 2010 10:32 am

in /catalog/controller/checkout/success.php

add this

Code: Select all

$this->data['order_id'] = $this->session->data['order_id']; 
directly after

Code: Select all

if (isset($this->session->data['order_id'])) { 
in /catalog/view/theme/default/template/common/success.tpl
you can now get the order id using

Code: Select all

<?php echo $order_id; ?>
hope that helps..

Active Member

Posts

Joined
Mon Sep 20, 2010 7:05 am

Post by scanreg » Sat Nov 06, 2010 9:54 pm

Any chance of making something like this part of the core? Lots of customers like to print out their orders

Active Member

Posts

Joined
Thu May 06, 2010 12:15 am

Post by Erin Laurie » Sun Nov 07, 2010 3:15 am

This is what I did the first time :laugh: But for some reason, I totally spazzed out on the fact that the session itself was unset shortly there after. So IF I then refreshed the success page *poof!* there went my order ID. Funny. In a not so funny way.

Anyway...

I also added this:
else {$this->data['order_id']="Please login to see your order history.";}
just after this
unset($this->session->data['order_id']);
unset($this->session->data['coupon']);
}

Otherwise you'll throw an error.

I suppose my goof up was beneficial as I spent a good bit of time really looking at the code. Very clean and easy to read, if difficult to find all the pieces. I am still getting use to OOP and MVC. :)

I am now writing a 'Print Page", now that I have a better handle on what is actually happening during checkout.

Thanks bunches!
billyggla wrote:in /catalog/controller/checkout/success.php

add this

Code: Select all

$this->data['order_id'] = $this->session->data['order_id']; 
directly after

Code: Select all

if (isset($this->session->data['order_id'])) { 
in /catalog/view/theme/default/template/common/success.tpl
you can now get the order id using

Code: Select all

<?php echo $order_id; ?>
hope that helps..

Newbie

Posts

Joined
Fri Nov 05, 2010 10:28 am

Post by billyggla » Sun Nov 07, 2010 4:03 am

You may want to have a look in

/catalog/model/account/order.php
/catalog/controller/account/invoice.php
/catalog/view/theme/default/template/account/invoice.tpl

might help you grab the order data to pass to your print page..

Good luck, let us know how you get on..

Active Member

Posts

Joined
Mon Sep 20, 2010 7:05 am

Post by openmycart.com » Sun Nov 07, 2010 8:03 am

Do You looking a modification for something like this? http://www.opencart.com/index.php?route ... ion_id=770

Find and get many various of opencart modules, themes, mods, etc for your opencart store at http://www.openmycart.com/oc/, OPENCART SITE customization and Maintenance supports at here


User avatar
Active Member

Posts

Joined
Tue Oct 12, 2010 4:47 am


Post by namasy » Wed Dec 15, 2010 8:21 am

HELLO ALL

Do not want to create a new topic on my own request because it related to this topic

v : opencart 1.4.8 b
I would like to receive the report ( invoice ) within a page in the success
How do I do this

I did an experiment to show the invoice
But not the most successful
Set up a new page has been activating the bill, but stopped at this step

<iframe name="I1" id="I1" style="width: 650px; height: 1000px" border="0" frameborder="0" src="http://localhost/shop/index.php?route=a ... r_id=<?php echo $order_id; ?>"></iframe>

In short, the way I want to activate
$ order_id
in Success page

I apologize if my explanation is weak because I do not speak English correctly
thanks

Newbie

Posts

Joined
Thu Apr 01, 2010 6:22 am

Post by xchrizzlex » Mon Jul 09, 2012 11:02 pm

Hello,

Is it possible using the same technique to write all the session data to an external database?
before it gets unset

Newbie

Posts

Joined
Thu Jul 05, 2012 10:42 pm

Post by HankMcSpank » Mon Aug 27, 2012 5:16 pm

Just had a customer contact me - he want to print out his own invoice from his account for a previous order - he's saying he can't (which is a bit of a surprise to me).

Re the OP's original post can someone please confirm that customers aren't able to print out their own invoices? (much like the admin can with a print invoice button)

Active Member

Posts

Joined
Wed Apr 11, 2012 4:15 pm

Post by wsrinivas » Tue Sep 10, 2013 5:57 pm

Is there no extension that we can buy and install to save all this hassle

Buildng Party Supplies websites
http://www.partystuffonline.co.uk


User avatar
New member

Posts

Joined
Mon Feb 18, 2013 8:46 pm
Location - Milton Keynes, UK

Post by scanreg » Tue Sep 10, 2013 9:07 pm

i think there is at least one in the extensions section

Active Member

Posts

Joined
Thu May 06, 2010 12:15 am
Who is online

Users browsing this forum: Google [Bot] and 274 guests