Jump to content

Mail alerts: 'Notify me when available' button not working please help


Recommended Posts

Just noticed that the instant search is not working either. Maybe related?

 

Never mind I disabled Apache's MultiViews option and the Apache's mod_security module - instant search working now but not the 'notify me when available' button.

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

Hi,

 

I have the same problem here (under PS 1.6.0.9).

 

This is what I have under mailalerts code (product.tpl file)

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

Nothing happens when email is typed, or even when customer is logged and just click on the link.

The "you already have an alert for this product"  doesn't work either. Looks like the whole "notify me" thing isn't working.

 

 

Anybody help please?

Thank you

  • Like 1
Link to comment
Share on other sites

Same problem here.

We have 1.6.0.11 version

When we click on the text "notify me ..." the focus of the page goes to the top and the e-mail is not written in the Database

We have tried also with Explorer and Chrome browsers, same issue

Seems a BUG, please HELP

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Ugh, I just discovered it is not working for me either. When clicking on the "notify me" button while logged in, it will just bump you up to the top of the page. Nothing shows in the mail alerts under my account. Used to work nicely on PS 1.3.1. Sigh.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
  • 4 weeks later...

It's weird because this is a real bug and not an implementation but nobody seems to care about it.

It's almost an year that the module is in the "official download version" but it doesn't work and also there's no patch  in the github section.

I know Prestashop is free but this is a bug of the standard version and I don't think it's good to have it.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hi Vekia,

 

 

I already checked the code by the developer tools but couldn't find where the problem is.

 

Here is the website : www.mykingdomforglitters.com

 

BTW, I sent you a private message several months ago, did you get it?

 

Thanks

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

My fancy box wasnt working in the product.tpl  I don't know how valid is the solution. Once I fixed the fancy box my notification button also started working.  yipeeeee

Sorry, how did you fixed it ?

 

If that is true it may suggest that it's a Java problem, maybe some library in conflict in the code.

It would be interesting if someone else could confirm that the module is working for them

Link to comment
Share on other sites

While running the page right click your mouse on the particular page select inspect element , you will get a small window open on your footer of the page, click on console, you'll get the list of errors. Or try commenting your javascript codes that you have added and check which one is conflicting exactly.  

Edited by Sophia(sofi) (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

I've just solved mine!

 

For me, it was the Quick Search Box Module.  It was enabled, though it doesn't show anywhere in my Theme header. 
Once I disabled it and reset the Mail Alerts Module, it works!

 

I figured it out by navigating to the page of an unavailable product and load the "Error Console".
I'm running Safari and "Error Console" is available in the top menu under Developer Tools.

Link to comment
Share on other sites

each case can be different

in your case - it is necessary to inspect browser console

Well actually, as you asked several weeks ago, we provided URLs and still no help....

 

Hopefully, I found out that it's the javascript code that is missing on product.tpl. I found what looks like the accurate code on another prestashop site using the same theme (obviously in French) as mine, but when I implemented the code, it didn't work properly. Whatever email I wrote I got the message that the email is invalid.

 

Here is the code:

<script type="text/javascript">
// <![CDATA[
oosHookJsCodeFunctions.push('oosHookJsCodeMailAlert');

function clearText() {
	if ($('#oos_customer_email').val() == '[email protected]')
		$('#oos_customer_email').val('');
}

function oosHookJsCodeMailAlert() {
	$.ajax({
		type: 'POST',
		url: "http://www.mykingdomforglitters.com/module/mailalerts/actions?process=check",
		data: 'id_product=3099&id_product_attribute='+$('#idCombination').val(),
		success: function (msg) {
			if ($.trim(msg) == '0') {
				$('#mailalert_link').show();
				$('#oos_customer_email').show();
			}
			else {
				$('#mailalert_link').hide();
				$('#oos_customer_email').hide();
			}
		}
	});
}

function  addNotification() {
	$.ajax({
		type: 'POST',
		url: "http://www.mykingdomforglitters.com/module/mailalerts/actions?process=add",
		data: 'id_product=3099&id_product_attribute='+$('#idCombination').val()+'&customer_email='+$('#oos_customer_email').val()+'',
		success: function (msg) {
			if ($.trim(msg) == '1') {
				$('#mailalert_link').hide();
				$('#oos_customer_email').hide();
				$('#oos_customer_email_result').html("Demande de notification enregistrée");
				$('#oos_customer_email_result').css('color', 'green').show();
			}
			else if ($.trim(msg) == '2' ) {
				$('#oos_customer_email_result').html("Vous avez déjà une alerte pour ce produit");
				$('#oos_customer_email_result').css('color', 'red').show();
			} else {
				$('#oos_customer_email_result').html("Votre adresse e-mail est invalide");
				$('#oos_customer_email_result').css('color', 'red').show();
			}
		}
	});
	return false;
}

$(document).ready(function() {
	oosHookJsCodeMailAlert();
	$('#oos_customer_email').bind('keypress', function(e) {
		if(e.keyCode == 13)
		{
			addNotification();
			return false;
		}
	});
	$( "#mailalert_link" ).click(function() {
		addNotification();
		return false;
	});

});

//]]>
</script>

I don't know much about javascript, so I tried my best, but without help, it's getting tricky. So, 6 months later... still nobody willing to give a little help here???....

Link to comment
Share on other sites

With astonishment now for us it works ! :o

We have only REFRESHed the module and now it seems to work

Of course there is something in the Java code that goes in conflict, so I think that everyone could have a different reason why it doesn't work, anyway something is certainly wrong, someone of the "crew" should help or repair it

Lucky us, bye

 

____________________________

http://www.kissene.com/en/

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...

Hello!

 

I solved the problem. There was a conflict between two product.tpl files. I deleted the template file product.tpl (/themes/default-bootstrap/modules/mailalerts/views/templates/front/mailalerts-account.tpl) and it works the link.

 

I hope you like this solution.

 

Thanks a lot! I had the same issue and this was the solution :)

Link to comment
Share on other sites

  • 1 month later...

Hello!

 

I solved the problem. There was a conflict between two product.tpl files. I deleted the template file product.tpl (/themes/default-bootstrap/modules/mailalerts/views/templates/front/mailalerts-account.tpl) and it works the link.

 

I hope you like this solution.

 

Where exactly did you delete the product.tpl ?  Please, thanks.

Never mind, my 1.6.0.13 stared working after a two hours of having cleared cache both browser and memchase in my hosting.  It must need time to activate. 

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

  • 1 month later...

Hello,

 

Solved the problem using PS 1.6.0.6 :

 

1- Make a copy of mailalerts.js (Inside : .\themes\your_theme\js\modules\mailalerts\mailalerts.js)

 

and paste Inside the module directory (remove the existing one): .\modules\mailalerts\js\mailalerts.js

 

2- Check and change if needed this last line (line 49) inside your customized theme

 

.\themes\your_theme\modules\mailalerts\views\templates\front\mailalerts_account.tpl

 

 

{addJsDef mailalerts_url_remove=$link->getModuleLink('mailalerts', 'actions', ['process' => 'remove'])|addslashes}

 

To

 

 

{addJsDef mailalerts_url_remove=$link->getModuleLink('mailalerts', 'actions', ['process' => 'remove'])|escape:'quotes':'UTF-8'}

 

Works now fine for me ;-)

 

I hope this give a little help !!

 

Good luck. Friendly

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

I had a customer with same problem, it looks like the mailalerts.js file isn't loaded correctly into the browser. My solution was to copy the scrip from mailalerts.js and paste it in the bottom for products.tpl. This is only a work around, but it worked for me

Link to comment
Share on other sites

  • 4 weeks later...

Hello I tried to do all the things you tell here. Actually mailalerts is "working" but only in the front end, because now I don't receive any mail when someone search for a product that is whitouth stock (like before), I don't receive any mail when someone fill the field with a mail address and press the button :( 

 

I don't know what to do now 

Link to comment
Share on other sites

I want to use this module in a specific way. I would like to receive the email of the client asking me if I have the size S available in my shop.

Is possible that I can receive a email with the information of this, email attribute selected and product?

Thank you for your help 

Link to comment
Share on other sites

  • 7 months later...

I am still facing the problem with not working button.

None of methods posted above worked.

There is a field for an e-mail and a button but when you press it id does nothing - it looks like there is no script.

Can someone please help me?

I really would love to use this feature.

Link to comment
Share on other sites

  • 4 months later...
  • 6 months later...

For everybody still fighting this:

 

Open product.tpl

 

Look for "<!-- Out of stock hook -->"

 

Change "{$HOOK_PRODUCT_OOS}" to "<!-- {$HOOK_PRODUCT_OOS} -->" (just 2 lines below)

 

Right below enter:

 

<!-- Begin insert -->

<script type="text/javascript">{literal}
// <![CDATA[
oosHookJsCodeFunctions.push('oosHookJsCodeMailAlert');
 
function clearText() {
if ($('#oos_customer_email').val() == '{/literal}{l [email protected]' mod='mailalerts'}{literal}')
$('#oos_customer_email').val('');
}
 
function oosHookJsCodeMailAlert() {
$.ajax({
type: 'POST',
url: "{/literal}{$link->getModuleLink('mailalerts', 'actions', ['process' => 'check])}{literal}",
data: 'id_product={/literal}{$id_product}{literal}&id_product_attribute='+$('#idCombination').val(),
success: function (msg) {
if ($.trim(msg) == '0') {
$('#mailalert_link').show();
$('#oos_customer_email').show();
}
else {
$('#mailalert_link').hide();
$('#oos_customer_email').hide();
}
}
});
}
 
function  addNotification() {
$.ajax({
type: 'POST',
url: "{/literal}{$link->getModuleLink('mailalerts', 'actions', ['process' => 'add'])}{literal}",
data: 'id_product={/literal}{$id_product}{literal}&id_product_attribute='+$('#idCombination').val()+'&customer_email='+$('#oos_customer_email').val()+'',
success: function (msg) {
if ($.trim(msg) == '1') {
$('#mailalert_link').hide();
$('#oos_customer_email').hide();
$('#oos_customer_email_result').html("{/literal}{l s='Request notification registered' mod='mailalerts'}{literal}");
$('#oos_customer_email_result').css('color', 'green').show();
}
else if ($.trim(msg) == '2' ) {
$('#oos_customer_email_result').html("{/literal}{l s='You already have an alert for this product' mod='mailalerts'}{literal}");
$('#oos_customer_email_result').css('color', 'red').show();
} else {
$('#oos_customer_email_result').html("{/literal}{l s='Your e-mail address is invalid' mod='mailalerts'}{literal}");
$('#oos_customer_email_result').css('color', 'red').show();
}
}
});
return false;
}
 
$(document).ready(function() {
oosHookJsCodeMailAlert();
$('#oos_customer_email').bind('keypress', function(e) {
if(e.keyCode == 13)
{
addNotification();
return false;
}
});
});
{/literal}
//]]>
</script>
 
<!-- MODULE MailAlerts -->
{if isset($email) AND $email}
<input type="text" id="oos_customer_email" name="customer_email" size="20" value="{l s='[email protected]' mod='mailalerts'}" class="mailalerts_oos_email" onclick="clearText();" /><br />
{/if}
<a href="#" title="{l s='Notify me when available' mod='mailalerts'}" onclick="return addNotification();" id="mailalert_link" rel="nofollow">{l s='Notify me when available' mod='mailalerts'}</a>
<span id="oos_customer_email_result" style="display:none;"></span>
<!-- END : MODULE MailAlerts -->
 
<!-- End insert -->
 
 
To get a list with all the notifications
 
look for "SQL queries" in left menue
 
click "New query"
 
enter name for query 
 
enter this code:
 
SELECT ps_customer.lastname as Customer, ps_mailalert_customer_oos.customer_email as Email, ps_product_lang.name as Product  from ps_mailalert_customer_oos 
LEFT JOIN ps_customer ON ps_customer.id_customer = ps_mailalert_customer_oos.id_customer LEFT JOIN ps_product_lang ON ps_product_lang.id_product = ps_mailalert_customer_oos.id_product order by  ps_mailalert_customer_oos.id_product 
 
 
Then you only have to click on the new query to see a table with all requests.
Link to comment
Share on other sites

  • 3 years later...
  • 7 months later...
6 hours ago, num47 said:

Can anyone tell me where to find the registered email addresses for out of products to be notified and which products they have registered for? 

Its better to start a new topic for your question the the future.

As you can see in the MailAlert.php on line 44 the table ps_mailalert_customer_oos is used to store this data.

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