On Thursday, April 11, 2013 7:57:59 PM UTC+12, Nicolaas Thiemen Francken - Sunny Side Up wrote:
Anyway, I think that it's worth making these changes to the newer versions of the ecommerce module. If you're interested, then I can share my changes with you.
Would love to see how you have done it.
Sounds great.
I'll send you the diffs via email, but the basics are as follows:
- Changed ShoppingCart::current_order() (and similar methods, including EcommerceSiteTreeExtension::Cart()) to take a $allowCreate as parameter, with the default = true (so that the old behaviour still works). When set to false, the method will return null if there is no current order
- Next, I inserted a user_error() call in ShoppingCart::current_order() just before the code that generates a new cart
- Finally, I opened an incognito browser window (ensures that a new session is created), and visited various pages. The stack traces from the user_error() call told me exactly which methods and templates needed updating.
Once I could visit all page types without creating an order, the last step was to remove the user_error(), and double-check that adding items, etc., still worked.
regards,
Hans