Hello, I'm having the following issue with the Ubercart Discounts module: The module has been activated and is working without problems so far (more then 6 months) as follows: a 10% discount is charged on every order that has a total value of more than 50 currency units. To use the discount, a discount code must be entered during the ordering process (the "Require code to activate discount" field is activated) by entering various randomly generated six-digit codes. The site owner sends these codes to customers at his discretion in connection with promotions and advertising campaigns. So far everything is fine and the site has been running successfully on this website and discount system is working normally with dozens of orders already completed using a discount code. The problem arose because it is possible for a site visitor to enter the discount code more than once in the same order and the site would charge the discount as many times as the same code was entered in the discount code entry field at checkout on order. Checking the order with multiple discounts in the orders list shows that the discount for the same code has been charged multiple times in the same order - as many times as the same code has been entered. I have tried to limit the possibility of using the same code multiple times on the same or on different orders through the following options in the module administration and settings of this type of discount: Max uses Max uses per user Max uses per code By default, all three options have a value of 0. If I replace 0 with 1 to make the discount code usable once, for each of the three options (“Max uses”, “Max uses per user”, or “Max uses per code”), when placing an order with a discount code, an error message appears after completing an order: Call to undefined method DatabaseStatementBase::fetchArray() The message is the same whether “Max uses”, “Max uses per user”, or “Max uses per code” is set to 1. After such an error message, an order is not registered by the system, the customer and the store administrator do not receive emails about a new order. If no discount code is entered, the order is processed and registered in the system, but without a discount.

I go back to the module administration and enter a value of 0 as the default for the fields “Max uses”, “Max uses per user”, or “Max uses per code”. The error is no longer displayed, orders are processed normally, but the possibility of entering the same code several times during the order remains.

I don't know if this behavior is due to a bug in the module or a misconfiguration on my part. The desired result is that the module works so that the same discount code can be used only once on the same order, but by an indefinite number of buyers, including those who are not yet registered in the system and are making their first order (and who have been sent a discount code).

Backdrop - 1.25.1

Ubercart - 1.x-3.14.2

Ubercart Discounts - 1.x-2.0.5



Multiple discounting with one code occurs when from cart/checkout/review the visitor returns with the back button to cart/checkout (with the discount code remaining entered in the discount code field) and then navigates again to cart/checkout/review and then submit the order.

Interestingly, no matter how many times (two, three or five times) the buyer returns to cart/checkout to edit the order and then goes back to cart/checkout/review - the discount code is always charged only twice.

Amilenkov, check the issue queue for the module. There is a fix for the database error. I think the maintainer is working on a solution for the repeating entries.

Thanks so much for the quick feedback!