0

How do I add a custom message block "Lorem Ipsum dolor sit amet" at the beginning of the "maincontent" div that appear below the breadcrumbs in product list/ detail page.

  • If it works for you than give up vote and accept answer to help others as well.!! – anonymous Dec 17 '18 at 8:23
0

You can add an extra block by override breadcrumbs.phtml. Copy breadcrumbs.phtml in from vendor/magento/module-catalog/view/frontend/templates/product/breadcrumbs.phtml to app/design/frontend/<CompanyNmae.>/<themename>/Magento_Catalog/templates/breadcrumbs.phtml. Then call a static block bottom of breadcrumbs.phtml.

you have to change **static-block-id**


<div class ="static block" style="bottom: 127px; position: absolute;">
<?php   echo $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('static-block-id')->toHtml();   ?>
</div>
0

You can create catalog_product_view.xml file to your theme under Magento_Catalog/layout/

Create test.phtml file at your theme under Magento_Catalog/product/view/test.phtml

Than add below code:

<referenceContainer name="page.messages">
  <container name="product.info.afterprice" after="breadcrumbs" label="Product info afterprice" htmlTag="div" htmlClass="product-info-after-price">
    <block class="Magento\Catalog\Block\Product\View"
           name="product.info.enquiry" 
           after="breadcrumbs"
           template="Magento_Catalog::product/view/test.phtml">
    </block>
   </container>
</referenceContainer>

Flush cache and check. Magic will be there !!!

Update :

To implement at category page you need to create file catalog_category_view.xml at same path as catalog_product_view.xml and paste above code.

  • Hey @Web Developer this works fine. But the message appears only on product detail page. I need it on product list page too. – Shami Dec 17 '18 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.