Online Shop Web Design

Shop Online Web Application system, allows the customer to shop online for their required items, and also represents an associated window for the orders selected by the customer. Each Customer will be having their desired page when they login or signup into the Shop Online Web Application. The Customer can select the required items into the cart without logging into their account. But the purchase of the items in the cart has to be done using their registered account in the System using either credit or debit card, they can also cancel the payment or return the items purchased only after a detailed specification of the reason for it. The Logged In customers will be having a wish-list function so that they can put the items they wanted to buy in the wish-list and can buy later. There is one more function price checker, which intimates the customer regarding the item selected by them whenever there is a cut-off in the price of that item, but only for a few selected items. There is also a desired page for the history of items bought by the customers.  The customer can maintain their account and address details. The customer also can reset their password if forgotten by getting a link to reset password to their concerned web mail.

Requirements for the system are we will be using Ruby On Rails for the development, and for the web design HTML, Javascript and CSS. The Backend is managed by MySQL.

The Database for the System consists of shop online development database which consist of tables for categories, products, product images, users.

The Columns for the categories are id, title, weight, products_counter, created_at, updated_at, ancestry. The Columns for products are id, category_id, titile, status, amount, uuid, msrp, price, description, created_at, updated_at, lprice. The Columns for the product images are id, product_id, weight, image_file_name, image_content_type, image_file_sizee, image_updated_at, created_at, updated_at. The Columns for the users are id, email, crypted_password, created_at, updated_at,activation_state, activation_token, activation_token_expires_at, remember_me_token, remember_me_token_expires_at, reset_password_token, reset_password_token_expires_at, reset_password_email_sent_at.

Entity Relationship Diagram:

FIG. 1 (Relationship between the tables)

In ruby on rails the web application code is divided into model, view, controller. Model represents the database access, View represents the html pages before and after access of the database, and controller represents the action to be done once the we get a request from the Web Application.

Model Code:

(Category)

class Category < ApplicationRecord

  validates :title, presence: { message: “Empty name!” }

  validates :title, uniqueness: { message: “Repeated name!” }

  has_ancestry orphan_strategy: :destroy

  has_many :products, dependent: :destroy

  before_validation :correct_ancestry

  def self.grouped_data

    self.roots.order(“weight desc”).inject([]) do |result, parent|

      row = []

      row << parent

      row << parent.children.order(“weight desc”)

      result << row

    end

  end

  private

  def correct_ancestry

    self.ancestry = nil if self.ancestry.blank?

  end

end

(Product):

class Product < ApplicationRecord

  validates :category_id, presence: { message: “Empty category!” }

  validates :title, presence: { message: “Empty name!” }

  validates :status, inclusion: { in: %w[on off],

                                  message: “Status must be on or off!” }

  validates :amount, numericality: { only_integer: true,

                                     message: “Amount must be integer!” },

            if: proc { |product| !product.amount.blank? }

  validates :amount, presence: { message: “Empty Amount!” }

  validates :msrp, presence: { message: “Empty MSRP!” }

  validates :msrp, numericality: { message: “MSRP must be number!” },

            if: proc { |product| !product.msrp.blank? }

  validates :price, numericality: { message: “Price must be number!” },

            if: proc { |product| !product.price.blank? }

  validates :price, presence: { message: “Empty price!” }

  validates :description, presence: { message: “Empty describe!” }

  belongs_to :category

  has_many :product_images,-> { order(weight: ‘desc’) }, dependent: :destroy

  has_one :main_product_image, -> { order(weight: ‘desc’) },

          class_name: :ProductImage

  before_create :set_default_attrs

  scope :onshelf, -> { where(status: Status::On) }

  module Status

    On = ‘on’

    Off = ‘off’

  end

  private

  def set_default_attrs

    self.uuid = RandomCode.generate_product_uuid

  end

end

(product image):

class ProductImage < ApplicationRecord

  belongs_to :product

  has_attached_file :image, styles: {

      small: ’60^x60′,

      middle: ‘200^x200’,

      big: “960x”

  }

  validates_attachment_content_type :image, content_type: /Aimage/.*Z/

  validates_attachment_size :image, in: 0..5.megabytes

end

(User):

class User < ApplicationRecord

  authenticates_with_sorcery!

  attr_accessor :password, :password_confirmation

  validates_presence_of :email, message: “Email cannot be empty!”

  validates_format_of :email,message: “Email format mistake!”,

                      with: /w+([-+.’]w+)*@w+([-.]w+)*.w+([-.]w+)*/,

                           if: proc { |user| !user.email.blank? }

  validates :email, uniqueness: true

  validates_presence_of :password, message: “Password cannot be empty!”,

                        if: :need_validate_password

  validates_presence_of :password_confirmation, message: “Password confirm cannot be empty!”,

                        if: :need_validate_password

  validates_confirmation_of :password,message: “Password not right” ,

                            if: :need_validate_password

  validates_length_of :password, message: “Password at least 6 digits”, minimum: 6,

                      if: :need_validate_password

  def username

    self.email.split(‘@’).first

  end

  private

  def need_validate_password

     self.new_record? || (!self.password.nil?||!self.password_confirmation.nil?)

  end

end

Controller Code:

(Category)

class CategoriesController < ApplicationController

  def show

    @categories = Category.grouped_data

    @category = Category.find(params[:id])

    @products = @category.products.onshelf.page(params[:page] || 1).per_page(params[:per_page] || 12)

                    .order(“id desc”).includes(:main_product_image)

  end

end

(Product):

class ProductsController < ApplicationController

  def show

    @categories = Category.grouped_data

    @product = Product.find(params[:id])

  end

end

(Session):

class SessionsController < ApplicationController

  def new

  end

  def create

    if user= login(params[:email],params[:password])#loginsorcery

      flash[:notice]=”You have logged in!”

      redirect_to root_path

    else

      flash[:notice]=”Emails or Password mistake…”

      redirect_to new_session_path

    end

  end

  def destroy

    logout

    flash[:notice]=”You already logged out!”

    redirect_to root_path

  end

end

(User):

class UsersController < ApplicationController

  def new

    @user = User.new

  end

  def create

    @user= User.new(params.require(:user).permit(:email,:password,:password_confirmation))

    if @user.save

      flash[:notice] = “sign up successfully! Please log in”

      redirect_to new_session_path

    else

      render action: :new

    end

  end

end

(Welcome):

class WelcomeController < ApplicationController

  def index

    @categories = Category.grouped_data

    @products = Product.onshelf.page(params[:page] || 1).per_page(params[:per_page] || 12)

                    .order(“id desc”).includes(:main_product_image)

  end

end

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our Guarantees

Money-back Guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism Guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision Policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy Policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation Guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more