Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post Request Required #15

Closed
markcoogan opened this issue Nov 23, 2021 · 10 comments
Closed

Post Request Required #15

markcoogan opened this issue Nov 23, 2021 · 10 comments

Comments

@markcoogan
Copy link

Hi there,

We've installed the plugin and used the example form in the helper template, but when we submit the form we get the message:

Post request required

Is there any further steps required to get this working that we might have missed?

@TomDeSmet
Copy link

Add method="post" to your form element.

@markcoogan
Copy link
Author

Hi Tom,

Thanks for that. I had tried that before but it was doing the same thing, but seems to be refreshing the page now anyway.

It doesn't appear to be sending a notification email though, is there anything you can think of that might be causing that?

@TomDeSmet
Copy link

That could be a number of things. Is your Craft mail correctly configured ? (Test it with the Craft test mail button).

Also, this may sound stupid but, this plugin is able to send 2 mails.
A notification for when you leave your e-mail to be notified. This you have to enable from the plugin settings.
A notification for when the product is back in stock, this only happens when the stock of the product is greater than 0 of course, so have you switched the stock while testing?

Sorry if I state the obvious, but sometimes issues have the simplest solution :)

@markcoogan
Copy link
Author

Hi Tom,

Thanks for your help. I can confirm that the site can send emails and I've ticked the box to send a notification when the user enters their address to be notified.

I've just taken the helper form template and dropped that into the site as is, as its own template. Does the form need to be integrated in all particular way?

@TomDeSmet
Copy link

Not realy, did you uncomment this in the code: <input type="hidden" name="variantId" value="{# product.defaultVariant.id #}"> ?

@markcoogan
Copy link
Author

Hi Tom,

That's right, I did. I've got

That look ok? Can I hard code that to a specific product for testing?

@TomDeSmet
Copy link

A specific variant ID of a product yes.

@markcoogan
Copy link
Author

Hi Tom,

I've done some more work on this and I have it at the point where it's successfully sending emails, thanks for your help.

The only small issue is that when someone requests to be notified, it does not send the confirmation straight away. When the product is back in stock, and that email is sent, it then sends both emails at the same time.

Is there anything I've missed that could be causing that?

@TomDeSmet
Copy link

Emails are added to the Craft CMS job queue. That queue is only executed when someone logs into the Control Panel or the queue command is run from the terminal.

So try this: subscribe to be notified, go to the CP and refresh (you should see an e-mail notification being sent in the queue), check your e-mail for the notification, update the stock, check your email for the second mail.

To make this work on a production server, you should add a CRON job to the server which periodically runs the Craft CMS queue.

@markcoogan
Copy link
Author

Hi Tom,

Thanks for that. That all seems to be working correctly now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants