• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Cliff
#1 Posted : Wednesday, December 27, 2006 10:29:26 PM(UTC)
Cliff

Rank: Member

Joined: 5/24/2004(UTC)
Posts: 4,147

It's been brought to my attention, and I've noticed it now too, that AJAX stuff in BVC5 can sometimes take as long as 10 seconds to load on certain connections. Product modifiers, for instance. Even 3 seconds without notice that something is going on is too much.

I've also noticed that if I'm rapid-typing my way through checkout using the tab key, selecting the State causes a delay before I can type in the Zip Code box while Anthem does whatever it's doing. It doesn't let me know that it's doing something, so I keep typing until I notice that nothing is being entered.

Is there a way to tell Anthem to show a loading image or text during load, then hide on complete?
JohnRossey
#2 Posted : Thursday, December 28, 2006 9:09:24 AM(UTC)
JohnRossey

Rank: Member

Joined: 8/28/2004(UTC)
Posts: 463

I've noticed this on multiple shops myself. It's really bad on my satellite connection, as much as a couple minutes for the page to renew itself...especially irritating on the checkout pages...
John Rossey Productions
[color=gray>Flash,][/color]
[email protected]
http://www.johnrossey.com/
http://www.toocoolwebs.com
Andy Miller
#3 Posted : Thursday, December 28, 2006 9:09:41 AM(UTC)
Andy Miller

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 2,136

Was thanked: 1 time(s) in 1 post(s)
Cliff,


There sure is. Let's look at One Page Checkout\Checkout.aspx for example. The state DropDownList looks like this:


Code:

<anthem:DropDownList ID="ShippinglstState" runat="server" AutoCallBack="true" TextDuringCallBack="Please Wait..." TabIndex="1110"></anthem:DropDownList>

All of the Anthem controls that can make a callback have a property called TextDuringCallBack. As you can see in the source, TextDuringCallBack="Please wait...", but as you also noticed, this text does not seem to appear anywhere. The reason is that the DropDownList control does not have any natural text to set during the callback. For example, if this had been a Button, then the text of the button would change to "Please wait..." during the callback.



When Anthem can not find a natural text value to change it looks for an associated <label> control instead. So one fix in this case is to associate a real <label> with the DropDownList. For example change,



Code:

<td class="formlabel">State, Zip:</td>

to this


Code:

<td class="formlabel">

<asp:Label runat="server" AssociatedControlId="ShippinglstState">State, Zip:</asp:Label>

</td>


After making this change the state label "State, Zip:" will change to "Please wait..." during the callback. Note that you can put the associated label anywhere on the page, it does not need to be the actual label.



As you know Gmail does something a little different. Every time you do something in gmail that causes a callback, gmail will display "Please wait..." (or something similar) in a colored box at a fixed location of the viewport (top right I think). You can do something similar with Anthem controls using pre- and post- callback functions. For example put this <div> on your page:



Code:

<div id="wait" style="display:none">Please wait...</div>

Then define these two js functions:


Code:

function Before() {

document.getElementById('wait').style.display = 'block';

}



function After() {

document.getElementById('wait').style.display = 'none';

}

Now there are two ways to invoke these functions. If you want specific controls to use them, use PreCallBackFunction and PostCallBackFunction like this:


Code:

<anthem:DropDownList ID="ShippinglstState" runat="server" AutoCallBack="true" TextDuringCallBack="Please Wait..." TabIndex="1110" PreCallBackFunction="Before" PostCallBackFunction="After"></anthem:DropDownList>

If you want all callbacks to use them, add this to your page:


Code:

function Anthem_PreCallBack() { Before(); }

function Anthem_PostCallBack() { After(); }


These Before and After functions are a little simple minded. If you make multiple callbacks (e.g. change the country and the zip very quickly), then the first After will hide the <div> even though the slower callback is still running. A more intelligent Before/After would use some kind of counter and maybe a timer to keep track. You can disable most controls during callback so you don't get two clicks. For example,



Code:

<anthem:Button runat="server" EnabledDuringCallBack="false">Click Me!</anthem:Button>

And you can combine EnabledDuringCallBack with TextDuringCallBack:


Code:

<anthem:Button runat="server" EnabledDuringCallBack="false" TextDuringCallBack="Running...">Click Me!</anthem:Button>

And finally, ImageButton has a similar property called ImageDuringCallBack. I'm sure you can guess how it works.
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing
Matt@9BallDesign
#4 Posted : Thursday, December 28, 2006 10:06:45 AM(UTC)
Matt@9BallDesign

Rank: Member

Joined: 12/23/2003(UTC)
Posts: 909

Bookmarked...


Andy, you should be a technical writer.
Matt Martell


http://www.9balldesign.com - Web, Print, Graphic


http://www.martellhardware.com/ - Decorative & Builder's Hardware

------------------------------------------------
Cliff
#5 Posted : Thursday, December 28, 2006 7:22:20 PM(UTC)
Cliff

Rank: Member

Joined: 5/24/2004(UTC)
Posts: 4,147

No doubt, thanks Andy!

I found the Anthem site and the function Anthem_PreCallBack() thing while I was waiting for the moderation on my post, so I did this last night:
Code:
<script type="text/javascript">
    function Anthem_PreCallBack() {
        new Element.show('anthemLoading');
    }
    function Anthem_PostCallBack() {
        new Effect.Fade('anthemLoading');
        new Effect.Pulsate('ctl00_MainContentHolder_lblSitePrice');
    }
</script>

I'm using Prototype and Script.aculo.us for some product image lightboxing on the product page, so that's what the js is. It seems to work pretty well, but I see what you're talking about in the simple-mindedness of it. I wasn't having much luck with the TextDuringCallBack and EnabledDuringCallBack, but I was probably using it in the wrong place, so I'll give it another shot.

Thanks again, I'm getting some cool results from this.
Marcus
#6 Posted : Friday, December 29, 2006 9:07:48 AM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

Thanks Andy! We should try and get this into the next service pack to help smooth out the experience for slow connections.

BTW: I just saw the other day that 80% of the active internet users in the US have broadband connections.
JohnRossey
#7 Posted : Saturday, December 30, 2006 10:23:34 AM(UTC)
JohnRossey

Rank: Member

Joined: 8/28/2004(UTC)
Posts: 463

I don't know how it acts on a slow connection, but depending on what type of broadband they have it doesn't matter. My satellite broadband is lightning fast but takes forever with the ajax stuff...not just with the Anthem but on other stores on other platforms as well...something to do with latency....loads the pages and graphics really fast but doesn't do well with those callbacks or with SSL for that matter...so combine the two ala the checkout page and it's REALLY slow for me
John Rossey Productions
[color=gray>Flash,][/color]
[email protected]
http://www.johnrossey.com/
http://www.toocoolwebs.com
Chris Dittmeier
#8 Posted : Saturday, December 30, 2006 3:05:47 PM(UTC)
Chris Dittmeier

Rank: Member

Joined: 1/3/2004(UTC)
Posts: 1,497

My understanding of satellite internet access is that the downlink is fast, but the uplink is slower than most other connections. It has been awhile since I last read up on this topic, so maybe things have changed.
Chris
Sirius Programming

www.siriusprogramming.com
CodeSine
#9 Posted : Saturday, December 30, 2006 3:05:51 PM(UTC)
CodeSine

Rank: Member

Joined: 11/18/2003(UTC)
Posts: 1,465

John, isn't satellite 1 way? Your download is fast but you have to use the phone line for upload? I don't know of any satellite service offering bi-directional service. So if this is the case there is no wonder postbacks are slow.
TIM

BVC Add-Ons and Development
Andy Miller
#10 Posted : Saturday, December 30, 2006 4:47:32 PM(UTC)
Andy Miller

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 2,136

Was thanked: 1 time(s) in 1 post(s)
I'd be curious to see the results of a speed test,


http://www.dslreports.com/speedtest



I just ran 2 tests from Portland, OR to Miami, FL and got



1466 kbps download / 710 kbps upload

1610 kpbs download / 700 kbps upload
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing
Cliff
#11 Posted : Saturday, December 30, 2006 4:47:39 PM(UTC)
Cliff

Rank: Member

Joined: 5/24/2004(UTC)
Posts: 4,147

Most of the satellite services I've seen lately are 2-way, though upload speeds are quite a bit slower than other forms of broadband.

I, too, have noticed on my cable connection that AJAX calls can take much longer than loading pages. Not sure why...
Andy Miller
#12 Posted : Saturday, December 30, 2006 7:37:49 PM(UTC)
Andy Miller

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 2,136

Was thanked: 1 time(s) in 1 post(s)
There is javascript overhead on both ends of an AJAX callback. Anthem will scan every form element to create a callback with all the form values (something the browser does naturally for a postback). Some AJAX libraries do not perform this step. When the callback response is received Anthem will parse the response and update the appropriate elements on the page. Anthem formats the callback response as a JSON object so the actual parsing is about as fast as can be. Some AJAX libraries return XML which can take much longer to parse.

Surprisingly (to me at least) updating individual elements on the page can take quite a while...especially if any tables are involved. So you can often get a noticible improvement in response time by minimizing the number of elements that are updated. Try to avoid using <anthem:Panel> for large portions of the page. Also try to avoid setting AutoUpdateAfterCallBack="true".
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012