Closed (fixed)
Project:
Commerce Core
Version:
8.x-2.x-dev
Component:
User experience
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 Jun 2019 at 21:09 UTC
Updated:
30 Aug 2019 at 13:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
bojanz commentedHere's a proposed patch.
Notes:
1) I originally did AddressBook::collectProfiles($order) and it was fine. However, the event name is generic, and the method felt generically useful outside of the address book context. Plus, this prevents the AddressBook service from becoming even larger.
2) Had to invent $scope as a way to tag profiles. Ideally that would be the profile type, but we can't do that since we support using the same profile type for both billing and shipping.
3) Right now the CustomerProfile "instance_id" maps 1-1 to a "scope". So it might make sense to rename the instance_id setting to scope.
4) We currently have a "shipping_information" placeholder in the order and order receipt templates, filled by preprocess functions in commerce_shipping. We could use this code to actually render this ourselves.
Comment #3
mglaman1) It feels weird to add yet another method to orders. I agree AddressBook::collectProfiles would bloat that service (especially with #3059633: Provide a better addressbook UI for the user pages which teeters on this same problem. What if there was an OrderProfiles service? This would allow us to collect profiles, and solve problems in 3059633. That service could set the 3rd party setting flagging a profile type for Commerce, and for loading the allowed types.
2) $scope works, I also like $intent (but it's not intent it is a "for sure" thing.) Initially, I thought of $scope and imagined a value object. But I really think that's not something worth debating. Just mentioning my initial thoughts.
3) I think having standardized naming helps.
4) 👍s/$variables['order']['billing_information']/$variables['order'][$scope . '_information'] and render those suckers. Less stuff to maintain in Shipping or custom code providing these values who may not be using shipping.
Comment #4
mglamanActually, having an OrderProfiles service would be nice. The addressbook UI patch adds
It'd be nice to receive them keyed by scope, or get the profile type for a given scope.
Comment #6
bojanz commentedCommitted #2 + a rename of CustomerProfile's instance_id to profile_scope.
Opened a followup for #2.4: #3075246: Render each order profile automatically.