0
<?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>';
?>
1
  • $test.="</dev>"; Commented Dec 24, 2021 at 6:09

2 Answers 2

1

You can also try like this:

<?php ob_start(); ?>
<div>HTML conent...</div>
<div>More content...</div>
<?php $html = ob_get_clean(); ?>
0

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>
' ;
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.