Jump to content

Alertes par e-mail v3.6.0 alert produit disponnible non fonctionel


Recommended Posts

Bonjours, l’alerte produit disponible ne fonctionne pas sur mon site, je peux rentrée  le mails si je suis pas connecté par contre au moment de cliquer sur "Prévenez-moi lorsque le produit est disponible" aucune réaction j’ai remarquer quelque chose de bizarre avec l’outil développer de firefox  la "fonction href"

<a id="mailalert_link" href="#" title="Prévenez-moi
 lorsque le produit est disponible" id="mailalert_link" rel="nofollow">
Prévenez-moi lorsque le produit est disponible</a>

quelqu’un a une idée pour résoudre mon problème ?

Link to comment
Share on other sites

Bon des erreurs vous en avez 3 en console...

Failed to load resource: the server responded with a status of 404 (Not Found)
https://writer.smartlook.com/rec/write?rid=57efc20ade599e42780eaed3&index=0…rverHost=s2.getsmartlook.com&group=10d&pid=57ed45f1673eec1b3d8b4567&data=1 Failed to load resource: the server responded with a status of 503 (Service Unavailable: Back-end server is at capacity)
1174-ares-amoeba-008-efcs.html#:1 XMLHttpRequest cannot load https://writer.smartlook.com/rec/write?rid=57efc20ade599e42780eaed3&index=0…rverHost=s2.getsmartlook.com&group=10d&pid=57ed45f1673eec1b3d8b4567&data=1. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://as-df.fr' is therefore not allowed access. The response had HTTP status code 503.

Et aucun js de chargé pour ce module, donc il y a un souci...

Link to comment
Share on other sites

Dans le module, le js est intégré au tpl /modules/mailalerts/views/templates/hook/product.tpl

 

Suivant votre thème le js est soit dans le tpl du module, soit dans le fichier mailalert.js

 

A vérifier dans /themes/votre_theme/js/modules/mailalerts/mailalerts.js ou /themes/votre_theme/modules/mailalerts/views/templates/hook/product.tpl

Link to comment
Share on other sites

Voici le code "/themes/votre_theme/modules/mailalerts/views/templates/hook/product.tpl"

{*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2014 PrestaShop SA
*  @version  Release: $Revision$
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
<!-- MODULE MailAlerts -->
	{if isset($email) AND $email}
		<p class="form-group">
			<input type="text" id="oos_customer_email" name="customer_email" size="20" value="{l s='[email protected]' mod='mailalerts'}" class="mailalerts_oos_email form-control" />
    	</p>
    {/if}
	<a href="#" title="{l s='Notify me when available' mod='mailalerts'}" id="mailalert_link" rel="nofollow">{l s='Notify me when available' mod='mailalerts'}</a>
	<span id="oos_customer_email_result" style="display:none; display: block;"></span>
{strip}
{addJsDef oosHookJsCodeFunctions=array('oosHookJsCodeMailAlert')}
{addJsDef mailalerts_url_check=$link->getModuleLink('mailalerts', 'actions', ['process' => 'check'])}
{addJsDef mailalerts_url_add=$link->getModuleLink('mailalerts', 'actions', ['process' => 'add'])}

{addJsDefL name='mailalerts_placeholder'}{l s='[email protected]' mod='mailalerts' js=1}{/addJsDefL}
{addJsDefL name='mailalerts_registered'}{l s='Request notification registered' mod='mailalerts' js=1}{/addJsDefL}
{addJsDefL name='mailalerts_already'}{l s='You already have an alert for this product' mod='mailalerts' js=1}{/addJsDefL}
{addJsDefL name='mailalerts_invalid'}{l s='Your e-mail address is invalid' mod='mailalerts' js=1}{/addJsDefL}
{/strip}
<!-- END : MODULE MailAlerts -->
Link to comment
Share on other sites

voila :

 

/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2014 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

$(document).ready(function() {
    oosHookJsCodeMailAlert();
    $(document).on('keypress', '#oos_customer_email', function(e){
        if(e.keyCode == 13)
        {
            e.preventDefault();
            addNotification();
        }
    });

    $(document).on('click', '#oos_customer_email', function(e){
        clearText();
    });

    $(document).on('click', '#mailalert_link', function(e){
        e.preventDefault();
        addNotification();
    });

    $(document).on('click', 'i[rel^=ajax_id_mailalert_]', function(e)
    {
        var ids =  $(this).attr('rel').replace('ajax_id_mailalert_', '');
        ids = ids.split('_');
        var id_product_mail_alert = parseInt(ids[0]);
        var id_product_attribute_mail_alert = parseInt(ids[1]);
        var parent = $(this).parents('li');

        if (typeof mailalerts_url_remove == 'undefined')
            return;

        $.ajax({
            url: mailalerts_url_remove,
            type: "POST",
            data: {
                'id_product': id_product_mail_alert,
                'id_product_attribute': id_product_attribute_mail_alert
            },
            success: function(result)
            {
                if (result == '0')
                {
                    parent.fadeOut("normal", function()
                    {
                        if (parent.siblings().length == 0)
                            $("#mailalerts_block_account_warning").removeClass('hidden');
                        parent.remove();
                    });
                }
              }
        });
    });

});

function clearText()
{
    if ($('#oos_customer_email').val() == mailalerts_placeholder)
        $('#oos_customer_email').val('');
}

function oosHookJsCodeMailAlert()
{
    if (typeof mailalerts_url_check == 'undefined')
        return;

    $.ajax({
        type: 'POST',
        url: mailalerts_url_check,
        data: 'id_product=' + id_product + '&id_product_attribute=' + $('#idCombination').val(),
        success: function (msg) {
            if (msg == '0')
            {
                $('#mailalert_link').show();
                $('#oos_customer_email').show();
            }
            else
            {
                $('#mailalert_link').hide();
                $('#oos_customer_email').hide();
            }
        }
    });
}

function  addNotification()
{
    if ($('#oos_customer_email').val() == mailalerts_placeholder || (typeof mailalerts_url_add == 'undefined'))
        return;

    $.ajax({
        type: 'POST',
        url: mailalerts_url_add,
        data: 'id_product=' + id_product + '&id_product_attribute='+$('#idCombination').val()+'&customer_email='+$('#oos_customer_email').val()+'',
        success: function (msg) {
            if (msg == '1')
            {
                $('#mailalert_link').hide();
                $('#oos_customer_email').hide();
                $('#oos_customer_email_result').html(mailalerts_registered);
                $('#oos_customer_email_result').css('color', 'green').show();
            }
            else if (msg == '2' )
            {
                $('#oos_customer_email_result').html(mailalerts_already);
                $('#oos_customer_email_result').css('color', 'red').show();
            }
            else
            {
                $('#oos_customer_email_result').html(mailalerts_invalid);
                $('#oos_customer_email_result').css('color', 'red').show();
            }
        }
    });
}

 

Link to comment
Share on other sites

Bah vous devez avoir un conflit dans vos js car ce fichier n'est jamais appelé sur votre page...

le module appelle les 2 fichiers dans le header

	public function hookDisplayHeader()
	{
		$this->page_name = Dispatcher::getInstance()->getController();
		if (in_array($this->page_name, array('product', 'account')))
		{
			$this->context->controller->addJS($this->_path.'js/mailalerts.js');
			$this->context->controller->addCSS($this->_path.'css/mailalerts.css', 'all');
		}
	}

Or chez vous, seul le css est présent en front

Essayez de copier le js du module du thème dans le js du module lui-même (qui doit être vide)

Link to comment
Share on other sites

Très space^^

Votre fichier est bien chargé cette fois-ci mais il ne contient que la licence

/**
 * 2007-2015 PrestaShop
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to http://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <[email protected]>
 * @copyright 2007-2015 PrestaShop SA
 * @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 * International Registered Trademark & Property of PrestaShop SA
 */

http://as-df.fr/modules/mailalerts/js/mailalerts.js

 

Donc vous avez dû louper un truc  :wacko:

Link to comment
Share on other sites

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...