change entity name
Showing
venshop_app/app/views/cards/index.html.erb
0 → 100644
venshop_app/app/views/products/show.html.erb
0 → 100644
| class Product < ActiveRecord::Base | class Product < ActiveRecord::Base | ||
| # Returns recommended products (order by rate, and available) | # Returns recommended products (order by rate, and available) | ||
Please
register
or
sign in
to reply
|
|||
| def self.get_recommended_products(options = { limit: 8 }) | def self.get_recommended_products(options = { limit: 8 }) | ||
| limit = options[:limit] | limit = options[:limit] | ||
| return Product.select('id, name, image_medium, price, price_currency').where(availability: 'instock').order('review_rate DESC').order('review_count DESC').limit(limit) | return Product.select('id, name, image_medium, price, price_currency').where(availability: 'instock').order('review_rate DESC').order('review_count DESC').limit(limit) | ||
| end | end | ||
| # Returns newest products | # Returns newest products | ||
| def self.get_newest_products(options = { limit: 8 }) | def self.get_newest_products(options = { limit: 8 }) | ||
| limit = options[:limit] | limit = options[:limit] | ||
| return Product.select('id, name, image_medium, price, price_currency').where(availability: 'instock').order('created_at DESC').order('updated_at DESC').order('name').limit(limit) | return Product.select('id, name, image_medium, price, price_currency').where(availability: 'instock').order('created_at DESC').order('updated_at DESC').order('name').limit(limit) | ||
| end | end | ||
| end | end | ||
| \ No newline at end of file |