Hey, thanks for all your work on this plugin! I noticed a couple things that weren't working great for me and tried adjusting a few things.
Currently Register On Checkout is returning an empty string for both failed registration attempts and orders where no registration was attempted. This can make it difficult at times to accurately display the correct results message.
The updated code searches for a boolean value and returns it if one is found, otherwise it returns null. Null allows for clearer comparison in twig since testing a variable's length or if it is null can produce the same result for a false boolean value and an empty string. This way, testing if registered is null will prevent any messages from displaying when no registration was attempted.
I also added the clearRegisterSession function which can be called by a twig do tag after the register status and account have been stored in variables. This way the result messages can be displayed after checkout, but the httpSession variables can be cleared manually so you don't have to wait for the user session to expire for the messages to stop displaying on future requests.
Hey, thanks for all your work on this plugin! I noticed a couple things that weren't working great for me and tried adjusting a few things.
Currently Register On Checkout is returning an empty string for both failed registration attempts and orders where no registration was attempted. This can make it difficult at times to accurately display the correct results message.
The updated code searches for a boolean value and returns it if one is found, otherwise it returns null. Null allows for clearer comparison in twig since testing a variable's length or if it is null can produce the same result for a false boolean value and an empty string. This way, testing if
registered
is null will prevent any messages from displaying when no registration was attempted.I also added the
clearRegisterSession
function which can be called by a twigdo
tag after the register status and account have been stored in variables. This way the result messages can be displayed after checkout, but the httpSession variables can be cleared manually so you don't have to wait for the user session to expire for the messages to stop displaying on future requests.Let me know what you think!