app/controllers/spree/admin/purchase_orders_controller.rb
def update_individual_products
    
    @purchase_order = Spree::PurchaseOrder.find(params[:poid])  
      params[:purchase_order_item].each do |purchase_order_item|

        @poi = Spree::PurchaseOrderItem.new()
          purchase_order_item.each {|key, value| puts "#{key} is #{value}"

            if key == "purchase_order_id"
              @poi.purchase_order_id = value
            elsif key == "product_id"
              @poi.product_id = value
             elsif key == "quantity"
              @poi.quantity = value
             elsif key == "quantitytype"
              @poi.quantitytype = value
            end

             }
         @poi.save
       end
    redirect_to(:action => :display_detailed_purchase_order, :purchase_order_id=> @purchase_order.id, :notice => "Successfully updated feature.") and return
  end
#Below code is too invoke view that will ask for quantity for products to update to PO
Below code is too invoke view that will ask for quantity for products to update to PO
Below code is too invoke view that will ask for quantity for products to update to PO
def update_individual_products
    @purchase_order = Spree::PurchaseOrder.find(params[:poid])  
      params[:purchase_order_item].each do |purchase_order_item|
        @poi = Spree::PurchaseOrderItem.new()
          purchase_order_item.each {|key, value| puts "#{key} is #{value}"
            if key == "purchase_order_id"
              @poi.purchase_order_id = value
            elsif key == "product_id"
              @poi.product_id = value
             elsif key == "quantity"
              @poi.quantity = value
             elsif key == "quantitytype"
              @poi.quantitytype = value
            end
             }
         @poi.save
       end
    redirect_to(:action => :display_detailed_purchase_order, :purchase_order_id=> @purchase_order.id, :notice => "Successfully updated feature.") and return
  end
def update_individual_products @purchase_order = Spree :: PurchaseOrder . find ( params [ :poid ] ) params [ :purchase_order_item ] . each do | purchase_order_item | @poi = Spree :: PurchaseOrderItem . new ( ) purchase_order_item . each { | key , value | puts "#{key} is #{value}" if key == "purchase_order_id" @poi . purchase_order_id = value elsif key == "product_id" @poi . product_id = value elsif key == "quantity" @poi . quantity = value elsif key == "quantitytype" @poi . quantitytype = value end } @poi . save end redirect_to ( :action => :display_detailed_purchase_order , :purchase_order_id => @purchase_order . id , :notice => "Successfully updated feature." ) and return end
Below code is too invoke view that will ask for quantity for products to update to PO
Below code is too invoke view that will ask for quantity for products to update to PO