If a user changes the default quantity and then changes a attribute, uc_acc reverts automatically back to the default_qty.

Changing line 55 from the module from:

  $form['qty']['#default_value'] = $product->default_qty

to:

      // use qty from post or use default qty
      $qty = intval($_POST['qty']);
      if ($qty <> 0) {
        $form['qty']['#default_value'] = $qty;
      }
      else {
        $form['qty']['#default_value'] = $product->default_qty;
      }

Helps uc_acc remembering.

Thanks for the great module!
(ps might make a patch later...)

CommentFileSizeAuthor
#3 uc_aac-657052_2.patch2.88 KBjantoine
#1 uc_aac-657052.patch943 bytesjantoine

Comments

jantoine’s picture

Status: Active » Needs review
StatusFileSize
new943 bytes

Splash112,

Thanks for catching this bug and providing a fix. I have created a patch. It is slightly different. I did not want to alter the value in the qty box at all, so we'll just check to see if it has been set and if so, we'll use the value stored there.

Cheers

Antoine

splash112’s picture

Hi Antoine

Thanks for your quick reaction.
Looks ok to me, except it might pose a security risk. There is no way of knowing what's inside the post, could be anything (same btw for the nid). (ps. I'm not a security expert...)

jantoine’s picture

StatusFileSize
new2.88 KB

splash112,

You're absolutely right, I should be checking all user input. Attached is a new patch that does just this. Let me know if you see any issues with this patch.

Cheers,

Antoine

jantoine’s picture

Status: Needs review » Fixed

I have been using this code for a while without any issues. This patch has been committed to the repository.

Cheers,

Antoine

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.