I've created a views field that displays the payment method in the order based views.

CommentFileSizeAuthor
#1 commerce-payment-1700082.patch3.07 KBmr.york

Comments

mr.york’s picture

Title: Exposing Commerce Payment Method in Order views » Commerce Payment Method field in Order views
Status: Active » Needs review
StatusFileSize
new3.07 KB

Here is a patch.

rszrama’s picture

Status: Needs review » Closed (won't fix)

First, thanks for sharing your patches. It's always appreciated, even if I don't put them in. For this one, I don't think we should include it for two reasons:

  1. The payment method variable you're reading only represents the payment method selected by a customer during the checkout process. This means it would be insufficient on a site that only allowed admin created orders or that allowed multiple payment methods to be used during the checkout process. More importantly...
  2. It's already possible to do what your patch offers with the existing "Reference payment transaction" relationship in the Payment module. You can use that to join an Order View to the first payment transaction created for each order and then display the referenced transaction's method in the View.

That said, I see no problem using it on your own site as it's obviously made your work a little easier. Keep 'em coming! : )

nagy.balint’s picture

Status: Closed (won't fix) » Active

2. Unfortunately this does not always work. As having transactions in a payment method is not mandatory.

For example on our site the postfinance payment method never creates a transaction therefore the mentioned relationship ("Commerce Order: Payment Transaction" on our site) and field will always return "unknown" even tho the payment method was Postfinance.

On the other hand the above patch works perfectly (and requires 1 less relationship).

rszrama’s picture

Status: Active » Closed (won't fix)

Ok, I still don't think I'll be putting it in as is, though, primarily for reason #1. I'm just not entirely comfortable with that temporal data value making its way into a field handler. That said, why does your payment method not create a transaction? It should at least create a pending transaction to represent that payment is expected, and once payment is received you could have an operation link on that transaction that led to a form to mark it as received. Is that the basic model, or am I misunderstanding what you mean by "postfinance?"

ferelx’s picture

Issue summary: View changes

Applying this patch I lost a payment method. How I can recover it?