|
|
@@ -35,14 +35,10 @@ class ProductsController < ApplicationController
|
|
|
|
|
|
def list_prices_variants
|
|
|
children = Product.where("parent_id = ? and status != 0 ", params[:product_id]).pluck(:id)
|
|
|
- @variants = AvailableProduct.where("pointsale_id = ? and product_id IN (?)", params[:pointsale_id], children).joins(:product).select(:name, :id, :product_id, :attributes_json, :sku)
|
|
|
+ @variants = AvailableProduct.where("pointsale_id = ? and product_id IN (?)", params[:pointsale_id], children).includes(:product)
|
|
|
@variants_json = Array.new
|
|
|
@variants.each do |v|
|
|
|
- @variants_json.push
|
|
|
- {
|
|
|
- name: v.sku + " " + v.name + " <br><small>" + Product.find(v.product_id).display_attributes + "</small>",
|
|
|
- price: Product.find(v.product_id).get_price_sale(params[:pointsale_id]), available_product_id: v.id
|
|
|
- }
|
|
|
+ @variants_json.push(name: v.product.sku + " " + v.product.name + " <br><small>" + v.product.display_attributes + "</small>", price: v.product.get_price_sale(params[:pointsale_id]), available_product_id: v.id)
|
|
|
end
|
|
|
render json: @variants_json.to_json
|
|
|
end
|