BrianTheCoder / spree_stock_email

Receive emails when products are back in stock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#SpreeStockEmail

Allow users to create notifications of when products are back in stock.

This extension has no views, you will have to add those yourself sadly. If the current user is logged in then emails will be created based on their current email address, otherwise they are prompted to enter one.

Here is a basic partial:

<% if spree_current_user %>
  <%= link_to stock_emails_path(stock_email: {product: @product.id}), method: :post do %>
      Notify me
  <% end %>
<% else %>
  <%= form_for :stock_email, url: stock_emails_path do |form| %>
    <%= form.hidden_field :product, value: @product.id %>
    <%= form.label :email, "Your email address" %>
    <%= form.text_field :email %>
    <%= button_tag class: 'button', type: :submit do %>
      Notify me
    <% end %>
  <% end %>
<% end %>

##Installation

Add spree_stock_email to your Gemfile:

gem 'spree_stock_email'

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails g spree_stock_email:install

About

Receive emails when products are back in stock

License:BSD 3-Clause "New" or "Revised" License