I have created a custom tab in Magento 2 in which the html part is shown by HTML file. Means its extension is (.html).
I want to show some blocks in that html file how would i do that.. Infact i have used php tag and echo something it doesn't work there how to show that data inside php tag?
1 Answer 1
PHP does not run in HTML files so you cannot directly do this.
A common but not very clean workaround is to add the HTML from the static block to window.checkoutConfig using PHP and then render that in your HTML file like so:
<div data-bind="html: window.checkoutConfig.yourCmsBlock"></div>
-
Thanks for the help, what should i pass in yourCmsBlock because it doesn't work with block ID will you please help @BenPrits– Prits2020年07月28日 16:19:31 +00:00Commented Jul 28, 2020 at 16:19
-
That will be whatever you define it as in your PHP, I'm not a PHP developer so I can't help with that bit sorry. It is explained here magento.stackexchange.com/questions/173324/… and here though - magento.stackexchange.com/questions/157126/…Ben Crook– Ben Crook2020年07月28日 17:20:06 +00:00Commented Jul 28, 2020 at 17:20
-
Its okk and Thanks for the Links.Will you Please look into this question. magento.stackexchange.com/questions/318424/… I have removed the discount coupan from checkout page but how would i add in on my custom tab.@BenCookPrits– Prits2020年07月29日 04:52:10 +00:00Commented Jul 29, 2020 at 4:52