CameraTek Posted December 11, 2012 Share Posted December 11, 2012 Hi all, My website is set up so you can pre-order products. If pre-order isn't allowed, there's a "notify me when available" box showing up. What I want is to enable pre-order and still have the "notify me when available" box showing. I've managed to get the box showing but when I enter an email address it comes up with "Your email address is invalid". Here's a link to what I have done so far http://www.cameratek.co.uk/18428-powershot-g15-digital-camera-6350b010aa.html Have I missed anything out from the code? Here's the code I added to the product.tpl file below <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 (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 (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 (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() { $('#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="#" onclick="return addNotification();" id="mailalert_link">{l s='Notify me when available' mod='mailalerts'}</a> <span id="oos_customer_email_result" style="display:none;"></span> <!-- END : MODULE MailAlerts --> I got this code from the module itself. Any help would be appreciated Cheers Andy Link to comment Share on other sites More sharing options...
CameraTek Posted December 20, 2012 Author Share Posted December 20, 2012 Is there anyone out there with any suggestions? Andy Link to comment Share on other sites More sharing options...
Recommended Posts