abantecart-src icon indicating copy to clipboard operation
abantecart-src copied to clipboard

Issue in coupon listing grid not showing the correct on/off status

Open handoyo opened this issue 2 years ago • 6 comments

Hi admins,

We found out that in AbanteCart v1.3.2, the coupon listing grid is not showing the correct on/off status like in the edit page status.

This is what the listing grid shows: image

While in the edit coupon page: image

I checked the core code and found out that in the model. The coupon status is based on $sqlDateRange = "(CASE WHEN c.date_start < NOW() AND c.date_end > NOW() THEN 1 ELSE 0 END)";, not the actual coupon status.

Is this intentionally changed or is it a bug?

handoyo avatar Jul 06 '22 18:07 handoyo

Did you change coupon status in the grid? If yes, please reload page

BasaraABC avatar Jul 07 '22 07:07 BasaraABC

yes i did. coupon status is the listing grid are not changed.

handoyo avatar Jul 07 '22 07:07 handoyo

Please post all coupon settings and step-by-step what did you do.

BasaraABC avatar Jul 07 '22 08:07 BasaraABC

I create a new coupon: Status: Off Coupon Name: Test Coupon Description: Testing Code: test Type: Percentage Discount: 10.00 Date Start: 07/06/2022 Date End: 07/09/2022 Uses Per Coupon: - Uses Per Customer: -

When i open the coupon listing grid, the coupon status is turned ON, but in the edit page the status is OFF

handoyo avatar Jul 07 '22 08:07 handoyo

Hi Basara - Lee here - let me add clarity here- this action is the same in all the 1.3.2 installations we have.
in 1.3.2 cart versions it seems the coupon grid keys off the coupon date for reporting the on/off condition.
If the edit page is set to off, the coupon does not work in the cart which is correct action. But in order to get the grid to report correctly one has to change the edit page stop date to at least one day earlier than the current date - then grid will show off setting, the same as edit setting. That is new behavior in cart 1.3.2 We are running PHP 8.0 in all our installations.

Unless the expiring date is manual changed. it does not matter how many times we set the grid to off. It will show off UNTIL we leave the grid page and come back to it, or refresh the page - it will have reverted to the ON condition, even with the edit page still off.

goatlady102 avatar Jul 07 '22 13:07 goatlady102

@abolabo to replicate create the coupon with params described by handoyo, next set status to OFF and click save button (at the very bottom of page). then go to the listing grid. The status showed as ON. I think we should separate status from the date range.

BasaraABC avatar Jul 08 '22 05:07 BasaraABC

Hi @BasaraABC and @abolabo ,

I tested again on 1.3.3 and found out that the issue still occurs. I tried to turn ON via the listing grid, saved the status and when i refresh, the status is still OFF.

A fix would be appreciated.

Thanks.

handoyo avatar Nov 08 '22 02:11 handoyo

@handoyo . please check activation date range of coupon. It's not a bug.

abolabo avatar Nov 08 '22 09:11 abolabo

I think we should separate status from the date range.

BasaraABC avatar Nov 08 '22 09:11 BasaraABC

@BasaraABC how it can be an active within non-current date range? i think all works fine there

abolabo avatar Nov 08 '22 09:11 abolabo

Please read the description again. The case of the bug: listing shows ON but coupon details show OFF. Should be consistent (whatever approach you choose status should show the same in the listing and details page).

BasaraABC avatar Nov 08 '22 09:11 BasaraABC

The issue is not fixed. status

https://github.com/abantecart/abantecart-src/assets/2631910/45a3fb6c-143d-486d-810c-ba0b1e085966

BasaraABC avatar Jul 05 '23 09:07 BasaraABC