Hi all,
Im moving the checkout attributes from being part of the shopping cart, to being part of the checkout. This means the checkout attributes will be shown on the ConfirmOrder view.
To do so, I have added a method to the CheckoutAttributeService called GetCheckoutAttributeWarnings which is essentially the same as the Shopping Cart Method GetShoppingCartWarnings. The ShoppingCartService had a constructor parameter for the ICheckoutAttributeParser. I have removed it and all works fine.
However, when I added it to the CheckoutAttributeService constructor I always get the error message "No parameterless constructor defined for this object". What is wrong with this code:
#region Fields
private readonly IRepository<CheckoutAttribute> _checkoutAttributeRepository;
private readonly IRepository<CheckoutAttributeValue> _checkoutAttributeValueRepository;
private readonly ICheckoutAttributeParser _checkoutAttributeParser;
private readonly IEventPublisher _eventPublisher;
private readonly ICacheManager _cacheManager;
private readonly ILocalizationService _localizationService;
#endregion
#region Ctor
/// <summary>
/// Ctor
/// </summary>
/// <param name="cacheManager">Cache manager</param>
/// <param name="checkoutAttributeRepository">Checkout attribute repository</param>
/// <param name="checkoutAttributeValueRepository">Checkout attribute value repository</param>
/// <param name="eventPublisher">Event published</param>
public CheckoutAttributeService(ICacheManager cacheManager,
IRepository<CheckoutAttribute> checkoutAttributeRepository,
IRepository<CheckoutAttributeValue> checkoutAttributeValueRepository,
//ICheckoutAttributeParser checkoutAttributeParser,
IEventPublisher eventPublisher,
ILocalizationService localizationService)
{
_cacheManager = cacheManager;
_checkoutAttributeRepository = checkoutAttributeRepository;
_checkoutAttributeValueRepository = checkoutAttributeValueRepository;
//_checkoutAttributeParser = checkoutAttributeParser;
_eventPublisher = eventPublisher;
_localizationService = localizationService;
if (this._checkoutAttributeParser == null)
{
this._checkoutAttributeParser = Nop.Core.Infrastructure.EngineContext.Current.Resolve<ICheckoutAttributeParser>();
}
}
I have also tried:
public CheckoutAttributeService(ICacheManager cacheManager,
IRepository<CheckoutAttribute> checkoutAttributeRepository,
IRepository<CheckoutAttributeValue> checkoutAttributeValueRepository,
ICheckoutAttributeParser checkoutAttributeParser,
IEventPublisher eventPublisher,
ILocalizationService localizationService)
{
_cacheManager = cacheManager;
_checkoutAttributeRepository = checkoutAttributeRepository;
_checkoutAttributeValueRepository = checkoutAttributeValueRepository;
_checkoutAttributeParser = checkoutAttributeParser;
_eventPublisher = eventPublisher;
_localizationService = localizationService;
}
I would really appreciate some help on this one - it's driving me round the bend!
Thanks in advance guys
Al