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
I am using v2.5.0 along with Umbraco v.7.6.5.
When I go prepare the invoice using the Checkout Manager (created using the Basket from the MerchelloSurfactController), I am losing all the items against the invoice and the basket clears itself.
Does anyone have any ideas what I'm doing wrong?
Thanks in advance,
Hard to say without code examples. It's used throughout the code base. Could be that the Basket has changed before you are calling it. i.e. Logging in a user after items have been added to cart
I had a similar problem to this and it confused me also. This is intended behaviour in that the basket empties.
There are a couple of ways around this.
Firstly in the merchello.config (App_Plugins\Merchello\config\merchello.config) set EmptyBasketOnPaymentSuccess key to false.
<setting alias="InvoiceNumberPrefix" value="FT" />
<setting alias="ApplyTaxesToInvoice" value="true" />
<setting alias="RaiseCustomerEvents" value="false" />
<setting alias="ResetCustomerManagerDataOnVersionChange" value="false" />
<setting alias="ResetPaymentManagerDataOnVersionChange" value="true" />
<setting alias="ResetExtendedManagerDataOnVersionChange" value="true" />
<setting alias="ResetShippingManagerDataOnVersionChange" value="true" />
<setting alias="ResetOfferManagerDataOnVersionChange" value="true" />
<setting alias="EmptyBasketOnPaymentSuccess" value="false" />
Secondly is to do this when you create an instance of the CheckoutManager. I had a helper method that did this for me and called this whenever I needed it:
/// Gets checkoutmanger instance
/// <param name="customerContext">The context</param>
/// <returns>ICheckoutManagerBase instance</returns>
public static ICheckoutManagerBase GetCheckoutManager(CustomerContextBase customerContext)
var settings = new CheckoutContextSettings()
ResetCustomerManagerDataOnVersionChange = false,
ResetExtendedManagerDataOnVersionChange = false,
ResetShippingManagerDataOnVersionChange = false,
ResetPaymentManagerDataOnVersionChange = false,
EmptyBasketOnPaymentSuccess = false
var basket = customerContext.CurrentCustomer.Basket();
var checkoutManager = basket.GetCheckoutManager(settings);
Hope that helps
Cheers Ben and Lee. It looks like the Validate() method was being called and the item I was always testing with in my basket (d'oh) had no stock! Annoyingly there was no message bubbling up to let me know of that fact.
That helper method sounds good, cheers.
I found (and as Lee said) that the basket can be pretty temperamental so if you change anything, it creates a new instance of the basket and you lose data.
In fact, I ran into so many problems that I ended up writing quite a few of my own helper methods which stored things in sessions and reloaded them into the checkout context when I needed them...
This was a couple of versions back to what you're using so it may have changed.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted