I have a site that I have product with similar names but of different brands. I store my product brand as one of the product field entity. Therefore, when I view my site order, my product titles tend to be identical but they are of different brands.
for e.g.
1. Brand A has title "LED light bulb"
2. Brand B also has title "LED light bulb"
And I cannot differentiate whether my customer buys Brand A or Brand B light bulb.
May I request for a feature for site admin to be able to add entities like product SKU or product field into site order list so that the site admin can tell which product is being purchased?
Comment | File | Size | Author |
---|---|---|---|
#25 | 2928932-25.patch | 5.14 KB | sorabh.v6 |
| |||
#25 | 2928932-25-interdiff.txt | 710 bytes | sorabh.v6 |
#22 | 2928932-22-interdiff.txt | 3.74 KB | sorabh.v6 |
#22 | 2928932-22.patch | 4.62 KB | sorabh.v6 |
#20 | 2928932-20.patch | 499 bytes | sorabh.v6 |
Comments
Comment #2
sorabh.v6Comment #3
sorabh.v6Product sku field is added to order item table. Please review.
@shadeworm If you want you can also add your product brand field into the order item table. It's a view with name order items. Just create a relationship of product variation and then add the fields you want to show on the table.
Comment #4
sorabh.v6Comment #6
sorabh.v6Code updated to pass the test.
Comment #8
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedChanged issue title to be more precise.
From an user point of view, I find it a good default to have the SKU displayed when viewing the details of an order. From a developer point of view I see how it would make thing less flexible: the view 'commerce_order_item_table' would get a hard dependency on commerce_product and likely would introduce issues with purchasable entities that are not a commerce_product. This is probably why the tests fail.
Maybe
ProductVariation::getOrderItemTitle()
should return both the title and the SKU?Comment #9
sorabh.v6Thanks, I will try.
Comment #10
sorabh.v6@MegaChriz ProductVariation::getOrderItemTitle() returns title only and for sku there's a separate function ProductVariation::getSku(). It will not be good if we return both from a single method.
Comment #11
sorabh.v6Uploading updated patch.
Comment #12
MegaChriz CreditAttribution: MegaChriz as a volunteer commented@sorabh.v6
Yes, but there's also
ProductVariation::getTitle()
andProductVariation::label()
. From my understandingProductVariation::getOrderItemTitle()
is designed to show a label specific for display in the order item table. That is allowed to be different than in other places where a product variation is displayed.You could let the method return something like this:
[Product title] ([SKU])
For example:
Lorem Ipsum (P001)
It would be good though to verify with the Commerce maintainers first if a feature request like this is desirable.
Comment #13
sorabh.v6@MegaChriz Nice suggestion, I will confirm with bojanz first.
Comment #14
subhojit777Comment #15
subhojit777Comment #18
bojanz CreditAttribution: bojanz at Centarro commented#12 is correct. What we need is a way to customize the title.
The attached patches are uncomittable, we can't add fields specific to 1 purchasable entity type.
Comment #19
sorabh.v6Comment #20
sorabh.v6Hi All,
Removed all previous code and code added as suggested in #12. Thanks @MegaChriz.
I have not made any changes to .install file because I think changing the titles of the order items from previous orders might create some confusion and discrepancy. Please share your thoughts.
Thanks All
Comment #22
sorabh.v6Updated code with changes in tests. Please review.
Comment #23
sorabh.v6Comment #25
sorabh.v6Updated tests again. :D
Comment #26
sorabh.v6At last, tt passed the tests. I am so happy :D
Comment #27
smccabe CreditAttribution: smccabe as a volunteer and at Acro Commerce commentedPatch code looks proper to me on review and matches what is decided on in #12. Test updates also look correct.
Could probably use a review from MegaChris or Bojan as they are more familiar with the issue, but seems a pretty straightforward issue of appending the SKU by default.
Comment #28
_dcre_ CreditAttribution: _dcre_ commentedI 've got a question which is not totally relevant, but pretty relevant..
Is it possible to use a different custom view in the place of commerce_order_item_table ?
Even further, how would one be able to have a different commerce_order_item_table view or view display for different order types?
Is that even possible?
Of course i mean in a programmatic way not via the UI, although the later would not be a bad idea.
Thanx in advance
Comment #29
agoradesign CreditAttribution: agoradesign commentedYes, you can exactly do that already. There are per order type settings to select both the shopping cart form view and the shopping cart block view. And you can set this via UI as well as in a programmatic way
Comment #30
_dcre_ CreditAttribution: _dcre_ commented@agoradesign i am actually referring to the backend order view (/admin/commerce/orders/ORDER-ID)
I don't see how/if i can set this up via the UI or programmatically. Am i missing something here?
Comment #31
AltaGrade CreditAttribution: AltaGrade commentedLong time. The patch does not apply anymore:
So maybe this kind of issues must be closed, especially when you can add relationship to product variation and get the SKU field.