Timeline for Magento 2 - Get location of view model of knockoutjs .html template
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 20, 2023 at 6:58 | comment | added | Black | You can edit your answer and add your second answer below or create a new answer. Thx! | |
Jun 19, 2023 at 5:23 | comment | added | Tu Van | Hey @Black I have a great and detailed answer to your additional question. Do you think we should add a separate question from the original question? The original question doesn't seem to be related to the additional question, but I think it's valuable and worth exploring. The choice is yours, and either way, I'm happy with your choice. | |
Jun 7, 2023 at 9:49 | comment | added | Tu Van | I’ll need to check. Maybe I can find the time to do this next week. :) | |
Jun 6, 2023 at 14:51 | comment | added | Black | "But it is declared in a related JS Knockout component via private content" Where can I find that component? How is it linked to the template? | |
Jun 6, 2023 at 14:42 | comment | added | Tu Van |
product_has_url does not declare directly in the Knockout JS component file which belongs to the HTML template, but it is declared in a related JS Knockout component via private content (cartData = customerData.get('cart'); which is pulled the data from the backend. Finally, in the backend, the product_has_url variable declared in doGetItemData in vendor/magento/module-checkout/CustomerData/DefaultItem.php
|
|
Jun 6, 2023 at 14:41 | comment | added | Tu Van | Hey @Black, I currently don't have time to provide a details answer to this additional question. However, I can give you an insight in case you are working on a task and need to find some information asap. | |
Jun 6, 2023 at 8:46 | comment | added | Black | Thanks, I also found the Magento_Checkout/js/view/cart-item-renderer component, but it does not contain the definitions for the template. For example the template uses ` <!-- ko if: product_has_url -->` and product_has_url is not defined in that component. So how does the template know where it is defined? | |
Jun 6, 2023 at 8:21 | history | answered | Tu Van | CC BY-SA 4.0 |