Jump to content

How can I restrict module to show only when product is not available for order? [PS 1.6]


Recommended Posts

Hi,

I am trying to modify module from https://mypresta.eu/modules/front-office-features/ask-about-product-free.html to show on product only when product is not available for order. Is there any way to do this? I've tried modifying the module's .tpl file but nothing seems to be working and I keep getting errors.
Can you tell me where to start looking to make this change or what variables I need? I guess it doesn't depend much on the theme?
I would like to repeat the behaviour of the "Notify me when product is available" function.

{*
 *
 * PrestaShop module created by VEKIA, a guy from official PrestaShop community ;-)
 *
 * @author    VEKIA MILOSZ MYSZCZUK VATEU: PL9730945634
 * @copyright 2010-2022 VEKIA
 * @license   This program is not free software and you can't resell and redistribute it
 *
 * CONTACT WITH DEVELOPER http://mypresta.eu
 * [email protected]
 *
 *}
<a id="send_aap_button" class="btn btn-primary" href="#send_AAP_form">
    <i class="fa icon-question-sign"></i> {l s='Ask about product' mod='aapfree'}
</a>

<div style="display: none;">
    <div id="send_AAP_form" class="card">
        <div class="card-block">
            <div class="product clearfix col-lg-12">
                <img src="{$link->getImageLink($aapfree_product->link_rewrite, $aapfree_product_cover, 'home_default')|escape:'html'}" alt="{$aapfree_product->name|escape:html:'UTF-8'}"/>
                <div class="product_desc">
                    <p class="product_name"><strong>{$aapfree_product->name}</strong></p>
                    {if $aapfree_SUMMARY == true}
                        {$aapfree_product->description_short nofilter}
                    {/if}
                </div>
            </div>

            <div class="col-lg-6">
                <fieldset class="form-group">
                    <label class="form-control-label" for="question">{l s='Your question' mod='aapfree'}</label>
                    <textarea name="aapfree_question" id="aapfree_question" class="form-control"></textarea>
                </fieldset>
            </div>

            <div class="send_AAP_form_content col-lg-6" id="send_AAP_form_content">
                <div id="send_AAP_form_error" class="alert alert-danger" style="display:none;"></div>
                <div class="form_container">
                    {if !Context::getContext()->customer->islogged()}
                        <fieldset class="form-group">
                            <label class="form-control-label" for="aapfree_author">{l s='Your name' mod='aapfree'}</label>
                            <input id="aapfree_author" name="aapfree_author" type="text" value="" class="form-control"/>
                        </fieldset>
                    {else}
                        <fieldset class="form-group">
                            <label class="form-control-label" for="aapfree_author">{l s='Your name' mod='aapfree'}</label>
                            <input disabled id="aapfree_author" name="aapfree_author" type="text" value="{Context::getContext()->customer->firstname} {Context::getContext()->customer->lastname}" class="form-control disabled"/>
                            <p class="small">({l s='You are logged as a customer, we get your name automatically from your account details' mod='aapfree'})</p>
                        </fieldset>
                    {/if}
                    {if !Context::getContext()->customer->islogged()}
                        <fieldset class="form-group">
                            <label class="form-control-label" for="aapfree_email">{l s='Your email address' mod='aapfree'}</label>
                            <input id="aapfree_email" name="aapfree_email" type="text" value="" class="form-control"/>
                        </fieldset>
                    {else}
                        <fieldset class="form-group">
                            <label class="form-control-label" for="aapfree_email">{l s='Your email address' mod='aapfree'}</label>
                            <input id="aapfree_email" name="aapfree_email" type="text" value="{Context::getContext()->customer->email}" class="form-control"/>
                        </fieldset>
                    {/if}
                    <fieldset class="form-group">
                        <label class="form-control-label" for="aapfree_phone">{l s='Phone number' mod='aapfree'}</label>
                        <input id="aapfree_phone" name="aapfree_phone" type="text" value="" class="form-control"/>
                    </fieldset>
                </div>
            </div>
            <div class="col-lg-12 send_AAP_form_content_button">
                <p class="submit pull-right">
                    {if $aapfree_GDPR == 1}
                    {literal}
                        <input onchange="if($(this).is(':checked')){$('#sendAAPEmail').removeClass('gdpr_disabled'); $('#sendAAPEmail').removeAttr('disabled'); $('#sendAAPEmail').click(function(){aapfreeEmail();});}else{$('#sendAAPEmail').addClass('gdpr_disabled'); $('#sendAAPEmail').off('click'); $('#sendAAPEmail').attr('disabled', 1); }"
                               id="gdpr_checkbox" type="checkbox">
                    {/literal}
                        {l s='I accept ' mod='aapfree'}
                        <a target="_blank"
                           href="{$link->getCmsLink($aapfree_GDPRCMS)}">{l s='privacy policy' mod='aapfree'}</a>
                        {l s='rules' mod='aapfree'}
                    {/if} &nbsp;
                    <input {if $aapfree_GDPR == 1}disabled{/if} id="sendAAPEmail" class="btn btn-primary {if $aapfree_GDPR == 1}gdpr_disabled{/if}" name="sendAAPEmail" type="submit" value="{l s='Send' mod='aapfree'}"/>
                    <input id="id_product_send" name="id_product" type="hidden" value="{$aapfree_product->id}"/>
                </p>
            </div>
        </div>
    </div>
</div>

 

aapfree16.zip

Edited by stanleyek18 (see edit history)
Link to comment
Share on other sites

  • 11 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...