There is a "coupon code" field in a default installation of a spree commerce shop.
I do, however, fail to find any means to create the according codes in the admin backend.
How is this supposed to be done?
Take a look at the Promotions section in the Spree admin area. You can add a coupon code there:
Related
I am new to ruby on rails
I want a rails application it contain login form, registration form, order page and admin form,user order a product it update on admin page.
example: user have 3 products 1.laptop 2. phone 3.speakers, if user ordered phone, it must display on admin page like x user order phone.
please help me, I am beginner, please help me
Below is just a small brief .I can't write complete code over here.
You can use Devise gem for login & registration.
For adding roles to the particular user , use cancan gem.
Then , create scaffold for Product.
Create the view for corresponding pages.
Insert the products.
Create Order model & controller , create association with product & so on...
I am building an ecommerce solution using spree to handle products/orders etc.
I am having a little trouble figuring how to create spree entries through my signup controller. The user fills a form out and then it is supposed to:
1) create a new user object with addresses
2) create a new order for that user + add a subscription product to that order
3) Create a stripe customer and add a stripe plan
4) Redirect to a confirmation page.
I can't seem to find much in the way of documentation for integrating with spree from a custom rails setup (only overriding their templates).
The issue I am having is that I am not seeing the new user object being created. I pulled this code from the backend and modified it to create a new user when the signup form is submitted:
user_params = {"email" => emailAddress,"password"=> password}
spreeUser = Spree.user_class.new(user_params)
spreeUser.save
This isn't adding any new user to the DB. I have also tried through the api endpoint POST api/users but still no luck.
Is it possible to use spree in this way and if so what am I doing wrong!
Spree does not have a user class built in. You need to either (1) use the Spree Auth Devise gem, (2) use another gem like regular Devise to create a user class or (3) create your own. If you do (2) or (3), you then set up Spree to recognize that user class.
This Spree documentation walks you through how to do just that.
I am building an e-commerce site using spree. I am new to Ruby/RoR and Spree, though not to programming and web development.
I am still carrying out research on logistics, pricing, which products to actually stock up on etc., so I simply want to display product information, and not the price and/or ability to purchase.
I have searched extensively online (to no avail), on how to do the following things I ave listed below:
I want to know how (perhaps, this requires code modification):
NOT show the price of products ANYWHERE on the site (including the product page)
On the product page, NOT show the 'Add to Cart' button
On the product page, SHOW a form that allows the user to register to the site, so that they can be contacted when the product becomes available
I am not looking for detailed steps, simply guidelines that I can follow to make the appropriate changes to the configuration (or code - if required), in order to meet these requirements.
You're going to need to override the view templates.
Try running bundle show spree or bundle open spree if you have an editor setup for bundle, this way you'll know which file you need to change. Its likely going to be somewhere here or in one of the partials, look around.
Then you can override it with deface, see Spree Docs here
If you want override the whole file, then just create the file in your app, for example, if you wanted to override spree/frontend/app/views/spree/products/show.html.erb from the gem.
You'd create the same file with your custom code in it, make sure to follow the same path and naming.
I'm a Rails noob. I'm looking to implement an application where users can purchase a multi-visit pass, then spend the credits week-by-week.
For example, register and login, then purchase 10 visits at a gym - the system should list 10 remaining visits. Sign up to a class and 9 remaining visits are listed. When the credits are low, remind the user to top them up with another 10-visit pass, etc.
I know I can use Devise and CanCan to manage the authentication and authorisation aspects.
My question is whether there's already a gem to handle the management of the user's credits, or whether I'd need to write this from scratch.
I've searched https://rubygems.org/gems/rails with no luck, but it's entirely possible I'm missing something obvious.
I don't think there is a gem to do that, but it should be pretty simple to code:
Add remaining_visits to your User model and table.
Do current_user.update(remaining_visits: current_user.remaining_visits+10) when a ticket is purchased.
Copy Devise sessions controller into app/controllers/devise/sessions_controller.rb.
Inside this controller, add this kind of code to create (where the user logs in): current_user.update(remaining_visits: current_user.remaining_visits-1).
Note: Instead of copying Devise sessions controller you can just overwrite the create action.
I need :project_owners to invite new :project_participants to a project.
Much like in Basecamp, the :project_owner needs to be able to assign the new :project_participant to projects prior to them completing their full profile (their profile will show "invited" status until they complete their profile).
Once the :project_participant has created a profile their project/index should automatically include any projects they were assigned to prior to finalising their profile.
Authlogic is used for authentication. You should use 'declarative_authorization' or 'CanCan' for authorization.
Authentication gems are used to check whether a user's record exist in database or not and authorization gems are used to check their privileges. You should check out railscasts for more information.
This on is for declarative_authorization and this one is for CanCan.
Once you set privilages you can create method to let you project_owner invite other users and you can assign them temporary status in your database. I this CanCan is best suitable for your needs.