<?php
$test = '<div>
<form class="form-outofstock-notify" id="product-notify-form" method="post"
data-mage-init='{"validation":{}}'>
<input name="notify_email"
id="email_id"
title="<?= $block->escapeHtmlAttr(__('Email Id')) ?>"
class="input-text"
type="email"
data-validate="{'validate-email':true}"/>
<input type="hidden" name="product_id" id="product_id" value="
<?php
if($productType != 'configurable')
{
echo $block->getCurrentProductId();
}
?>
">
<input type="hidden" name="product_sku" id="product_sku" value="
<?php
if($productType != 'configurable')
{
echo $block->getSku();
}
?>
">
<input type="hidden" name="website_id" value="<?php echo $block->getWebsiteId(); ?>">
<input type="hidden" name="subscription_time" value="<?php echo $block->getStoreTime(); ?> ">
<button type="button" id="trybtn" title="<?= $block->escapeHtmlAttr(__('Notify me')) ?>" class="action submit primary">
<span><?= $block->escapeHtml(__('Notify me')) ?></span></button>
</form>
</div>';
?>
-
$test.="</dev>";Ronak Rathod– Ronak Rathod2021-12-24 06:09:50 +00:00Commented Dec 24, 2021 at 6:09
Add a comment
|
2 Answers
You can also try like this:
<?php ob_start(); ?>
<div>HTML conent...</div>
<div>More content...</div>
<?php $html = ob_get_clean(); ?>
You need to replace the inside a single quote with a double quote. can you try with below working code.
<?php
echo $test = '<div>
<form class="form-outofstock-notify" id="product-notify-form" method="post"
data-mage-init="{"validation":{}}">
<input name="notify_email"
id="email_id"
title="<?= $block->escapeHtmlAttr(__("Email Id")) ?>"
class="input-text"
type="email"
data-validate="{"validate-email":true}"/>
<input type="hidden" name="product_id" id="product_id" value="
<?php
if($productType != "configurable")
{
echo $block->getCurrentProductId();
}
?>
">
<input type="hidden" name="product_sku" id="product_sku" value="
<?php
if($productType != "configurable")
{
echo $block->getSku();
}
?>
">
<input type="hidden" name="website_id" value="<?php echo $block->getWebsiteId(); ?>">
<input type="hidden" name="subscription_time" value="<?php echo $block->getStoreTime(); ?> ">
<button type="button" id="trybtn" title="<?= $block->escapeHtmlAttr(__("Notify me")) ?>" class="action submit primary">
<span><?= $block->escapeHtml(__("Notify me")) ?></span></button>
</form>
</div>
' ;
?>