HotcakesCommerce / hotcakes-commerce-core

The core of the e-commerce part of the overall solution. This is an ecommerce shopping cart solution built on top of the DNN (DotNetNuke) CMS. Anyone can do commerce online now!
https://mmmcommerce.com
MIT License
67 stars 55 forks source link

Issue #454 - Fix Abandoned Cart Email Bug #472

Closed libanlsilva closed 11 months ago

libanlsilva commented 11 months ago

Related to Issue

Fixes # https://github.com/HotcakesCommerce/hotcakes-commerce-core/issues/454 Abandoned Cart Email throwing exception

Description

The bug was occurring due to a null reference error when attempting to access the HccRequestContext object. The previous code did not properly initialize the _current object, leading to the null reference.

To resolve this issue, I added a check to ensure that the HttpContext.Current is not null. If it is null, I initialize the _current object as a new HccRequestContext instance. This ensures that the object is properly initialized and prevents the null reference error from occurring.

How Has This Been Tested?

I have thoroughly tested the changes in various scenarios, and the bug no longer occurs. The application now correctly handles the HccRequestContext object, ensuring smooth execution without null reference errors.

All emails for abandoned carts are being sent successfully.

Screenshots (if appropriate):

image

Img1. Emails sent successfully.

image

Img2. No exception in the Admin logs

Types of changes

Checklist: