Friday, March 29, 2019
Online Shop Web Design
Online Shop sack DesignShop Online Web Application agreement, allows the guest 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 tidy sum select the required items into the drag on without logging into their account. But the purchase of the items in the cart has to be through using their registered account in the System using either faith or debit card, they can also cancel the payment or return the items purchased only after a detailed specification of the modestness 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. thither 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, bu t only for a few selected items. There is also a desired page for the annals 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 acquire a link to reset password to their concerned web mail.Requirements for the system are we will be using Ruby On racecourse for the development, and for the web design HTML, Javascript and CSS. The Back blockade is managed by MySQL.The Database for the System inhabits of shop online development database which consist of tables for categories, returns, product images, drug 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 DiagramFIG. 1 (Relationship between the tables)In ruby on trail the web application code is divided into model, view, controller. Model represents the database access, View represents the hypertext markup language pages before and after access of the database, and controller represents the action to be through once the we get a request from the Web Application.Model enrol(Category) mannequin Category ApplicationRecord validates title, presence message Empty name validates title, singularity message Repeated name has_ancestry orphan_strategy destroy has_many products, dep windupent destroy before_validation correct_ancestry def self.grouped_data self.roots .order(weight desc).inject() do result, parent row = row where(status StatusOn) module Status On = on Off = off subvert 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, middle 200x200, elephantine 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 e-mail can non be countermand 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. juvenile_record? (self.password.nil?self.password_confirmation.nil?) endendController Code(Category)class CategoriesController ApplicationController def show 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 e lse flashnotice=Emails or Password mistake redirect_to new_session_path end end def destroy logout 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 index categories = Category.grouped_data products = Product.onshelf.page(paramspage 1).per_page(paramsper_page 12) .order(id desc).includes(main_product_image) endend
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.