Jump to content

[RESOLVED] AjaxCart Template odd behavior


Recommended Posts

Here we go, this is how I envision it (with my own voice talking about it):

http://www.screen-shot.net/2011-05-19_1948.swf

 

Here is my "patch" including Matt's patch for &skip=1 functionality working attached.

 

Here is the documentation on changes made. Anybody using a non-English template (or using multiple langauges) will need to translate and modify their language files appropriately.

 

Changed line 620 of English.txt to:
$_LANG["ordersummary"] = "Cart Summary";

Changed line 942 of English.txt to:
$_LANG['ordersummarybegin'] = "No products currently in the cart.  Please fully configure a product to add it to the cart.";

Added these lines to English.txt:
$_LANG['ajax_checkout'] = "Checkout >>";
$_LANG['ajax_continue'] = "Continue Configuring Product >>";

Modified configureproduct.tpl, configuredomains.tpl, and configureproductdomain.tpl in ajaxcart to reflect ajax_checkout and ajax_continue for the buttons.

Modified cartsummary.tpl to remove " <input type="button" value="{$LANG.checkout}" onclick="checkout()" />" as it's redundant.

ajaxcart_patch_mikedvb.zip

Link to comment
Share on other sites

I think the way you have it Michael makes a lot of sense compared to the default WHMCS v4.5, thanks for the videos and mod
I think it makes a *LOT* more sense like this as well, hopefully this mod can make it officially into WHMCS so that it supports multiple languages.

 

It would also be great if it made it in so we didn't have to make all of these changes manually on each and every update.

Link to comment
Share on other sites

On a related note, there is still something that Matt will need to resolve:

 

This works for skipping product selection (code so it doesn't get shortened by the forum):

https://www.mddhosting.com/support/cart.php?pid=5&skip=1

 

This does not work for skipping product selection (code so it doesn't get shortened by the forum):

https://www.mddhosting.com/support/cart.php?a=add&pid=5&skip=1

 

The default URL is the second one (provided directly by WHMCS):

2011-05-19_2038.png

 

Very nice mike!

Not liking how the client can remove the product and still continue but you've done a great job there.

I've not tested to see what happens if the cart is empty and the customer tries to complete the order. Realistically I think it should check to see if the cart is empty, and then reset the ordering process or something... I'm not sure how to gracefully handle that error.
Link to comment
Share on other sites

Another update, for those who have old sources that still link to the /whmcs/order/?pid=2&skip=1 (such as forums) where you cannot update the links, I've modified the index.php in /whmcs/order/ to pass &skip if it exists:

 

Here is the new version:

<?php

require("../dbconnect.php");

if ($pid) {
       if ($skip) {
           header("Location: ../cart.php?pid=".(int)$pid."&skip=".(int)$skip."&carttpl=ajaxcart");
       } else {
           header("Location: ../cart.php?pid=".(int)$pid."&carttpl=ajaxcart");
       }
   exit;
}

header("Location: ../cart.php?carttpl=ajaxcart");
exit;

?>

 

If you look at the existing version you will see that all I did was check for $skip and if it exists, it passes it into the header, otherwise it doesn't.

 

Attached is the latest version of the patch including the updated /whmcs/order/index.php

 

Here is the official change-log:

ajaxcart_patch_mikedvb_v1.1 changelog

 

Changed line 620 of /whmcs/lang/English.txt to:

$_LANG["ordersummary"] = "Cart Summary";

 

Changed line 942 of /whmcs/lang/ English.txt to:

$_LANG['ordersummarybegin'] = "No products currently in the cart. Please fully configure a product to add it to the cart.";

 

Added these lines to /whmcs/lang/ English.txt:

$_LANG['ajax_checkout'] = "Checkout >>";

$_LANG['ajax_continue'] = "Continue Configuring Product >>";

 

Modified /whmcs/templates/orderforms/ajaxcart/configureproduct.tpl, /whmcs/templates/orderforms/ajaxcart/configuredomains.tpl, and /whmcs/templates/orderforms/ajaxcart/configureproductdomain.tpl to reflect ajax_checkout and ajax_continue for the buttons.

 

Modified /whmcs/templates/orderforms/ajaxcart/cartsummary.tpl to remove " <input type="button" value="{$LANG.checkout}" onclick="checkout()" />" as it's redundant.

 

Modified /whmcs/order/index.php to handle the "skip" variable to allow legacy Ajax form links that use &skip=1 to continue to function as expected.

ajaxcart_patch_mikedvb_v1.1.zip

Edited by MikeDVB
Link to comment
Share on other sites

After speaking with Matt, we're going to be adding back the "Checkout" button to the Cart Summary however we're going to link it to an anchor so that it takes you back to the top of the user information entry if I can manage to get a button to link to an anchor :)

 

Matt's main reason is that the checkout button is for somebody who leaves the cart and comes back to it, not wanting to order more products just checkout, which does make sense.

Link to comment
Share on other sites

I've done it, I had to add a line of code to the main.js for the ajaxcart, but I will post version 1.2 of this patch soon. See it here:

http://www.screen-shot.net/2011-05-20_1338.swf

 

Here is what is changed in the main.js of the ajaxcart/js/main.js:

function checkout() {
scrolltocheckout();
   jQuery.post("cart.php", 'a=checkout&ajax=1',
   function(data){
       jQuery("#signupcontainer").html(data);
       jQuery("#signupcontainer").slideDown();
   });
}

function scrolltocheckout() {
if ($(document.getElementById('signupcontainer')).is(":visible"))
{
	document.getElementById('signupcontainer').scrollIntoView(true);
}
}

 

What this does, is if you're scrolled to the bottom and you hit the "Checkout" button in the summary, it will scroll back up to the part where you enter your details. This, at the least, causes some sort of change so that those who don't follow the ordering process well will not be confused when they hit checkout numerous times and nothing happens.

 

Updated ZIP forthcoming.

Edited by MikeDVB
Link to comment
Share on other sites

Attached is the latest verison 1.2.

 

Changelog:

ajaxcart_patch_mikedvb_v1.1 changelog

 

Changed line 620 of /whmcs/lang/English.txt to:

$_LANG["ordersummary"] = "Cart Summary";

 

Changed line 942 of /whmcs/lang/ English.txt to:

$_LANG['ordersummarybegin'] = "No products currently in the cart. Please fully configure a product to add it to the cart.";

 

Added these lines to /whmcs/lang/ English.txt:

$_LANG['ajax_checkout'] = "Checkout >>";

$_LANG['ajax_continue'] = "Continue Configuring Product >>";

 

Modified /whmcs/templates/orderforms/ajaxcart/configureproduct.tpl, /whmcs/templates/orderforms/ajaxcart/configuredomains.tpl, and /whmcs/templates/orderforms/ajaxcart/configureproductdomain.tpl to reflect ajax_checkout and ajax_continue for the buttons.

 

Modified /whmcs/templates/orderforms/ajaxcart/configureproductdomain.tpl to adjust the domain text entry boxes from 25 wide to 20 wide to avoid the extension displaying below the domain entry box.

 

Added back /whmcs/templates/orderforms/ajaxcart/cartsummary.tpl to remove " <input type="button" value="{$LANG.checkout}" onclick="checkout()" />" as it's redundant.

 

Modified /whmcs/templates/orderforms/ajaxcart/js/main.js:

Added function: scrolltocheckout()

Added call to function scrolltocheckout() in checkout();

 

Modified /whmcs/order/index.php to handle the "skip" variable to allow legacy Ajax form links that use &skip=1 to continue to function as expected.

 

Known Issues:

1. If you use the "checkout" button in the order summary and then leave and come back to the cart the product will no longer be in the cart. I verified this on the base AjaxCart (without my modifications/patch) so this is an issue with the AjaxCart itself. I will see if I can fix this and include it into my patch in 1.3.

ajaxcart_patch_mikedvb_v1.2.zip

Edited by MikeDVB
Link to comment
Share on other sites

There is an issue with the AjaxCart (even without my patch) if you order and configure a product but don't click the "checkout" or last "continue" button after the billing cycle choice but instead use the "Checkout" button in the "Cart Summary" the item will not be "Saved" to the cart.

 

I created this short video to show the issue in detail to make what I'm trying to say easier to understand:

http://www.screen-shot.net/2011-05-20_1413.swf

Link to comment
Share on other sites

Mike don't get me wrong I'm not usually a dickhead, but I can't stand you & your thread.

 

Stop giving it the large like you're some big programmer, there's nothing wrong with the new WHMCS (4.5), Matts done a great job, and these ridiculously amateur hacks can be done by ANYONE - you posting the code and attaching a zip file don't make you look like a pro mate.

 

4.5 > 4.4 in every aspect no contest (however, doesn't mean it's perfect - there's work to do - but as I've mentioned before it's a nice little step in the right direction).

Link to comment
Share on other sites

Mike don't get me wrong I'm not usually a dickhead, but I can't stand you & your thread.

 

Stop giving it the large like you're some big programmer, there's nothing wrong with the new WHMCS (4.5), Matts done a great job, and these ridiculously amateur hacks can be done by ANYONE - you posting the code and attaching a zip file don't make you look like a pro mate.

 

4.5 > 4.4 in every aspect no contest (however, doesn't mean it's perfect - there's work to do - but as I've mentioned before it's a nice little step in the right direction).

 

You're welcome to see it however you wish Baldy. Personally I see flaws in the default AjaxCart from 4.5.1 so I've done some work to fix it. Sure, they're simple language changes anybody could do but by creating the zip file you don't have to manually do it yourself. Even Matt himself said, in the ticket I have with him, that my changes are a good start. Sure, they're not some amazing re-write of the ajaxcart, but they're a big step in the right direction as far as the end-user experience (i.e. the experience of the customer).

 

I never said that WHMCS hasn't done a great job, but nobody is perfect and any piece of software will have bugs. I've developed in everything from Assembly all the way up to Basic for over 20 years myself from embedded devices, cellular devices, all the way up to desktop and server applications so I definitely do not give two cents about "looking like a pro." My only goal by doing so is to help others out who agree that the AjaxCart from 4.5.1 is a "little off" as far as the end-user experience.

 

Instead of coming here to troll, you could spend your time more productively - however - I do appreciate any and all feedback be it positive or troll-like.

Edited by MikeDVB
Link to comment
Share on other sites

Even Matt himself said, in the ticket I have with him, that my changes are a good start.

 

Give yourself a pat on the back.

 

Sure, they're not some amazing re-write of the ajaxcart, but they're a big step in the right direction as far as the end-user experience (i.e. the experience of the customer).

 

Big step, or minor (in a lot of cases irrelevant) change(s)?

 

any piece of software will have bugs.

 

It wasn't a bug, no matter how much you convince yourself. I assume it was only patched because of how minor it was to fix in proportion to how much of a fuss you were kicking up all over the internet.

 

I've developed in everything from Assembly all the way up to Basic for over 20 years myself from embedded devices, cellular devices, all the way up to desktop and server applications

 

Wow, have you applied for a Blue peter badge yet?

 

I definitely do not give two cents

 

I think you have your phrases all mixed up here.

 

Instead of coming here to troll, you could spend your time more productively - however - I do appreciate any and all feedback be it positive or troll-like.

 

A troll tries to get a reaction out of someone for their own entertainment. I am not entertained by you or this thread. You totally over reacted to a minor problem, slated WHMCS/Matt both here and Webhostingtalk. We've all gotta eat, and people that go around the web moaning about nothing, playing up and potentially denting reputation I have ZERO respect for.

 

You're in the web hosting business so you must've been small at one point (we all were); and so I'm sure you're all too familiar with the one or two rude, whinging, annoying customers that you wish'd just shutup and not give you such a hard time. Making your day long and hard and all because they're extremely awkward. Congratulations, you have just turned into that customer.

 

I don't wish to prolong this any further. I just wanted to drop by to let you know how much of a little girl you were (are) being, didn't want your whole bloody development history. I sincerely wish you the best of luck with your business, no hard feelings, I just think you were spoilt as a child.

 

Baldy.

Edited by baldy
typos
Link to comment
Share on other sites

 

A troll tries to get a reaction out of someone for their own entertainment.

 

....

 

I just wanted to drop by to let you know how much of a little girl you were (are) being

 

Baldy.

 

Really ? not a troll ? come on man, the cart was not working right, it had some flaws in it, which should be improved, i think Mike just got ticked off by Matt because it was so quickly stated to be working as intended, while it clearly wasnt perfect. Communication is key in customer support and i think things did not go they way either wanted. But calling names and belittling people, you are definitely a troll.

Link to comment
Share on other sites

But calling names and belittling people, you are definitely a troll.

 

Me giving my opinion and saying what I think makes me a troll? Alright then mate...:roll:

 

EDIT: You think if I were trolling I wouldn't be a little more subtle lol??

Link to comment
Share on other sites

I'm glad you're getting some humor out of this.

 

I about fell out of my chair laughing when I read this. I'm hear for the same reason as Mike. Feel the same pain.

 

Is there any wiki/document/forum thread that fully explains/outlines the new options or links for 4.5? I can't get the ajaxcart to work right either the old way or what I think is the new way? I've applied the patch and have the same results. I've been on this four hours now - I've found the pictures of the new templates, but not an actual list of working examples but I may have missed it.

 

Did not apply all Mike's patches. I'll just switch to the slider template until I can figure out the correct way to make the new ajax cart work. Personally, I probably wouldn't have invalidated all the old ajax cart links, just sayin . . .

Link to comment
Share on other sites

  • 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.

Guest
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