Commit caf24a7a by vulehuan

update code: product on homepage

parent a7c40115
...@@ -35,23 +35,19 @@ class Product ...@@ -35,23 +35,19 @@ class Product
# Returns recommended products (order by rate, and available) # Returns recommended products (order by rate, and available)
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') return Product.where(availability: 'instock')
# .where(availability: 'instock') .where(status: true)
# .where(status: true) .desc(:review_rate).desc(:review_count)
# .order('review_rate DESC').order('review_count DESC') .limit(limit)
# .limit(limit)
return Array.new
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') return Product.where(availability: 'instock')
# .where(availability: 'instock') .where(status: true)
# .where(status: true) .desc(:created_at).desc(:updated_at).asc(:name)
# .order('created_at DESC').order('updated_at DESC').order('name') .limit(limit)
# .limit(limit)
return Array.new
end end
# Returns products in a category # Returns products in a category
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment