Sends an email to users who have requested to be notified when a product is restocked
To install In Stock Notifier, follow these steps:
- Download & unzip the file and place the
instocknotifier
directory into yourcraft/plugins
directory - -OR- do a
git clone https://github.com/n-dW/instocknotifier.git
directly into yourcraft/plugins
folder. You can then update it withgit pull
- -OR- install with Composer via
composer require n-dW/instocknotifier
- Install plugin in the Craft Control Panel under Settings > Plugins
- The plugin folder should be named
instocknotifier
for Craft to see it. GitHub recently started appending-master
(the branch name) to the name of the folder for zip file downloads.
In Stock Notifier works on Craft 2.4.x and Craft 2.5.x.
Allows users to request to be notified when a product is restocked via email.
None nessesary ATM just install
Send a POST request to inStockNotifier/notification/requestRestockNotification with the fields
- customerEmail - the email address of the person who wants to be notified when product is restocked
- productId - the id of the product
<input type="hidden" name="action" value="inStockNotifier/notification/requestRestockNotification">
<input type="hidden" name="productId" value="{{product.id}}">
<input type="hidden" name="customerEmail" value="{{ currentUser.email }}">
This will create a record in the db.
The emails are sent when a product is saved and its stock increased to greater than zero. We use the event commerce_products.onBeforeSaveProduct and check if the product is about to be saved from the cp and that its stock was 0 and will be increased upon save.
If you don't want it to send onBeforeSaveProduct or to send with a task or cron job use:
craft()->inStockNotifier_notification->processNotifications();
This will go through ever request that has not been sent yet and return all the requests that have product in stock and attempt to send emails to the user.
Additionally you can add
craft()->inStockNotifier_notification->processNotifications($productId = false, $isReStock = false);
- $productId will get all notification requests for that product
- $isReStock if this is true it means we checked that the product is in stock already and we dont need to do it twice, use this with $productId.
- Add a widget to show latest request, and latest emails sent and failed send.
- Add a trigger in cp to send emails
- Make email customizable
- Add archive flag to db table to archive send ones.
- Release it
Brought to you by NdW