Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I'm using the following code for a data modifier:
public override Attempt<IProductVariantDataModifierData> PerformTask(IProductVariantDataModifierData value) { decimal valuePrice = value.Price; var customerContext = new CustomerContext(UmbracoContext.Current); if (!customerContext.CurrentCustomer.IsAnonymous) { var customer = (ICustomer)customerContext.CurrentCustomer; var priceAgreement = customer.AjourPriceAgreement(value.Name); if (priceAgreement != null) { var startDateConditionPassed = true; var endDateConditionMetPassed = true; var today = DateTime.Today; if (priceAgreement.StartDate != null && today < priceAgreement.StartDate.Value) { startDateConditionPassed = false; } if (priceAgreement.EndDate != null && today > priceAgreement.EndDate.Value) { endDateConditionMetPassed = false; } if (startDateConditionPassed && endDateConditionMetPassed) { //value.OnSale = true; //value.SalePrice = priceAgreement.Price; value.ModifyData("OnSale", true); value.ModifyData("SalePrice", priceAgreement.Price); } } } // value.Price = valuePrice; return Attempt<IProductVariantDataModifierData>.Succeed(value); }
The code resides in App_Code, hence, in merchello.config:
<taskChain alias="MerchelloHelperProductDataModifiers"> <tasks> <task type="AjourWebShop.Ajour.AjourProductPriceAgreementDataModifier, App_Code" /> <task type="Merchello.Web.DataModifiers.Product.IncludeTaxInProductPriceDataModifierTask, Merchello.Web" /> </tasks> </taskChain>
The problem is at runtime I get two errors about a lambda expression not being able to be compiled, and finally i get Model.FeatureProducts object null in FtStore.cshtml
Anyone, please, can you see what am I doing wrong ?
Anyone please ?
Here's one of the exceptions i get:
Apparently it is caused by the line:
var customerContext = new CustomerContext(UmbracoContext.Current);
inside AjourMerchelloExt.DataModifiers.Product.AjourProductPriceAgreementDataModifierTask.cs
Another exception is this:
Anyone, please ?
Hey friend, can you post the entire contents of your data modifier class? I may have an idea of what's wrong.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Price agreements thru data modifier task
Hi,
I'm using the following code for a data modifier:
The code resides in App_Code, hence, in merchello.config:
The problem is at runtime I get two errors about a lambda expression not being able to be compiled, and finally i get Model.FeatureProducts object null in FtStore.cshtml
Anyone, please, can you see what am I doing wrong ?
Anyone please ?
Rusty, please ?
Here's one of the exceptions i get:
Apparently it is caused by the line:
inside AjourMerchelloExt.DataModifiers.Product.AjourProductPriceAgreementDataModifierTask.cs
Another exception is this:
Anyone, please ?
Hey friend, can you post the entire contents of your data modifier class? I may have an idea of what's wrong.
is working on a reply...