updat e addorder for product add

This commit is contained in:
Aung Myo
2017-10-10 18:05:09 +06:30
parent e039b8adba
commit 50756656a7
7 changed files with 154 additions and 8 deletions

View File

@@ -3,4 +3,24 @@ class Product < ApplicationRecord
# Product Image Uploader
mount_uploader :image_path, ProductImageUploader
def self.search_by_product_code(item_code)
menu_item_hash = Hash.new
mt_instance = Product.find_by_item_code(item_code)
if (!mt_instance.nil?)
menu_item_hash[:type] = 'SetMenuItem'
menu_item_hash[:account_id] = 1
menu_item_hash[:item_code] = mt_instance.item_code
menu_item_hash[:item_instance_code] = mt_instance.item_code
menu_item_hash[:name] = mt_instance.name.to_s
menu_item_hash[:alt_name] = mt_instance.alt_name.to_s
menu_item_hash[:price] = mt_instance.unit_price
menu_item_hash[:promotion_price] = 0
menu_item_hash[:is_on_promotion] = 0
menu_item_hash[:is_available] = 0
menu_item_hash[:taxable] = mt_instance.taxable
return menu_item_hash
end
end
end