- Issue created by @rhovland
- Merge request !32Issue #3511700 by rhovland: WSOD on order completion page when order has items without purchased entities β (Closed) created by rhovland
- πΊπΈUnited States rhovland Oregon
Confirmed to fill the array with redeemed gift card codes. Needs a test to make sure the codes are output into the template variables. Since there is no template provided to display these values we probably can stop at making sure the template variables are populated in a test.
- πΊπΈUnited States rhovland Oregon
Created a test which will pass once π Fix tests Active is merged into this issue branch.
https://git.drupalcode.org/issue/commerce_giftcard-3481607/-/pipelines/4...
- π©πͺGermany Grevil
This sounds like a major problem, I'll come back to you asap.
- π©πͺGermany Grevil
I definitly agree with you here, in my opinion Giftcards should apply on the whole order and not handle single OrderItem- / Purchased-Entities in any way or form.
As seen in "GiftcardOrderProcessor" the price adjustment is added on the whole order. But what I don't understand yet, is that in "OrderEventSubscriber" "giftcardPurchase()" we link order ITEMs per commerce_giftcard_transaction, so you're assumption in the issue summary:
Additionally, the code wouldn't ever work anyways because it assumes that giftcard transactions have a reference to the order item id instead of the order id which is what is actually stored on transactions.
is incorrect, because there are indeed order item IDs referenced to commerce giftcard transactions. Why that is the case, I am not sure yet. I haven't gotten in too deep yet.
I think, we should dedicate this issue to resolve any order item related code and find out what it was used for and why.
The original WSOD issue is circumvented by changes from π Fix tests Active . So we can lower the priority of this issue and rename it.
- πΊπΈUnited States rhovland Oregon
Ok I think I figured out where the source of the confusion is here.
I thought that the checkout completion message variables were intended to display the gift card codes redeemed to pay for the order (just like how payment methods are usable variables). This code was actually intended to allow to display the codes for purchased gift cards. It does this by querying gift card transactions that have a
reference_id
that matches the item id. However this is a very big problem as reference_id is shared by two different types of entity ids!OrderEventSubscriber::giftcardPurchase()
generates gift card codes for gift cards that were purchased as an order item. It records the order item id in thereference_id
field in commerce_giftcard_transaction.OrderEventSubscriber::registerUsage()
generates a transaction whenever a gift card is used to pay for an order. It records the order id in thereference_id
field in commerce_giftcard_transaction.We're storing two different ids in the same field with no way to differentiate the difference between transaction types other than the content of the comment field.
- πΊπΈUnited States rhovland Oregon
In light of this I think this issue should become
"Create completion pane to display purchased gift cards"Because right now if a gift card is purchased the customer does not see the code. And shoving it into the variables for the completion message is wrong because now we'd have to override the template for that to fully implement the feature. It should be a separate pane that's added to the complete step of checkout.
As part of this feature we can figure out a better way to handle the query to get the list of gift cards that were purchased.