Post by Shineslo » Thu Jun 06, 2019 7:01 pm

In OC 1.5.6.4. with Journal 2 theme and Quick Checkout, I want to achieve, that the quantity updates without clicking on update button.

I managed to do that in CART. According to the code I found here and put it in catalog/view/theme/YOURTHEME/template/checkout/cart.tpl:
<script type="text/javascript">
$("input[name^='quantity']").change(function() {
$("input[name^='quantity']").closest('form').submit();
});
</script>

I want to do the same in Quick Checkout from Journal 2 theme, which is even more important than cart. I managed to make it work, but it works only on a computer, but not on touch devices.

On the line 521: $(document).delegate('.checkout-product .input-group .btn-update', 'click', function () {
I changed 'click' to 'keyup click' and this works on a computer.

For touch devices I've been trying with touchend, touchmove combinations, but I cannot get it to work. Can someone please help what I need to write that auto quantity will be updating when there is a input, instead of hitting update button everytime.

Here is the original code from checkout.tpl:
$(document).delegate('.checkout-product .input-group .btn-update', 'click', function () {
var key = $(this).attr('data-product-key');
var qty = $('input[name="quantity[' + key + ']"]').val();
$.ajax({
cache: false,
url: 'index.php?route=journal2/checkout/cart_update',
type: 'post',
data: {
key: key,
quantity: qty
},
dataType: 'json',
beforeSend: function() {
triggerLoadingOn();
$('#cart > button > a > span').button('loading');
$('.checkout-cart').addClass('checkout-loading');
},
complete: function() {
triggerLoadingOff();
$('#cart > button > a > span').button('reset');
},
success: function(json) {
setTimeout(function () {
$('#cart-total').html(json['total']);
}, 100);

if (json['redirect']) {
location = json['redirect'];
} else {
$('#cart ul').load('index.php?route=common/cart/info ul li');

$(document).trigger('journal_checkout_reload_payment');
$(document).trigger('journal_checkout_reload_shipping');
}
}
});
});

Newbie

Posts

Joined
Tue Sep 10, 2013 5:07 pm

Post by D3MO » Sat Jun 08, 2019 4:48 am

I doubt that yoiu will get a free help for such a request as it will take time to make it work (testing and so on) but you walking right path to use ajax calls to update the page on change event

Opencart Expert | voldemaras@gmail.com
Skype - programanija | Gtalk - voldemaras@gmail.com
Extensions for Opencart @ https://www.opencartextensions.eu / or Opencart Marketplace

Need Custom Module? debug third party module or simply have any question related to Opencart? feel free to contact directly for a live chat session:) - INSTANT LIVE CHAT


User avatar
Active Member

Posts

Joined
Mon Apr 04, 2011 6:57 am

Post by cedcommerceteam » Tue Jun 11, 2019 6:37 pm

Hello Shinesio,

As in touch screen phones 'keyup click' won't work, try to make it on 'onclick' function, don't have idea about touchend & touchmove as I have used click function for mobile phones as well.

Thanks & Regards :

Call us at : (+91) -7234976892 , Skype: live:support_35785 , Email: support@cedcommerce.com

Image


User avatar
New member

Posts

Joined
Wed Aug 09, 2017 9:02 pm
Who is online

Users browsing this forum: No registered users and 55 guests