CsCart - Guest checkout only
One of our clients needed a redesign of the checkout process of his website. Even though, it would be easier for me if it was a Ubercart or DrupalCommerce eshop, it was CsCart and I had to make my hands dirty. Or not...
The fact that I didn't really know the logic behind this system, I was obliged to think practically. The original checkout process needs 4 different forms to be submitted. The modified checkout process also submits 4 different forms. But no buttons exist for the checkout. The only button seen by the user is the "Complete checkout" button. Every other button is hidden and forms are submitted with jQuery .blur() calls when the input fields of each form have changed from their previous values. I must also say that the new checkout only allowed Guest Checkout. Every other option was removed.
Anyway, everything until now was just Javascript and CSS modifications in one tpl file. But we had another problem. The website also had registered users and CsCart has a problem with users trying to checkout as guests. CsCart doesn't really have a problem; it's the developers who couldn't find a reason for a user to guest-checkout and coded an extra if-statement. They are probably right about this "if", but I would prefer it to be a setting for the administrator to choose whether or not he needs it.
Of course, I Googled my problem and found that a few other cscart-licence-buyers also had this problem but no answer existed (@see 20444-the-username-or-email-you-have-chosen-already-exists). And then I decided to check and (eventually) hack the website code. I know it breaks the upgrade path but we don't really care about that. So... All I had to do was to go to /controllers/customer/checkout.php file and comment out the lines 518-529 and have the following result-code:
PS: The CsCart version used was 3.0.4 PROFESSIONAL. Unfortunately, I couldn't create an account in CsCart forums to post my solution, so I hope that anyone interested will find it here sooner or later.
The fact that I didn't really know the logic behind this system, I was obliged to think practically. The original checkout process needs 4 different forms to be submitted. The modified checkout process also submits 4 different forms. But no buttons exist for the checkout. The only button seen by the user is the "Complete checkout" button. Every other button is hidden and forms are submitted with jQuery .blur() calls when the input fields of each form have changed from their previous values. I must also say that the new checkout only allowed Guest Checkout. Every other option was removed.
Anyway, everything until now was just Javascript and CSS modifications in one tpl file. But we had another problem. The website also had registered users and CsCart has a problem with users trying to checkout as guests. CsCart doesn't really have a problem; it's the developers who couldn't find a reason for a user to guest-checkout and coded an extra if-statement. They are probably right about this "if", but I would prefer it to be a setting for the administrator to choose whether or not he needs it.
Of course, I Googled my problem and found that a few other cscart-licence-buyers also had this problem but no answer existed (@see 20444-the-username-or-email-you-have-chosen-already-exists). And then I decided to check and (eventually) hack the website code. I know it breaks the upgrade path but we don't really care about that. So... All I had to do was to go to /controllers/customer/checkout.php file and comment out the lines 518-529 and have the following result-code:
PS: The CsCart version used was 3.0.4 PROFESSIONAL. Unfortunately, I couldn't create an account in CsCart forums to post my solution, so I hope that anyone interested will find it here sooner or later.
Comments
The checkout page of CSCart contains some tabs (more like an accordeon) and when one step gets submitted, the next one appears.
What I did in my case was to show all fields from the very beginning and when a user filled all the values of each step/form I triggered, using jQuery, the click event of the submit button of the form I had previously used .hide() on.
I also had to modify the CSS for the throbber appearing on AJAX calls. I transformed it to a fullpage transparent overlay to make sure that the user doesn't keep filling the fields of the next form until the end of submitting the previous one.