News:

Looking for documentation? Take a look on our wiki

Main Menu

I can't add product to a cart from a mobile device

Started by borro, March 17, 2016, 16:09:40 PM

Previous topic - Next topic

borro

Hello!

If you browse this site from a desktop computer and press "Добавить в корзину"(Add to cart button) for some product, the cart is filling. But when you try to add something to cart from your mobile device the cart remains emty. What can it be?

VM 3.0.9
Wish you happiness!

Milbo

I would say it depens on the mobile, or? jquery error?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

borro

#2
Quote from: Milbo on March 17, 2016, 21:25:37 PM
I would say it depens on the mobile, or? jquery error?
Hello, Milbo.

While usb debugging of my mobile Chrome 42.0.2311.111 I've found out that in a mobile device there is no event handler for the "click" event of the <input type="submit" name="addtocart" class="addtocart-button" value="Добавить в корзину" title="Добавить в корзину"> button.
This default event handler with the code
Virtuemart.addtocart = function (e){...
is presented in a linked /components/com_virtuemart/assets/js/vmprices.js?vmver=8847 file
So this event handler is presented in a desktop Chrome but it's not assigned in a mobile Chrome
What could be the cause of this situation?
Can it be due to a big page load time?
Can Chrome 42.0.2311.111 be the broken version of Chrome? A lot of humans can't add products to their carts. I can't ask them to use some other correct browser. I looking for some solution of the problem
Wish you happiness!

borro

#3
I saw only one "GET http://cdn.pozvonim.com/files/widget/ 403 (Forbidden)" error in a console while debuging mobile Chrome via usb. But it seems it can not be the reason of the issue, because it's connected with a third party call widget from www.pozvonim.com.

The next thing I've found is that the default event handler defined in vmprices.js is working inspite of its absence in a list of all handlers for the event "click" on a input.addtocart-button element

The second thing I've found is that this function

jQuery.ajax({
        type: "POST",
        cache: false,
        dataType: "json",
        url: window.vmSiteurl + "index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS&format=json"+vmLang,
        data: dat
    })

defined approximately at row 82 in vmprices.js(inside Virtuemart.cartEffect = function(form) {... ) is working fine for the desktop Chrome and working badly in my mobile Chrome 42.0.... although it takes the same input data.
Do you have any ideas why does the standard jquery ajax function is working defferently on a desctop Chrome and on a mobile Chrome?
Could it be the reason is some timeouts, memory limitations?.. any ideas are welcome :)
Wish you happiness!

borro

Think i found the cause. When i enabled cookies in my mobile browser the cart start filling.

Why do the turned off cookies stop the cart filling? I want to make it work inspite of turned off cookies may be by means of sessions. But first i need to undestand how cookies influence the cart update process. Please help
Wish you happiness!