Closed (fixed)
Project:
Commerce Cart Flyout
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Nov 2018 at 15:41 UTC
Updated:
26 Nov 2018 at 20:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
lisastreeter commentedComment #3
lisastreeter commentedPatch updates the commerce-cart-flyout-offcanvas-contents.html.twig template so that it only prints the order id, not the entire JSON object string. CartContentsItemsView uses the order id to get the cart JSON object from the model.
Comment #4
lisastreeter commentedComment #5
mglamanI wish we could just use
Array.prototype.find, but IE11 does not support it (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global...). So this is probably our best approach.Comment #6
mglamanWe do have one problem: anyone who has customized that template will have a breaking change.
Example: http://cgit.drupalcode.org/belgrade/tree/templates/commerce/cart/commerc...
Which, I don't know why that file was overridden.
Comment #7
lisastreeter commentedYep! Realized that this morning when I applied the patch to a local site and forgot it had the template in its custom theme.
Maybe a slight improvement would be to create a template with a new name to replace commerce-cart-flyout-offcanvas-contents.html.twig
Existing theme overrides would then simply be ignored. But at least the js wouldn't be broken because of a template with the (now) wrong structure...
Comment #8
mglamanI was thinking this over, and I think we can avoid the breaking change, this way. We assume the cart form elements will be added in the same sequence as the array. That means we can pass the matching cart via a key to the next view.
Comment #9
lisastreeter commentedThis newest patch is working for me. Products with quotes in their names can be added to the cart without breaking the cart functionality.
Comment #11
mglamanFixed!