Monday, June 3, 2019

Online Shop Web Design

Online Shop Web DesignShop 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 desire page when they login or signup into the Shop Online Web Application. The Customer can select the required items into the cart without enter 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 account card, they can also cancel the payment or return the items purchased only aft(prenominal) 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 expenditure checker, which intimates the customer regarding the item selected by them whenever there is a cut-off in the price of that item, but on ly 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 rail 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, executed_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 platFIG. 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, aim 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 where(s tatus sideOn) module Status On = on Off = off end private def set_default_attrs self.uuid = RandomCode.generate_product_uuid endend(product image)class ProductImage ApplicationRecord belongs_to product has_attached_file image, styles small 60x60, meat 200x200, big 960x validates_attachment_content_type image, content_type /Aimage/.*Z/ validates_attachment_size image, in 0..5.megabytesend(User)class User ApplicationRecord authenticates_with_sorcery attr_accessor password, password_confirmation validates_presence_of email, message Email can non 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?) endendController Code(Category)class CategoriesController ApplicationController def found categories = Category.grouped_data category = Category.find(paramsid) products = category.products.onshelf.page(paramspage 1).per_page(paramsper_page 12) .order(id desc).includes(main_product_image) endend(Product)class ProductsController ApplicationController def show categories = Category.grouped_data product = Product.find(paramsid) endend(Session)class SessionsController ApplicationController def new end def create if user= login(paramsemail,paramspassword)loginsorcery flashnotice=You have logged in redirect_to root_path else flashnotice=Emails or Password mistake redirect_to new_session_path end end def destroy logo ut flashnotice=You already logged out redirect_to root_path endend(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 flashnotice = sign up successfully Please log in redirect_to new_session_path else render action new end endend(Welcome)class WelcomeController ApplicationController def baron categories = Category.grouped_data products = Product.onshelf.page(paramspage 1).per_page(paramsper_page 12) .order(id desc).includes(main_product_image) endend

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.