Can't get discounts to work correctly... Get this "Failed to load requirement content"

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Nothing in the log.  It happens on all discount plugins.
5 years ago
I have fixed this.  I use cloudflare with Nopcommerce and to get that working with a shared SSL I had to do work arounds in the SSL Config.

The code is doing a call client side which shows up in the browser dev console, not the nopcommerce server log.  This complains about the call being to a non-ssl link and that it is blocked.

In the discounts controller, there is a method called GetRequirementUrlInternal.

Original:

            var url = $"{_webHelper.GetStoreLocation()}{discountRequirementRule.GetConfigurationUrl(discount.Id, discountRequirementId)}";

modified:
            var url = $"{_webHelper.GetStoreLocation(useSsl: true)}{discountRequirementRule.GetConfigurationUrl(discount.Id, discountRequirementId)}";

Steve.
3 years ago
For your situation, you can provide a small fix in source code.
In Nop.Web.Areas.Admin.Controllers.DiscountController
Method: GetRequirementUrlInternal

Current line:
var url = $"{_webHelper.GetStoreLocation()}{discountRequirementRule.GetConfigurationUrl(discount.Id, discountRequirementId)}";

Modified:
var settingService = EngineContext.Current.Resolve<ISettingService>();

var useSslForInternalUrl = settingService.GetSettingByKey("UseSSLForInternalUrl", false);

var url = $"{_webHelper.GetStoreLocation(useSsl: useSslForInternalUrl)}{discountRequirementRule.GetConfigurationUrl(discount.Id, discountRequirementId)}";


From AllSetting (/Admin/Setting/AllSettings)
Add this setting
Name: UseSSLForInternalUrl
Value: False (If you want http url, Local),
     True  (If you want https url, Live)
3 years ago
I cannot create a discount rule. The option does not appear when adding a group. The message that appears to me is that the group is empty. But it won't let me create the rule.
And other problem when i want to create a discount with role. A message said "Failed to load requirement content." I appreciate someone's help. I have nop commerce 4.2
3 years ago
If you've set up a Group, and see "The group is empty", then under that you will see section to "Add a new discount requirement".  Click the drop down (arrow to expand), and you should see your installed discount requirements. (Besides 'add group', you may only have the one out-of-the-box '...customer role' rule, if you did not install any others.)

RE:  "Failed to load requirement content"
Initially, open the browser developer tools (typically opened with F12), do some action, and see if any errors show up in the developer console.
Also, immediately go to System > Log to see if any details.
3 years ago
I have the same problem with 4.2 nopcommerce. Some can solve this problem? I need a solution! Thanks
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.