info@rranktec.com
+91 80 65655677
Logo
  • Home
  • About Rank
    • Our Latest Project

      Show Me

      We combine deep technology expertise and industry-specific insights into how technology impacts people and processes to deliver solutions that help clients achieve business outcomes with agility, speed and certainty.

      Rank Pages

      • About
      • Official Fedena Technology Partner
      • Rank Team
      • Customer Testimonials

      About Us

      Rank technologies is an Leading IT solutions provider based in Bangalore, India. providing end-to-end solutions with a team of vast expertise and strong technical proficiency. Beyond development of business solutions, we help you in deploying, managing and scaling them. No headaches for you!

  • Services
    • Fedena Services
    • Design & Development
    • Consultancy Services
    • Mobile Applications Development
  • Products
    • EasyAd
    • Fedena
    • DoctorInHome
    • Admonk
    • Ashvayana
    • Honudi App
    • Yojane
  • Blogs
  • Contact Us

Rank Blogs

  1. Home
  2. Rank Blogs
14-06-2016 Spree  Spree 

Spree E-Commerce Integration

Spree E-Commerce Application setup in local machine

 

(Spree Version 3.0.stable)

 

Step 1. Set up all required configuration in your console

 

  1. Install rails version

$ gem install rails -v 4.2.2
  1. Gem install bundler

$ gem install bundler
  1. Install ImageMagick gem to manage images in the application

$ sudo apt-get install imagemagick
  1. Now install spree through the following command.

$ gem install spree_cmd
  1. Create new rails application.

$ rails_4.2.2_new <Application Name>
  1. Go to application

$ cd <Application Name>
  1. Use rvm version.

$ rvm use 2.2.1
  1. Install all spree application dependencies with the help of the following command.

$ spree install --auto-accept

It will add spree to our rails application.

Run the application

 

$ rails s

You will be having one default admin for this application with the

UserName: spree@example.com
Password: spree123
  1. If you want to create new admin to your application

You can create admin user in 2 ways

  1. Using command through console

$ rake spree_auth:admin:create
  1. And in front login with existing admin user and go to admin panel in that click user and create the admin user.

 

Customization of spree

 

Customization of spree application follows the simple steps

Here few simple features customization are shown

The spree application contains a folder called Overrides to customize the features required.

  1. First to change home text name to customized paste the following piece of code in the folder Overrides/spree/change_home_text.rb

Deface::Override.new(:virtual_path => 'spree/shared/_main_nav_bar',
:replace => "li#home-link",
:text => "<li id='home-link' data-hook><%= link_to 'Home Page', spree.root_path %></li>",
:name => "chnage_home_text")
  1. To change logo to your required logo

Go to config/initializers/spree.rb

spree.config do |config|
config.logo = 'logo.png'
config.admin_interface_logo = 'logo.png'
end

And paste the image logo.png in your app/assets/images folder

  1. To change footer for the user panel

Go to the folder app/views/

Create a folder spree

In spree create layouts folder, inside that create a new file name as spree_application.html.erb

Inside the file paste the following piece of code

<!doctype html>
<!--[if It IE 7]> <html class="ie ie6" lang="<%= I18n.locale %>"><![endif]-->
<!--[if IE 7]> <html class="ie ie7" lang="<%= I18n.locale %>"><![endif]-->
<!--[if IE 8]> <html class="ie ie8" lang="<%= I18n.locale %>"><![endif]-->
<!--[if IE 9]> <html class="ie ie9" lang="<%= I18n.locale %>"><![endif]-->
<!--[if gt IE 9]><!--> <html lang="<%= I18n.locale %>"><![endif]-->
<head data-hook="inside_head">
<%= render partial: 'spree/shared/head'%>
</head>
<body class="<%= body_class %>" id="<%= @body_id || 'default' %>" data-hook="body">
<%= render partial: 'spree/shared/google_analystics.js' %>
<%= render partial: 'spree/shared/header' %>
<div class="container">
<div class="row" data-hook>
<%= breadcrumbs(@taxon) %>
<%= render partial: 'spree/shared/sidebar' if content_for? :sidebar %>
<div id="content" class="<%= !content_for?(:sidebar) ? "col-sm-12" : "col-sm-8 col-md-9" %>" data-hook>
<%= flash_messages %>
<%= yield %>
</div>
<%= yield :templates %>
</div>
</div>
<footer class="footer pt-80">
<hr />
<section class="copyright ptb-60">
<div class="container">
<center><p class="">
All Right Reserved
</p></center>
</div>
</section>
</footer>
</body>
</html>

Hosting spree application in Heroku server

 

  1. In config/environment/production.rb add the following line

 config.assets.initialize_on_precompile = false
  1. In gem file comment sqlite3 and add the following gems to your Gemfile

 gem 'rails_12factor', group: :production
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
 $ bundle install
  1. Login to your Heroku app in console with the help of command

 $ heroku login
  1. Create the Heroku app with the same name of your application

 heroku create app_name
  1. Push the code to Heroku application with the help of the following command
 git push heroku master

 

S3 Bucket Setup for Uploading Images

s3 bucket bucket setup follows the few simple steps are listed below.

Step 1: Before going to set up s3 bucket in your spree and Heroku app, you should have s3 bucket credentials.

Credentials Required

 a. Bucketname
b. Access Key Id
c. Secret Access Key

Step 2: In your application go to Gemfile

 Add gem 'aws-sdk', '< 2.0'
 $ rake db:migrate

Step 3: Goto to config/initializers/spree.rb

Paste the following piece of code

 Spree.config do |config|
attachment_config = {
s3_credentials: {
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
bucket: ENV['S3_BUCKET_NAME']
},
storage: :s3,
s3_headers: { "Cache-control" => "max-age=31557600"},
s3_protocol: "https",
bucket: ENV['S3_BUCKET_NAME'],
url: ":s3 domain url",

styles: {
mini: "48x48>",
small: "100x100>",
product: "240x240>",
large: "600x600>"
},

path: "/spree/:class/:id/:style/:basename.:extension",
default_url: "/spree/products/:id/:style/:basename.:extension",
default_style: "product",
}

attachment_config.each do |key, value|
Spree::Image.attachment_definitions[:attachment][key.to_sym] = value
end
end

Step 4: Login to your Heroku app

Run the following commands

 $ heroku config:set S3_BUCKET_NAME=bucket_name
 $ heroku config:set AWS_ACCESS_KEY_ID=access_key_id
 $ heroku config AWS_SECRET_ACCESS_KEY=secret_access_key

Run the following command

 $ git push heroku master

 

Spree Email Integration

Add the following gem to your Gemfile

 gem 'spree_mail_settings', github: 'spree-contrib/spree_mail_settings', branch: '3-0-stable'

Run bundle

 $ bundle install

Push to Heroku master

 $ git push heroku master

Then login to your application as an admin and in that go to admin path in that select configuration in that goto Mail method Settings and add your credentials they are you will be done with email settings to your spree app

Setting Paypal Express to your Spree Application

Add the following gem to your gem file

 gem 'spree_paypal_express', github: 'spree-contrib/better_spree_paypal_express', branch: '3-0-stable'

Run bundle command

 $ bundle install

Also, run the following command

 $ bundle exec rails g spree_paypal_express:install

To set this one in Heroku application commit all migration added, Gemfile and Gemlock.file and login to Heroku application push the code to Heroku server using

 $ git psuh heroku master

You also need to run the migration with the help of the following command

 $ heroku run rake db:migrate

 

To set PayPal express method in your spree application login to application in the server as an admin and go to admin in that select configuration inside that select Payment Method select new payment method in that select PayPal express method in that and write a name you want to display on the front end, and then press create., it will redirect to next page there you update credentials you will be done with Paypal express integration to your application.


Chethan Kumar IL

Ruby on Rails Developer, worked at different aspects of web development. I have worked on many Web Applications and Doing Performance Optimization, . Also worked with different Gems and Plugins to integrate as well as customize them as per project requirements.

  •  chethan.lakshminarayan89@gmail.com
  • www.linkedin.com/in/chethankumaril

Search

Categories

  • Payment1
  • Express Checkout1
  • Paypal1
  • Devise4
  • Authentication4
  • Google Login1
  • SMS Alert1
  • Java Install1
  • DEPLOY A JAVA APP1
  • Saas1
  • Java in AWS Using Tomcat1
  • PAYU Integration1
  • Paginate1
  • Ransack Search1
  • Sun Spot1
  • DEPLOY RAILS APP AWS1
  • E-commerce1
  • spree1
  • USSD1
  • MySQL1
  • Facebook Login1
  • Rjb Gem Excel File1
  • Date-Time 1
  • Rails with Oracle1
  • Json1
  • Wicked PDF1
  • Heroku3
  • SMTP1
  • override1
  • Android SDK and App1
  • Ruby on Rails1
  • version control1
  • Redmine Plugins1
  • Offers1
  • Project Management1
  • Helpy Modern Helpdesk1
  • Spree1
  • offshore Development Centre1

Tags

Spree 

Contact

  • Rank Technologies.
  • New Bengaluru International Airport road, Bengaluru North-562157
  • info@rranktec.com
  • +91 80 65 655 677
  • www.rranktec.com

Latest Work

Newsletter

Get in touch with us today, if you think Rank could help you meet your requirements.


© Rank Technologies. 2017 All right reserved.

  • Home
  • Services
  • Products
  • Blog
  • Contact