Post by xinxilas » Wed Jun 06, 2018 1:15 am

For example if you are at an category, using mobile, the scrollbar is some pages below, when i click on "Add to Cart", it should appear the greeny message and the scrollbar automatically goes to top following the greenish message right?

But this is taking too long when using mobile...
You can test here:
www.mercadoelite.com.br (at my site it taking a little bit more time)
and here
demo.opencart.com (it has the delay too)

Im testing using a s7, its a good phone

I believe it isn't the delay to "cart.add" function to process on server-side, because when you add an item to cart using Desktop(using a small window to emulate mobile version) it runs instantaneous

What possible can cause this?
Is there any way to optimize that?

New member

Posts

Joined
Mon Apr 27, 2015 7:46 am

Post by kestas » Wed Jun 06, 2018 1:39 am

Hi, I have tested your site with android china phone and it is working fine. No delay....

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by xinxilas » Wed Jun 06, 2018 2:24 am

I made a video:
edit: this one is better https://streamable.com/4iudv

New member

Posts

Joined
Mon Apr 27, 2015 7:46 am

Post by xinxilas » Wed Jun 06, 2018 5:23 am

kestas wrote:
Wed Jun 06, 2018 1:39 am
Hi, I have tested your site with android china phone and it is working fine. No delay....
I tested using another device and got the same delay.

It not because of the animation, the delay happens also to when the buy link redirects you to the product page (in case you have options enabled in the product), but I do not understand why this does not happen by accessing the PC, only on mobile
PS: Its not the connection neither

Here is the cart.add script:

Code: Select all

var cart = {
	'add': function(product_id, quantity) {
		$.ajax({
			url: 'index.php?route=checkout/cart/add',
			type: 'post',
			data: 'product_id=' + product_id + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1),
			dataType: 'json',
			beforeSend: function() {
				$('#cart > button').button('loading');
			},
			complete: function() {
				$('#cart > button').button('reset');
			},
			success: function(json) {
				$('.alert-dismissible, .text-danger').remove();

				if (json['redirect']) {
					location = json['redirect'];
				}

				if (json['success']) {
					$('#content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');

					// Need to set timeout otherwise it wont update the total
					setTimeout(function () {
						$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
					}, 100);

					$('html, body').animate({ scrollTop: 0 }, 'fast');

					$('#cart > ul').load('index.php?route=common/cart/info ul li');
				}
			},
			error: function(xhr, ajaxOptions, thrownError) {
				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
			}
		});
	},

New member

Posts

Joined
Mon Apr 27, 2015 7:46 am

Post by sw!tch » Wed Jun 06, 2018 6:07 am

Are you browsing the site in private mode / incognito ? Try turning that off.

Older android phones lack browser performance, you won't get the same performance vs a desktop browser. We build a lot of hybrid mobile apps and it's a pain to get decent performance on older android devices.

In any case - Your site works fine on a Galaxy S8 and Chrome, as well as an iPhone X .

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by xinxilas » Wed Jun 06, 2018 10:38 pm

The private isnt the problem, ive tested both ways

Sometimes it laggs sometimes it dont,
But most of the time it lags, it happens only when i have many CART.ADD function on same page, for example at the category.twig page

:(

As you can see in the video, at Product page, both links works okay

But at category page, if you press button with CART.ADD(the Buy buttom), it has a boring delay, in both situations(i mean, situation 1: CART.ADD sends you to the propduct page, situation 2: it already adds the product do the cart)
Can you test again? (i believe 20% of time it works okay, 80% not)

When you click AT LINK (at the product name, or prodcut thumb, instead of buttom), it goes faster to the product page
Im trying to make the most fluid site as possible, everything was very smooth, so i found this problem now :(

The only possibility to fix it i'm seeing now is removing button and use it as a link, removing add to cart feature, which is bad :(

New member

Posts

Joined
Mon Apr 27, 2015 7:46 am

Post by xinxilas » Thu Jun 07, 2018 8:46 am

I read some people complaining about ajax > json at mobile too

Ill be very very grateful if someone has any tip about fixing that

New member

Posts

Joined
Mon Apr 27, 2015 7:46 am

Post by IP_CAM » Thu Jun 07, 2018 12:09 pm

Well, instead of trying to beat the System, you could first make sure, to have
everything done, required to at least reach the system Limit!
Still, it's fast, just rather heavy on load!
Good Luck! ;)
Ernie
---
https://gtmetrix.com/reports/www.mercad ... r/VIdSocia
---

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: Semrush [Bot] and 520 guests