New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notice: Undefined index: line_item_id in uc_discounts_uc_order() #19
Comments
I, too, saw the line item applied twice in my testing, so this is definitely a bug. More investigation to come! |
@nattywebdev, PR #19 fixes both the |
Test of uc_discounts-19_fix_line_items Testing Steps: 1.1. Install uc_discounts-19_fix_line_items 1.2. Enabled setting: Max uses = 1 1.3. Clear cache and logout. 1.4. Trial order by entering the same discount code twice. 1.5. Press Review order button 1.6. Error: Call to undefined method DatabaseStatementBase::fetchArray() Recent log messages: Error: Call to undefined method DatabaseStatementBase::fetchArray() in uc_discounts_get_discounts_for_order() (line 1624 of /home/nesppjzl/public_html/modules/uc_discounts/uc_discounts.module). 1.7. Change settings Max uses = 0 (back to default value) 1.8. Clear cache and logout. 1.9. Trial order by entering the same discount code twice. 1.10. Press Review order button 1.11. No Error. I see an order overview where only one discount code is charged, even though the same code was entered twice in the previous step. 1.12. Send order pressing button 1.13. The order has been sent. A message that a discount code has been applied to the order. 1.14. The customer receives an e-mail about the placed order. The discount was only charged once, even though the discount code was entered twice. 1.15. An administrator receives an e-mail about a placed order. The discount was only charged once, even though the discount code was entered twice. 1.16. Viewing the order in the order list in the store administration. It appears that the discount code has been entered twice, but the discount has only been applied correctly once. I am attaching screenshot 1 and 2. Test 2 The actions are the same as before, but the same code is entered three times. Same result - the discount was correctly applied only once, regardless of the fact that the same code was entered three times. No error messages. When reviewing the order in the store administration, he does not see the triple charging of the same code and the correct charging of the discount only once. I am attaching screenshot 3 and 4. Test 3 No error messages. Emails to customer and admin show that the total price was reduced only once with the one discount code, even though two different codes were entered. I am attaching screenshot 5 and 6. Test 4 4.1 Trial order by entering the discount code once. 4.2 Press Review order button The order view shows that no discount has been applied because the order is for a total price below the minimum discount price. I go back to adjust the amount of goods in the shopping cart. The discount code entered with action 4.1 is saved as entered in the discount code field. I am reviewing the order again. There are no errors. I am sending the order. The order was sent normally. Checking the order in the store administration shows the discount code to be charged correctly, no double charging as a result of editing the order and returning with the Back button to change the order details - which was a problem before with discount codes. Final tests I made a few more orders. I entered the same code multiple times, entered two different codes in the discount code field. In all cases, the discount is charged only once, and if two different codes are entered, the system charges a discount only for the first code. I went back and edited the order parameters before submitting it. Conclusions: The discount codes work normally, the discount is charged correctly. Only the error described in item 1.6 remains a problem. It appears when entering a value of 1 instead of 0 in each of three fields: Max uses If 0 is changed to 1 in these three fields, a message about this error is displayed and the order is not executed. However, I don't understand what these fields are supposed to be for, I try using them to limit the charging of a discount codes multiple times. Currently the module works the way I expect in terms of charging a percentage off when entering a discount code without having to change the value to 0 for these three fields. Note: On screen error message is always: Call to undefined method DatabaseStatementBase::fetchArray() But in Recent log messages error messages are as follows: Error: Call to undefined method DatabaseStatementBase::fetchArray() in uc_discounts_get_discounts_for_order() (line 1624 of /home/nesppjzl/public_html/modules/uc_discounts/uc_discounts.module). Error: Call to undefined method DatabaseStatementBase::fetchArray() in uc_discounts_get_discounts_for_order() (line 1639 of /home/nesppjzl/public_html/modules/uc_discounts/uc_discounts.module). Error: Call to undefined method DatabaseStatementBase::fetchArray() in uc_discounts_get_discounts_for_order() (line 1654 of /home/nesppjzl/public_html/modules/uc_discounts/uc_discounts.module). System: Backdrop - 1.25.1 |
Hi @amilenkov, thanks for the testing. The fetchArray() error is fixed in the dev version; sorry, I should have been clearer about testing. Your test confirms that the PR fixes this issue, so I'm going to go ahead and merge it in, then do a new release so that the current version contains both fixes. Thanks again! |
Issue #19: Fix line_item_id warnings and double-discount. Thanks to @nattywebdev and @amilenkov!
@bugfolder I can confirm both of the issues originally mentioned above are fixed for me with #21 - thank you so much. |
After successfully applying a discount to a line item, I'm now seeing a php notice after selecting a billing address in the checkout page:
Notice: Undefined index: line_item_id in uc_discounts_uc_order() (line 268 of //web/modules/uc_discounts/uc_discounts.module).
Can you advise on the possible cause (if I'm doing something wrong), or is this a bug?
I'm new to Ubercart so learning as I'm going!
See screenshot for clarity.
The text was updated successfully, but these errors were encountered: