Problem/Motivation
Currently, commerce_price_component_types() doesn't include user-defined discounts.
Proposed resolution
I've added a patch to add this info to the price components info array, using discount labels as the component display title. Also, I've changed the price component key to "discount|machine_name" instead of "discount|label" since the label can be changed through the UI which may break code relying on the old label.
Remaining tasks
User interface changes
API changes
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | Edit_Order_discount_-_fixed___Site-Install.png | 30.21 KB | joelpittet |
| #3 | interdiff.txt | 643 bytes | joelpittet |
| #3 | add_active_discounts_to-2433273-3.patch | 1.62 KB | joelpittet |
| commerce_discount-add_price_component_info-1.patch | 1.62 KB | bgilhome |
Comments
Comment #1
joelpittetThank you, I'm glad you changed it to machine name.
Comment #2
deggertsen commented+1 RTBC
Comment #3
joelpittetCoding standards comma added, no need to change status. This one is a nice one.
Comment #4
joelpittetLet's see what kind of performance impact this may have.
Comment #5
joelpittetI've committed the discount_name (aka machine name) part of the patch.
Let's look at if the first part the component type info is needed, and if it's slow?
Comment #7
joelpittetDoesn't need profiling but needs tests.
Would this mean disappearing labels if a discount was disabled?
Do they both need to be defined as the same thing? And shouldn't they be the "component title" because UI says that is what shows to the customer.
Comment #8
joelpittetVisuals for your consideration:
Comment #9
mglamanSo I wonder if this should be closed as "works as designed"? Commerce Discount adds its component and label properly. The benefit of hook_commerce_price_component_type_info() might be reusing a discount's price component else where? But I think that'd be bad juju to encourage that.
Comment #10
joelpittetAgreed, if someone wants to use the label like that, it's in that patch for the taking.
Closing as fixed as I've committed the important part regarding the machine name.