News:

Looking for documentation? Take a look on our wiki

Main Menu

Can't uncheck checkbox shopper field on order modify

Started by sandomatyas, March 07, 2022, 18:54:49 PM

Previous topic - Next topic

sandomatyas

Steps to reproduce

  • create a checkbox type shopper field
  • place an order
  • open the order in admin
  • if you didn't check the checbox during the order, check it and save the order -> it'll store the checked state
  • uncheck the checkbox and save the order
  • the checkbox is still checked

It's because checkbox isn't processed on post if it's not checked.
Quick fix: in administrator/components/com_virtuemart/orders/tmpl/order.php there is a
foreach ($this->userfields['fields'] as $_field ) {

echo ' <tr>'."\n";

After the foreach I put this
if ( $_field['type'] == 'checkbox' )
{
echo '<input type="hidden" name="' . $_field['name'] . '" value="0" />';
}

So if the checkbox is not checked and submitted, there is a "default 0 value" from the dummy hidden field