I am trying to implement my own ConversionStrategy for updating the basket items upon login. I have based my implementation on the documentation which states:
Creating a customized the basket conversion strategy can be
accomplished by adding a new class that inherits from
BasketConversionBase and implementing the Merge() method and then
introducing the type reference in the merchello.config.
public class MyType : BasketConversionBase
{
public override IBasket Merge()
{
// update basket item prices and return basket
}
}
This will not compile though, as I get the following error message:
'BasketConversionBase' does not contain a constructor that takes 0 arguments. Cannot access internal constructor 'BasketConversionBase' here.
I tried implementing the Merge() method instead of overriding it:
public class MyType : IBasketConversionBase
{
public IBasket Merge()
{
// update basket item prices and return basket
}
}
This does compile but will not trigger.
I am using Umbraco 7.5.3 with Merchello 2.2.1. I also tested with Merchello 2.3.0 but I am getting the same error.
How can I proceed with this?
Additional question: How would I go about implementing a conversion strategy for the reversed scenario - when a user is logging out?
It looks like you've found a logic error. The constructor in BasketConversionBase should be protected not internal. I'll raise the issue and get it resolved for the next release. I'll look at creating a patch build for you today ...
When a customer logs out a new anonymous customer is generated which creates an empty basket. Anything that was in the basket for the logged in customer is still there - so if they log in again, they will see it.
What do you need to do when the customer logs out?
I am handling multiple subscription types, which influence the price you pay for a product - the most expensive subscription type will give you the biggest discounts etc.
Additionally users must be able to purchase a product without logging in/without any subscriptions running, resulting in no discount. For this reason I would like to be able to modify the basket items upon login, so that the discounts are taken into account - this is what I am doing with the conversion strategy mentioned earlier.
Similarly I would like to persist the basket items upon logout, and change the prices of all items to base prices (no discount)...does this make sense?
I know it is probably a thought-up scenario, but I could imagine customers being confused, if they logged out and all their basket items were gone - especially when they are not required to login in order to purchase products.
Implementing a custom ConversionStrategy
Hello,
I am trying to implement my own ConversionStrategy for updating the basket items upon login. I have based my implementation on the documentation which states:
My setup is as follows:
My custom class sub-classing BasketConversionBase
This will not compile though, as I get the following error message: 'BasketConversionBase' does not contain a constructor that takes 0 arguments. Cannot access internal constructor 'BasketConversionBase' here.
I tried implementing the Merge() method instead of overriding it:
This does compile but will not trigger.
I am using Umbraco 7.5.3 with Merchello 2.2.1. I also tested with Merchello 2.3.0 but I am getting the same error.
How can I proceed with this?
Additional question: How would I go about implementing a conversion strategy for the reversed scenario - when a user is logging out?
BR Peter
Hey Peter,
It looks like you've found a logic error. The constructor in BasketConversionBase should be protected not internal. I'll raise the issue and get it resolved for the next release. I'll look at creating a patch build for you today ...
This is the issue:
https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Web/Workflow/BasketConversionBase.cs
Hey Rusty,
Thank you for responding - I am looking forward to getting the issue fixed :]
Do you have any suggestions how I can proceed with a logout ConversionStrategy to convert the basket items into anonymous basket items?
BR Peter
Hey Peter,
When a customer logs out a new anonymous customer is generated which creates an empty basket. Anything that was in the basket for the logged in customer is still there - so if they log in again, they will see it.
What do you need to do when the customer logs out?
Hey Rusty,
I am handling multiple subscription types, which influence the price you pay for a product - the most expensive subscription type will give you the biggest discounts etc.
Additionally users must be able to purchase a product without logging in/without any subscriptions running, resulting in no discount. For this reason I would like to be able to modify the basket items upon login, so that the discounts are taken into account - this is what I am doing with the conversion strategy mentioned earlier.
Similarly I would like to persist the basket items upon logout, and change the prices of all items to base prices (no discount)...does this make sense?
I know it is probably a thought-up scenario, but I could imagine customers being confused, if they logged out and all their basket items were gone - especially when they are not required to login in order to purchase products.
is working on a reply...