Jump to content

Direct Customer to Client Area WITHOUT displaying Invoice when...

Recommended Posts

Whilst I'm sat here in my back garden, enjoying the 32c weather, I'm starting to break out into a sweat! NOT because it's hot, but because I'm trying to figure out how to direct the customer to the Client Area WITHOUT displaying Invoice depending on which payment method is chosen...


For example:



Customer checks out, chooses PayPal - They are taken to the PayPal site to complete payment and are passed back to whatever URL you ask PayPal to pass them back to. (For me, it's https://portal.mydomain.co.uk/clientarea.php) - PERFECT!


Bank Transfer

Customer checks out, chooses Direct Bank Transfer - They are IMMEDIATELY shown the invoice with a text link at the bottom of the invoice page to direct them back to the client area. NOT what I want.


What I WANT is for them to be shown a message (Not bothered how - jQuery popup message perhaps), telling them "You've selected to pay by Direct Bank Transfer - Pay up or you'll be sorry". Then, two nice big buttons - one that says "View Invoice", the other that says "Go to Client Area".


But wait, that's now ALL - When they decide to "View Invoice", I want it to display in a POPUP window and NOT leave the page they are on.


I don't want MUCH, do I..?


Any assistance would earn your choice of cold drink and an hour on my sun lounger :-)

Link to comment
Share on other sites

I'm using 3 currently: PayPal, Bank Transfer and Mail In Payment.

the only reason I asked was to find out if I needed to mess with IF statements in the coding... for the moment I have done, and this only works for Bank Transfer - any other payment method (mailin) would see the default invoice page (as it does now)... it would be very easy to add more methods to see this customised page, or even setup different customised pages for specific payment methods.


what I have so far is a rough solution that works, but it's a "work in progress" and still needs to be polished further.


if payment method is Bank Transfer, it shows the text in the first image as a basic page (no header/footer etc), and it includes three links (view invoice, download invoice (pdf) and return to client area) - text is all taken from the language files.


clicking on "view invoice" displays the invoice in a jquery window, darkening the surrounding screen - you probably can't tell on the second image (as the forum seems to reduce image dimensions on upload), but the "You've selected to pay by Direct Bank Transfer - Pay up or you'll be sorry!" text is still there at the top of the image.


I have to say that I wasted ages trying to get the javascript to work without success - and then realised that it needed to be wrapped in {literal} tags.... *sighs*... I might need extra ice and a little cocktail parasol in my drink to make up for that! :roll:


this lightbox effect will work for images, videos and external links too - along with inline html (which is what this invoice is).


one thing that I would like to do is to change those links into buttons matching those in the client area - but i'm getting nowhere (even after checking the forum, google etc)... as far as I can tell, the correct css files are being referenced, but they're just appearing as standard buttons... if anyone has any ideas about that, please let me know!... although if you wanted to use images as buttons, they would work.


another issue that needs looking at is the dropdown menu on the invoice - it'll either have to be removed, or more if statements added... as when you switch from bank transfer to mailin, it goes back to the default invoice... but then when you switch back to bank transfer, it shows the page in the first image.


anyway, let me know what you think... and also how you want to handle mail in payments - do they see this new page, or do they see the current invoice page?

Link to comment
Share on other sites

Awesome work Brian!

This is exactly what I've been looking for.


I especially like the 'Lightbox Effect' - Nice!


I have to say that I wasted ages trying to get the javascript to work without success - and then realised that it needed to be wrapped in {literal} tags.... *sighs*... I might need extra ice and a little cocktail parasol in my drink to make up for that!

DONE! I've also ordered you some nibbles for 'good measure' :-)


also how you want to handle mail in payments - do they see this new page, or do they see the current invoice page?

It would be great if MailIn payments were handled in the same way, although I use this method for CC payments over the phone and have labeled it 'By Telephone (Debit/Credit Card)'. A similar message displaying the number to call to process their card along with the Invoice number and total amount payable would need to be shown in the same way as the 'Pay up now or you'll be sorry' message.


Any chance of some bigger screenshots? The forum shots are a little small and my bottle-bottom specs aren't improving anything..? ;-)


Feel free to PM me :-)

Link to comment
Share on other sites

I think significant progress has now been made, so let me show you where i'm upto with this..


early on I realised that it was going to be better to use $paymentmodule rather than $paymentmethod in the IF statements... basically, $paymentmethod is whatever you call that specific gateway ("Direct Bank Transfer", "By Telephone (Debit/Credit Card)"), but $paymentmodule always sees them as "banktransfer" and "mailin" as its coded in the module - so easier to handle!


in summary - whatever you call the gateways, even if you change it later, shouldn't affect the code from working!


firstly, here are the two pages they will see after ordering using either Bank Transfer or Mail In Payments.. with larger images provided!






as you can see, we now have the correct CSS buttons instead of text links :!:


the way it's coded at the moment, if payment is by banktransfer, it displays the top text, otherwise it displays the bottom text... it's easy to add more if statements if further payment options are to be included on this page.


I guess you could even tweak it to give promotion codes to customers, or suggesting other products... the possibilities are endless.


if the click on View Invoice, they will see a window similar to below...




so i've made the opacity a little lighter now (it was 85%, it's now 75%), got rid of the troublesome gateway dropdown menu and added smaller buttons to the bottom of the invoice... it's just html, so anything (within reason!) can be added... "back to client area" closes the jquery window and returns to the client area - though you can keep whmcs in that window, but it looks a little strange to do so :twisted:


so as I was testing, I came across two problems...


1. the first page should only be seen if the invoice is unpaid - you don't want to be demanding money from customers who have already paid the invoice!... so there is now an additional condition added to the if statement to check that the invoice is unpaid.. if it is unpaid, they see the first page; if the invoice has been paid, they see the default invoice page.


2. when a user is logged into the client area, and visits "My Invoices", they can view their current and past invoices... but if those invoices are unpaid, they'll just get redirected to one of the above boxes... not good... there's a similar issue on the opening page of the client area that shows invoices... (maybe other pages too - i'll need to check).


there are two solutions to this and you can do either or both.


firstly, you can pass a variable in the link to the invoice page that can be used to bypass the above screens and display the original default invoice page... works for both paid and unpaid invoices.




i'm guessing the next way will be your preferred option - you can open a jquery popup window from directly inside the clientarea and display the invoice within it. :)



notice that the footer buttons are different on each - it's the same page, but it displays different sets of buttons depending on the variable passed in the URL... there's no need for a "Back to Client Area" button in the second image as you are already there.


what I need to do now is test it against an invoice paid by paypal to make sure it works with non-mailin and banktransfer methods, check it for a few other issues and tidy and comment all the code.


if you can let me know (either here or PM) which template your using, whether it's one that came with WHMCS or a customised one.


i'll figure out some installation instructions for this and then you'll be able to test it on your installation... if it works, and if others are interested in using it, I might release it as a user contribution.

Link to comment
Share on other sites



This is EXACTLY what I asked for - FIRST CLASS!


Screen grabs look fantastic and great to see the CSS stuff working too! :-)


You're right - The jQuery option would be the one I would choose.


I'm using a custom template for the site (Site still in Dev). I'll PM you with some more details and hopefully get to give this a good test. I'm fairly certain that others would benefit from this if you released it as a module. Personally, I feel it's an important piece of the WHMCS jigsaw that's been missing :-(


Can't wait to see this on my screen :-P


[EDIT - Seems I cannot PM you, or indeed change my profile in any way...? Any ideas why..?]

Edited by xeroxfixer
Link to comment
Share on other sites

Well that was quite bizarre! I didn't have ANY of those options. Then, when I just tried to log in it seemed my password had been changed. I had to request a password reminder in order to login and would you believe it, THEN everything seemed to appear by magic! :-)


Just about to PM you Brian :0

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated