- Users context with password hashing using Argon2.
- Users can login and logout using Guardian.
- Users can register, using a simple client-side verification and one server-side.
- Users get recognized between admin and normal.
- Admin can add/delete/edit product.
- Spanish and English supported based on Locale.
- Support for Markdown.
- Support for adding pictures to Product. (Locally for now)
- Shopping cart added. Users can add, edit, remove products, when an unlogged user logs in, the items that are NOT in the user's db cart are added and the session cart is deleted.
- Payments
- Shipping (User addresses)
- Orders
Nothing at the moment
- SEO tags
- Flexible configuration
- Wishlist (Optional for now)
-
There's a bug where
Repo.preload/2
raises an ArgumentError on tests; specifically "cannot load[]
as type :map for fieldproducts
in schema Ecom.Accounts.Cart" but it works on dev. -
Do proper cleanup when payment is made (Value state, Product quantity, etc...)
-
Add amount of order and order "receipt" to Admin dashboard once a payment is done.
-
Do new incorporation of Paypal (Or any other payment gateway, honestly), right now it's being used as a client-side with a websockets solution for validation.
-> git clone https://github.com/aguxez/ecom.git
-> cd ecom
-> mix do deps.get, compile
-> cd apps/ecom
-> mix ecto.setup
-> cd ../ecom_web/assets
-> yarn
Add something to seeds.exs
and then mix run priv/repo/seeds.exs
iex mix -S phx.server
and go to localhost:4000
For local uploads, the folder being used is /var/www/uploads/product/image/
, if you want to remove this, edit Ecom.Uploaders.Image.storage_dir/2
and the Plug
serving these files on endpoint.ex
.
Payment solution for this commit
There was a lot to think here. I wanted to take the approach of just using a simple "Pay" button from PayPal that had information on inputs on the front-end, obviously this is a security flaw and I wanted to take care of that (At this exact moment I don't have access to a 'live' PayPal token, hence I couldn't just use their API). I used WebSockets for validating the information being sent, updating the amount and redirect URL accordingly, also I put an UUID on the session to check on the redirect URI so we can validate the order and place it on the admin panel; with the session approach we don't risk getting a GET request on the payments endpoint and processing an order which wasn't paid since we validate the UUID in the parameter. To remove this, edit:
socket.js
payments_channel.ex
user_socket.ex
payments_controller.ex
index.html.eex
from the Payments folder in templatesworker.ex
from theEcom
app.pay_id.ex
from the Plugs folder in theEcomWeb
app.
It's a helper function from EcomWeb.Helpers
imported in the Controllers and Views
When Poison
throws an encoding error such as unable to encode value {nil, "users"}
, it's because the Struct or whatever you're trying to encode has private data such as __meta__
.
Solution: Add @derive {Poison.Encoder, except: [:__meta__]}
or the field that has private data to the schema you're retrieving information from.
yarn add babel-plugin-transform-object-rest-spread --save-dev
then on .brunch-config.js
on plugins/babel
: "plugins": ["transform-object-rest-spread"]
var Foundation = require('foundation-sites/dist/js/foundation');
then
$(document).ready($ => {
$(document).foundation();
})
All configuration is given through config :gettext, opts
, not config :my_app, MyApp.Gettext
As default text editor.
At the beginning they're handled locally, if you're planning to use a Cloud Storage Service, further configuration is required.
Arc_ecto provides the cast_attachments
function. The attachment should be casted only on that function and not on cast
Install babel-plugin-transform-runtime
and add it to the plugins besides other common dependencies