Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module Update #9

Closed
trucatchtraps opened this issue Jul 30, 2018 · 1 comment
Closed

Module Update #9

trucatchtraps opened this issue Jul 30, 2018 · 1 comment

Comments

@trucatchtraps
Copy link

Hi,

To anyone using this module or the developers themselves. I would recommend you add these changes in your custom theme. They both improve the overall aspect of the module.

Create Prince_Faq/layout and Prince_Faq/templates/index in your custom theme.

Upload the attached faq_index_index.xml file to the layout folder you created.

<?xml version="1.0" ?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

<head>
    <title>Frequently Asked Questions</title>
    <!-- <css src="Prince_Faq/css/faq.css"/> -->
    <!-- <link src="Prince_Faq/js/faq.js"/> --> 
</head>
	
    <body>

	<referenceBlock name="page.main.title">
		<action method="setPageTitle">
			<argument translate="true" name="title" xsi:type="string">Frequently Asked Questions</argument>
		</action>
	</referenceBlock>
	
	<referenceBlock name="breadcrumbs">
        <action method="addCrumb">
            <argument name="crumbName" xsi:type="string">Home</argument>
            <argument name="crumbInfo" xsi:type="array">
                <item name="title" xsi:type="string">Home</item>
                <item name="label" xsi:type="string">Home</item>
                <item name="link" xsi:type="string">{{baseUrl}}</item>
            </argument>
        </action>
        <action method="addCrumb">
            <argument name="crumbName" xsi:type="string">Frequently Asked Questions</argument>
            <argument name="crumbInfo" xsi:type="array">
                <item name="title" xsi:type="string">Frequently Asked Questions</item>
                <item name="label" xsi:type="string">Frequently Asked Questions</item>
            </argument>
        </action>
        </referenceBlock>
	
	<!-- 
	<referenceContainer name="content">
		<block class="Prince\Faq\Block\Index\Index" name="index.index" template="Prince_Faq::index/index.phtml"/>
	</referenceContainer>
	-->
	
    </body>
</page>

This file will add a Title and Breadcrumbs to the FAQ page. As well as removing the css and js that I am not using, due to lots of issues.

Upload the attached index.phtml file to the templates/index folder.

<?php $isEnable = $block->getConfig('faqtab/general/enable') ?>
<?php $showGroup = $block->getConfig('faqtab/general/showgroup') ?>
<?php $showGroupTitle = $block->getConfig('faqtab/general/showgrouptitle') ?>
<?php $faqGroupCollection = $block->getFaqGroupCollection() ?>
<?php if ($faqGroupCollection->getSize()) : ?>
<?php if ($isEnable) : ?>
<div class="faq-collection">
    <?php if ($showGroup) : ?>
        <div class="faq-groups">
            <?php foreach ($faqGroupCollection as $group) : ?>
                <div class="faq-group">
                    <a href="#group<?php /* @noEscape */ echo $group->getFaqgroupId(); ?>" class="group-link">
						<div class="faq-group-image">
                        <?php if ($group->getIcon()) : ?>
                            <img class="group-image"
                                 src="<?php /* @noEscape */ echo $block->getImageUrl($group->getIcon()); ?>" />
                        <?php else : ?>
                            <img class="group-image" 
                                 src="<?php /* @noEscape */ echo $block->getViewFileUrl('Prince_Faq::images/faq.png'); ?>" />
                        <?php endif; ?>
                        </div>
                    </a>
                    <div class="faq-groupname">
                    <a href="#group<?php /* @noEscape */ echo $group->getFaqgroupId(); ?>" class="group-link">
                        <?php /* @noEscape */ echo $group->getGroupName(); ?>
                    </a>
                    </div>
                </div>
            <?php endforeach; ?>
        </div>
    <?php endif; ?>
    <div class="faq-content">
        <?php foreach ($faqGroupCollection as $group) : ?>
            <?php if ($showGroupTitle) : ?>
                <div class="group-title" id="group<?php /* @noEscape */ echo $group->getFaqgroupId(); ?>">
                    <i></i><?php /* @noEscape */ echo $group->getGroupName(); ?>
                </div>
            <?php endif; ?>
            <div class="faq-accordion">
            <?php $faqCollection = $block->getFaqCollection($group->getId()); ?>
                <?php if ($faqCollection->getSize()) : ?>
                    <?php foreach ($faqCollection as $faq) : ?> 
                        <h3><?php /* @noEscape */ echo $faq->getTitle(); ?></h3>
                        <div>
                            <p><?php /* @noEscape */ echo $block->filterOutputHtml($faq->getContent()); ?></p>
                        </div>
                    <?php endforeach; ?>
                <?php else : ?>
                    <div><?php /* @noEscape */ echo __('No FAQ available'); ?></div>
                <?php endif; ?>
            </div>
        <?php endforeach; ?>
    </div>
</div>
<?php endif; ?>
<?php else : ?>
<div>
    <h1><?php /* @noEscape */ echo __('No FAQ Group available'); ?></h1>
</div>
<?php endif; ?>

In this file, I just rearranged a few containers so the entire group image can be selected instead of just a small portion of it.

@mageprince
Copy link
Owner

Hi, @trucatchtraps Thanks for your improvement. I will add your improvement in next version of the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants