When using the checkout progress block and custom views page with path e.g. checkout/%commerce_order/order_information/%user/select-address
there can be error like
TypeError: Drupal\commerce_checkout\CheckoutOrderManager::getCheckoutFlow(): Argument #1 ($order) must be of type Drupal\commerce_order\Entity\OrderInterface, string given, called in /app/web/modules/contrib/commerce/modules/checkout/src/Plugin/Block/CheckoutProgressBlock.php on line 83 in Drupal\commerce_checkout\CheckoutOrderManager->getCheckoutFlow() (line 33 of /app/web/modules/contrib/commerce/modules/checkout/src/CheckoutOrderManager.php)

I remember we had similar error in CommerceOrderHooks::menuLocalTasksAlter() on views pages, so maybe it would be good idea to add similar fix e.g. loading an order if $this->routeMatch->getParameter('commerce_order'); returns string value.

CommentFileSizeAuthor
#3 commerce-3591608-3.patch2.82 KBkhiminrm

Issue fork commerce-3591608

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:

Comments

khiminrm created an issue. See original summary.

khiminrm’s picture

StatusFileSize
new2.82 KB

Patch from the PR

khiminrm’s picture

Issue summary: View changes
Status: Active » Needs review
jsacksick’s picture

Status: Needs review » Postponed (maintainer needs more info)

This doesn't look like a proper change... The right fix here IMO is to write a route subscriber altering the route defined by views and set the parameter type.
If this breaks, it could break in other places in the code...
Please try that approach first, and let me know if it helped.

tbkot made their first commit to this issue’s fork.

tbkot’s picture

Status: Postponed (maintainer needs more info) » Needs review

@jsacksick I've added the route subscriber to add types for the route property if the property is the commerce entity. It works well, but I would still keep the changes made by Roman, just in case there is a custom route without a defined property type.

I've added some fixes there, so tests are passing

  • jsacksick committed 2bb251db on 3.x authored by khiminrm
    fix: #3591608 Fix type error in CheckoutProgressBlock when the block is...
jsacksick’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.