Description:
It generate initialize file for Cartify gem
Usage:
rails generate initializer This will create: config/initializers/cartify.rb and //= require jquery //= require cartify/application.js to your app/assets/javaskript/application.js Copy migrations to main app: (DON'T DO IT NOW!, initializer make it for you) rake cartify:install:migrations Define associations in your "User" model: has_many :orders, class_name: 'Cartify::Order', foreign_key: :user_id has_one :billing, class_name: 'Cartify::Billing', foreign_key: :user_id has_one :shipping, class_name: 'Cartify::Shipping', foreign_key: :user_id has_many :addresses, class_name: 'Cartify::Address', foreign_key: :user_id Include helpers from engine: (DON'T DO IT NOW!, initializer make it for you) # ../app/controllers/application_controller.rb helper Cartify::Engine.helpers add to cart: Use helper: add_to_cart(product, quantity, button_name) # product - name of your selling product (required!) # quantity - how many goods you with put into cart (default: 1) # button_name - button name (default: Add to cart) Or customize as you with: helper link: cartify.order_items_path() required params: order_item: {quantity: quantity, product_id: product.id} use method: method: :post asynchronously: remote: true # Example: link_to cartify.order_items_path(order_item: {quantity: quantity, product_id: product.id}), { method: :post, remote: true } #Shop icon helper shop_icon_quantity # you need add jQuery and custom styles to app/assets/javaskript/application.js (DON'T DO IT NOW!, initializer make it for you) //= require jquery //= require cartify/application.js if remote true not working try to add //= require jquery_ujs