| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Login Form Modification | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Login Form Modification
I hate the fact that x-cart takes you back to the home page if you log into the site without anything in your cart. Here's the mod that will take you back to the page you just came from when you log in.
+++++++++++++++++++++++++++++++++++++++++++++ This modification will take you back to the page you came from unless you have something in your cart. In the latter case, it will take you to your shopping cart. +++++++++++++++++++++++++++++++++++++++++++++ Original File: login.php Code:
Code:
+++++++++++++++++++++++++++++++++++++++++++++ This modification will allow you to control which pages redirect you back to shopping cart, which redirect you back to the homepage and which you want redirected back to the page they came from. Simply adjust the order to suit your priorities and add &locator=1 to any page's url that you would like the user to be redirected to once they log in. You can also add as many &locator=#'s to the if statement and move people all around the site +++++++++++++++++++++++++++++++++++++++++++++ Original File: login.php Code:
Code:
+++++++++++++++++++++++++++++++++++++++++++++ And finally... This modification is the same as the first one, but will also recognize if your user is logging in while in the middle of the checkout process of the shopping cart and will redirect them to the next step in the checkout process rather than taking them back to step one. +++++++++++++++++++++++++++++++++++++++++++++ Original File: login.php Code:
Code:
I have been adding to this message as I have been coding so it's kind or a patchwork of stuff, hope no one gets confused
__________________
Following the signature guidelines : xcart pro 3.5.8 - [RedHat] |
|||||||
#2
|
|||||||||
|
|||||||||
You rule. I'll be adding these mods to my site soon.
__________________
www.brettbrewer.com Getting back into x-cart dev after a long hiatus. Modded lots of x-carts from version 3.1.x to 4.1.x. Developer of ImageScaler mod, Pre-login per user coupon mod, Wordpress feed mod, DigitalSubscriptions mod, Phonetic bulk download keys addon for DownloadExpander mod, Serial Number Generator for ESD products, Custom CMS/LMS integrations, external products mod, and more. |
|||||||||
#3
|
|||||||
|
|||||||
Finally a response!!!
I'm glad someone likes these; I thought they were going to be a hit. They ended up being another Apple Newton.
__________________
Following the signature guidelines : xcart pro 3.5.8 - [RedHat] |
|||||||
#4
|
|||||||||
|
|||||||||
Man, I'm just impressed that you managed to untangle the login code enough to write this script. I've managed to tweak myself into a corner with respect to this. I had my DigitalSubscription module working perfectly in the old 3.1.3a version of x-cart and then upgraded and tried to re-modify the new version (3.3.1) and now all my customers have to create a login/password or the user's info is lost when they try to check out, until they fill in a username/password. I've got logic to check the cart contents and if they have any DigitalSubscripton products then we can't allow anonymous checkout. My code is now preventing ALL anonymous checkouts instead of just the one's containing DigitalSubscriptions (which they'll need a username and password to access). Not sure why yet, but I'd be interested to know how you approached your project above. Maybe I'm missing something that would make x-cart easier to understand? I understand all the languages (PHP,Smarty,JavaScript, etc) but when they're all working together on the same page, it gets very hard to follow.
__________________
www.brettbrewer.com Getting back into x-cart dev after a long hiatus. Modded lots of x-carts from version 3.1.x to 4.1.x. Developer of ImageScaler mod, Pre-login per user coupon mod, Wordpress feed mod, DigitalSubscriptions mod, Phonetic bulk download keys addon for DownloadExpander mod, Serial Number Generator for ESD products, Custom CMS/LMS integrations, external products mod, and more. |
|||||||||
#5
|
|||||||||
|
|||||||||
Yeh, this is a great little mod.
This should be added to xcart as standard i think. Why not send this one to xcart
__________________
Looking for a reliable X-cart host ? You wont go wrong with either of these. EWD Hosting Hands On Hosting |
|||||||||
#6
|
|||||||
|
|||||||
Improved version
I took your code and made a few minor improvements. Using HTTP_REFERER is not foolproof, since it is set by the browser. So my code goes back to the original behavior if the REFERER is not set. Also, this code is for version 3.3.4 and handles checkout logins from both the "Click to login" link and from the regular login box (normally on the right-hand side).
Code:
|
|||||||
#7
|
|||||||
|
|||||||
v3.3.5
How do I prevent anonymous checkout?
|
|||||||
#8
|
|||||||||
|
|||||||||
Nice one! I was just about to start hacking x-cart to bits to do exactly this! Ta dude.
|
|||||||||
#9
|
|||||||
|
|||||||
Any idea how to make this work on 3.4.x?
Thanks. |
|||||||
#10
|
|||||||
|
|||||||
I tried it on 3.4.2 and the problem was that you filled out the form, and hit login, but it didn't log you in for some reason.
Now I'm not a programmer, but I did really well on pattern detection in an IQ test, so I think I have a fix It seems to work fine, the problem was with the following call to header function: Code:
In my version, the original login.php used the format: Code:
There are two instances in the mod snippet that require changing, but that's all and it seems to work like a charm So in the 3.4.2 version, the mod will be as follows: Original File: login.php (line 125) Code:
Modified File: login.php Code:
HTH, lemme know if it works for you. P.S. This works even if the customer is registering during checkout, and redirects them back to the page they were on, so they don't have to hit 'checkout' again I loved that!
__________________
X-Cart 3.4.2 - Processor: Dual Hamsters, running on tricked out 21\" version of Hamster Wheel. (tireless little buggers) No hamsters were harmed during the making of this sig. Several were seriously offended. |
|||||||
|
|||
X-Cart forums © 2001-2020
|