core/app/controllers/admin/products_controller.rb
# Allow different formats of json data to suit different ajax calls
Allow different formats of json data to suit different ajax calls
Allow different formats of json data to suit different ajax calls
def json_data
      json_format = params[:json_format] or 'default'
      case json_format
      when 'basic'
        collection.map {|p| {'id' => p.id, 'name' => p.name}}.to_json
      else
        collection.to_json(:include => {:variants => {:include => {:option_values => {:include => :option_type}, :images => {}}}, :images => {}, :master => {}})
      end
    end
def json_data json_format = params [ :json_format ] or 'default' case json_format when 'basic' collection . map { | p | { 'id' => p . id , 'name' => p . name } } . to_json else collection . to_json ( :include => { :variants => { :include => { :option_values => { :include => :option_type } , :images => { } } } , :images => { } , :master => { } } ) end end
Allow different formats of json data to suit different ajax calls
Allow different formats of json data to suit different ajax calls