Similar to the thrust of #2906024: Replace the cart block view with a Twig template, this allows the use of a twig template to render the order item table that is used in the order view, for instance to work around views limitations regarding non-product variation purchasable entities. Backwards-compatible as the default is to use the current view.

Also resolves an @todo to allow the view to be configurable.

Issue fork commerce-3018517

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bradjones1 created an issue. See original summary.

bradjones1’s picture

Forgot the new template file.

bradjones1’s picture

The last submitted patch, order-item-table-twig.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 2: order-item-table-twig-2.patch, failed testing. View results

bradjones1’s picture

Status: Needs work » Needs review
FileSize
7.12 KB

Adding formatter schema - who knew they had them!

Status: Needs review » Needs work

The last submitted patch, 6: order-item-table-twig-6.patch, failed testing. View results

bradjones1’s picture

Status: Needs work » Needs review
FileSize
7.12 KB

Fixes typo prompting test fail.

Hubbs’s picture

Tested patch functionality and it applies clean and works as expected. No issues found.

Could still use a code review.

Hubbs’s picture

Status: Needs review » Needs work

I found one functionality issue that should be addressed.

This patch allows us to select the View to use for the Order item table within the Order type's 'Manage display' settings. This aspect works great.

Where there is an issue is the same View is then also used when viewing an order as an admin via 'Admin menu > Commerce > Orders > Edit'. On the site frontend, the view can be styled and made to look however we want, but the same styling doesn't come through to the admin theme. There is massive potential for the backend admin order item table to appear broken. I'm actually experiencing this right now.

A proposed solution would be to also allow the selection of the View to use within the Order type's 'Manage form display' (I think) or to simply just use the default View in the admin area.

bradjones1’s picture

@Hubbs - thanks for the review and thoughts regarding views.

I'm of the opinion that if an admin is going to be selecting/changing views for Commerce components, they should know about the limitations regarding theming, and providing safeguards against this case is out of scope for what would be needed here, but perhaps I'm wrong.

Perhaps a maintainer can relay their thoughts on this, particularly since the goal here is to further decopule Commerce from views entirely.

bradjones1’s picture

Status: Needs work » Needs review
FileSize
7.12 KB

Re-rolled for 2.13.

Would still like to get input from a maintainer on the questions above.

bradjones1’s picture

Re-rolled for -dev (basically 2.14)

bradjones1’s picture

Re-rolled into an MR.

bradjones1’s picture

Status: Needs review » Needs work

Probably needs rework to track changes similar to what was done in #3119159: commerce_order_item_table needs to filter out orphan order items