Page 1 of 1

One Update Cart Button

PostPosted: Tue Oct 15, 2019 4:43 pm
by spike1968
Hi Stan,

I have found this code
Code: Select all
<p><a class="button btn btn-active" href="index.php?option=com_onepage&amp;task=clearcart">Clear Cart</a></p>

for clearing the cart.

Is there a similar snippet that will allow one button only to update the cart?

For example

Code: Select all
<p><a class="button btn btn-active" href="index.php?option=com_onepage&amp;task=updatecart">Update Cart</a></p>


Thanks in advance

Cheers
Martyn

Re: One Update Cart Button

PostPosted: Wed Oct 16, 2019 11:18 am
by admin
hello martyn, yes, there is a theme which has a single button to update all quantities, you can check "black" theme and it's demo is available here:

https://php73.rupostel.com/mero/index.php/en/cart

(add a few products to the cart)

the most important files to handle this functionality are

tabcontent.js (includes the function updateAll referenced from the button in basket.html.php )
update_form_ajax.tpl.php

includes definition of the input box that is then used in ajax code:
Code: Select all
<input onchange2="return Onepage.updateProduct(this);" type="text" title="<?php echo OPCLang::_('COM_VIRTUEMART_CART_UPDATE'); ?>" rel="<?php echo $product->cart_item_id.'|'.md5($product->cart_item_id); ?>" class="inputbox opcq updatebtn" size="3" name="quantity" id="quantity_for_<?php echo md5($product->cart_item_id); ?>" value="<?php echo $product->quantity; ?>" />


to use "onchange" event you can try to rename onchange2 to onchange

best regards, stan