Announcement

Collapse
No announcement yet.

Adding a Receipt Link

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding a Receipt Link

    Hello,

    I would like to add a link on checkout4.asp?step=4 that links the customer to their receipt so that if they want to print it they can do so right at check-out, as opposed to only being able to receive it via email.

    Basically, I'd like to link the actual invoice pref/number to the printable version.

    How would I do this in the checkout-step4.html template? Basically, what URL am i going to be linking to in order to make this happen?

    Thank you.

    LC

  • #2
    This is a an old post but has anyone implemented something like this? I'm sure it would be useful for the business to business customers as it's much cleaner to submit to accounting when it's not just a printed email.

    Comment


    • #3
      Well if you go into your account and view an old order, the link to view a printable receipt is:
      Code:
      ordertracking.asp?action=view&id=####&printable=1
      where #### is the order ID. So you would just need to give a link and include a variable for the order ID in the url. I believe in checkout_step4.html the variable is called [invoice-number].

      However this is kind of a pain to test since it requires placing a new test order every time you change the code.

      Comment


      • #4
        I was able to accomplish this by creating a javascript function that would create and print a [somewhat] formatted invoice. Here's the function:
        Code:
        function PrintContent() {
        var DocumentContainer = document.getElementById('invoicePrint');
        var WindowObject = window.open('PrintWindow', 'width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes');
        WindowObject.document.writeln(DocumentContainer.innerHTML);
        WindowObject.document.close();
        WindowObject.focus();
        WindowObject.print();
        WindowObject.close();
        }
        Add a <div> around the content you want to be included in the printout and set the id to invoicePrint.

        I added the above code to an external javascript file that I use to hold custom functions, then called it in checkout4 via this code:
        Code:
          <div align="right"><input name="Print" type="image" src="assets/images/print_invoice.jpg" onClick="javascript: PrintContent()" value="Print Page" />
        </div>
        Hope that helps.
        Chris
        TC Life Safety
        TC Wireless

        Comment


        • #5
          I decided to try cbsteven's version first and I'm getting pretty close. I've added this to the checkout4 invoice message in store language:

          Original:
          Your invoice #[invoice-prefix][invoice-number]

          Current:
          Your invoice #[invoice-prefix][invoice-number]
          <a href="#" onClick="window.open('ordertracking.asp?action=vie w&id=[orderid]&printable=1', name , 'width=550,height=600,toolbar=yes,scrollbars=yes' );"><img src="assets/templates/common/images/print.gif" border="0">Printable version</a>

          Looks like 3dCart actually wants to use [orderid] rather than [invoice-number] as the invoice number can be manipulated. I basically copied they code from the order-history-view.html template. when clicked a new window opens with the invoice info. The issue is that the window with checkout page 4 returns to the home page rather than staying put.

          Anyone know how to make the checkout4 remain displayed?

          Thanks for the help!

          Comment


          • #6
            Does it still do it if you don't use javascript in the link? Instead try:

            Code:
            <a href="ordertracking.asp?action=view&id=[orderid]&printable=1" target="_blank"><img src="assets/templates/common/images/print.gif" border="0">Printable version</a>
            The 'target="_blank"' should open it in a new window, although you can't control the size. But if this method works then at least you've narrowed down the problem to the javascript.

            Originally posted by Shopguy View Post
            I decided to try cbsteven's version first and I'm getting pretty close. I've added this to the checkout4 invoice message in store language:

            Original:
            Your invoice #[invoice-prefix][invoice-number]

            Current:
            Your invoice #[invoice-prefix][invoice-number]
            <a href="#" onClick="window.open('ordertracking.asp?action=vie w&id=[orderid]&printable=1', name , 'width=550,height=600,toolbar=yes,scrollbars=yes' );"><img src="assets/templates/common/images/print.gif" border="0">Printable version</a>

            Looks like 3dCart actually wants to use [orderid] rather than [invoice-number] as the invoice number can be manipulated. I basically copied they code from the order-history-view.html template. when clicked a new window opens with the invoice info. The issue is that the window with checkout page 4 returns to the home page rather than staying put.

            Anyone know how to make the checkout4 remain displayed?

            Thanks for the help!

            Comment


            • #7
              Well looks like it's in the java. With that change the checkout page 4 stays on screen. In my case the new window opened as a new tab, not sure I like that but that is certainly progress.

              So it would seem that there is an issue with the javascript. I'm really just stumbling though all of this but this is what I've com up with. Not sure if it's 'proper' but based on a lot of what I've read 'proper' is hard to do on a 3dCart store and of course is subjective as well.

              Current link:
              <a href="javascript:void(0)" onClick="window.open('ordertracking.asp?action=vie w&id=[orderid]&printable=1', name , 'width=550,height=600,toolbar=yes,scrollbars=yes' );"><img src="assets/templates/common/images/print.gif" border="0">Printable version</a>

              That leaves checkout page 4 alone and still opens the new window. What I don't like now is that it displays "javascrip:void(0)" in the status bar when you hover on it. This is not the case when you hover on the print version link from order-history-view.

              Any ideas on how to clean that up?

              Comment


              • #8
                There are probably 100 different ways to use javascript to make a pop up window, and it is anyone's guess which one will not cause problems with that page (I have no idea why it would change the page in the first place). I would just google "javascript pop up link" and start trying various methods.

                Comment


                • #9
                  I haven't been able to sort it out yet but for the moment it's a minor annoyance. I think I'll put it on the list to come back to 'later' :) Thanks for you help!

                  Comment

                  Working...
                  X