0

Hello,

I have installed FAQ module from github https://github.com/php-cuong/magento2-faqs-extensions.

I want to show the faq/view.phtml template file on product details page over here https://prnt.sc/tgofxd.

I have added the questions in Frequently Asked questions, they are visible on https://e92rduand89atx1x.mojostratus.io/faqs.html page See https://prnt.sc/tgogge but not on Product detail page See https://prnt.sc/tgofxd

You can refer these url for reference :

  1. https://e92rduand89atx1x.mojostratus.io/faqs.html

  2. https://e92rduand89atx1x.mojostratus.io/zorb-fabric30.html

Can you please guide me on this? Here is the phtml file code.

<div class="faq-category">
<h2 class="faqcat-title first-title"><i></i><?php echo __('Welcome to our support portal');?></h2>
<?php if ($this->getFaqCategoriesList()): ?>
    <ul class="category-list">
        <?php foreach ($this->getFaqCategoriesList() as $category): ?>
            <li class="col-xs-6 col-sm-4 col-md-3 category">
                <div class="block">
                    <a href="<?php echo $this->getFaqCategoryFullPath($category['identifier']); ?>">
                        <img src="<?php echo !empty($category['image']) ? $this->getFileBaseUrl($category['image']) : $block->getViewFileUrl('PHPCuong_Faq::images/faq81x81.png'); ?>" alt="<?php echo __($category['title']);?>" title="<?php echo __($category['title']);?> - <?php echo __('FAQs'); ?>" />
                    </a>
                    <h3>
                        <a href="<?php echo $this->getFaqCategoryFullPath($category['identifier']); ?>">
                            <?php echo __($category['title']);?>
                        </a>
                    </h3>
                </div>
            </li>
        <?php endforeach;?>
    </ul>
<?php else: ?>
    <ol class="items faqs-list">
        <li class="item no-question">
            <a href="#"><?php echo __('There are no FAQ Categories was found.'); ?></a>
        </li>
    </ol>
<?php endif; ?>

<h2 class="faqcat-title">
    <i></i><?php echo __('Frequently Asked Questions');?>
</h2>
<?php if ($this->getFrequentlyAskedQuestion()): ?>
    <ol class="items faqs-list">
        <?php foreach($this->getFrequentlyAskedQuestion() as $faq): ?>
            <li class="item" id="faq-id-<?php echo $faq['faq_id']; ?>">
                <a href="<?php echo $this->getFaqFullPath($faq['identifier']); ?>"><span class="faq-iconplus"></span><?php echo $faq['title']; ?></a>
                <div class="description" id="description">
                    <?php echo $block->filterProvider($faq['content']); ?>
                </div>
                <div class="read-more"><?php echo __('Read more'); ?></div>
            </li>
        <?php endforeach; ?>
    </ol>
<?php else: ?>
    <ol class="items faqs-list">
        <li class="item no-question">
            <a href="#"><?php echo __('There are no frequently asked questions was found.'); ?></a>
        </li>
    </ol>
<?php endif; ?>

<h2 class="faqcat-title"><i></i><?php echo __('Latest Questions');?></h2>
<?php if ($this->getLastestFAQ()): ?>
    <ol class="items faqs-list">
        <?php foreach($this->getLastestFAQ() as $faq): ?>
            <li class="item" id="faq-id-<?php echo $faq['faq_id']; ?>">
                <a href="<?php echo $this->getFaqFullPath($faq['identifier']); ?>"><span class="faq-iconplus"></span><?php echo $faq['title']; ?></a>
                <div class="description" id="description">
                    <?php echo $block->filterProvider($faq['content']); ?>
                </div>
                <div class="read-more"><?php echo __('Read more'); ?></div>
            </li>
        <?php endforeach; ?>
    </ol>
<?php else: ?>
    <ol class="items faqs-list">
        <li class="item no-question">
            <a href="#"><?php echo __('There are no latest questions was found.'); ?></a>
        </li>
    </ol>
<?php endif; ?>

This is the layout file code "catalog_product_view.xml" where i am calling this phtml file

 <referenceBlock name="product.info.details">
     <block class="Magento\Framework\View\Element\Template" name="faq.faq.view" template="PHPCuong_Faq::faq/view.phtml"  group="detailed_info" cacheable="false">
      <arguments>
         <argument name="title" translate="true" xsi:type="string">FAQ</argument>
          <argument name="sort_order" xsi:type="string">100</argument>
         </arguments>
         </block>
    </referenceBlock>

What is going wrong? Please help

1
  • This problem is still not resolved. Can anyone help me in this?
    – Nafsss
    Commented Jul 14, 2020 at 5:07

1 Answer 1

0

Try it like this :-

<referenceBlock name="product.info.details">
                <block class="Magento\Catalog\Block\Product\View" name="faq.faq.view" template="Learning_Module::shipping.phtml" group="detailed_info" >
                    <arguments>
                        <argument translate="true" name="title" xsi:type="string">FAQ</argument>
                        <argument name="sort_order" xsi:type="string">100</argument>
                    </arguments>
                </block>
            </referenceBlock>

Hope This Helps!

6
  • No this did not work. It even removed the FAQ tab from product detail page
    – Nafsss
    Commented Jul 13, 2020 at 7:11
  • there was a mistake i had jsut updated the ans try it now
    – Pramod
    Commented Jul 13, 2020 at 7:11
  • No. this also not working
    – Nafsss
    Commented Jul 13, 2020 at 7:13
  • can you please share that module link i will try it on my local and then i will repost an ans
    – Pramod
    Commented Jul 13, 2020 at 7:14
  • here it is github.com/php-cuong/magento2-faqs-extensions.
    – Nafsss
    Commented Jul 13, 2020 at 7:19

Your Answer

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

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