concretecms-community-store / community_store

An open, free and community developed eCommerce system for Concrete CMS
https://concretecms-community-store.github.io/community_store/
MIT License
106 stars 66 forks source link

Customer: remove duplicated code, use app to get user, start session only if required, ... #771

Closed mlocati closed 1 year ago

Mesuva commented 1 year ago

I know I struggled a bit with this code years ago in terms of handling both customers that are guests, and those that are logged in. And then customers that start as guests, and end up logged in due to a purchase. Not surprised this needed some cleanup!

Mesuva commented 1 year ago

Oh, and there were some V5.8 -> V8 challenges in there as well

mlocati commented 1 year ago

I didn't change the logic, everything should work as before.

I simply removed duplicatted code (see for example the two old methods that formatted addresses: now it's done in just 1 place), and optimized everything a bit (for example, using $app->make(User::class) instead of new User())