2

once registered user click on button in view page we are creating new product and displaying that information in pop up as below

enter image description here

button code : [ full code : https://pastebin.com/da60SSWH ]

 <button onclick="return setproductlogin(\'<?php echo 
Mage::registry("current_product")->getId()?>\', event);setrequestlogin();" 
 id="submit-editorApply-{{rand}}">save design</button>

image url script [ full code : https://pastebin.com/19K43TyR ]

saveImageDefaultUrl : '<?php echo Mage::helper('aitcg')-
>getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/createImageDefault',array('id' =>
 Mage::registry("current_product")->getId()))); ?>',

but if guest click on same button, its creating new product , but its redirecting to another page , but we want to display that message in pop up.... [ controllers : https://pastebin.com/9wsgufJX ]

enter image description here

asked Apr 10, 2017 at 19:28

1 Answer 1

1

I think you will require to add jQuery for this. Try adding below jquery code in your login popup "Login into your Account 4"

Add below code after this line,

var ajaxLoginForm = new VarienForm('ajaxlogin-login-form', true);
jQuery("#ajaxlogin-login-form").submit(function(e) {
 e.preventDefault();
 if (ajaxLoginForm.validator.validate()) {
 jQuery.ajax({
 type: "POST",
 url: jQuery('#ajaxlogin-login-form').attr('action'),
 }).done(function(result) {
 alert(result);
 }).fail(function() {
 alert('There is some error saving your design.');
 });
 }
});
answered Apr 11, 2017 at 8:34
7
  • check updated code, you need to add the code after line var ajaxLoginForm = new VarienForm('ajaxlogin-login-form', true); Commented Apr 11, 2017 at 9:15
  • sorry, in a hurry to reply you, i didt observed , updated as you suggested, pastebin.com/XVacqNhg Commented Apr 11, 2017 at 9:17
  • Please use ajaxLoginForm instead of myform check updated code Commented Apr 11, 2017 at 9:19
  • updated ajaxLoginForm code Commented Apr 11, 2017 at 9:20
  • The code is not working because you need to add id to your form. <form action="<?php echo $this->getUrl('example/amasty/createSimpleProductAndRedirect', array('_secure'=>(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on'), 'id' => Mage::registry('current_product')->getId())) ?>" id="ajaxlogin-login-form"> Commented Apr 11, 2017 at 9:24

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.