Guest User

Untitled

a guest
Jun 24th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. def update_cart_item
  2. @product = Product.find params[ :product_id ]
  3. product_color = ProductColor.find params[ :product_color ][ :product_id ]
  4. product_size = ProductSize.find params[ :product_size ][ :product_id ]
  5. product_quantity = ProductQuantity.find params[ :product_quantity ][ :product_id ]
  6. product_price = ProductPrice.first( :conditions => {
  7. :product_color_id => product_color.id,
  8. :product_quantity_id => product_quantity.id,
  9. :product_size_id => product_size.id
  10. } )
  11. product_customs = []
  12. product_size.product_customs.all.each do |product_custom|
  13. value = params[ 'product_custom_' + product_custom.id.to_s ]
  14. product_customs << ProductCustomItem.find( value ) if value
  15. end
  16. page_count = params[ :page_count ]
  17. if page_count && ( page_count == "" )
  18. page_count = 2 # nil - changed to 2 on 05/05/2009
  19. else
  20. page_count = page_count.to_i if page_count
  21. end
  22.  
  23. source_was_valid = cart_item.source_diagnostics.nil?
  24. @old_proof = cart_item.proof
  25. cart_item.change_product product_price, product_customs, page_count
  26. @valid_source = cart_item.source_diagnostics.nil?
  27. @proof = cart_item.proof
  28.  
  29. set_od_for_lists
  30.  
  31. @cart_item = cart_item
  32. render :update do |page|
  33. unless @cart_item.valid_product?
  34. page.replace_html 'artworks',
  35. :text => "The database is not yet adjusted for this product"
  36. # render :text => "The database is not yet adjusted for this product"
  37. else
  38. @cover_part = @cart_item.cover
  39. @content_part = @cart_item.content
  40. @product_node = ProductNode.find @cart_item.product_node_id
  41. page.replace_html 'content_upload_list', :partial => 'source_list',
  42. :locals => { :product_part => @content_part, :output_hash => @output_hash }
  43. end
  44. old_proof_status = ! @old_proof.nil?
  45. new_proof_status = ! @proof.nil?
  46. if old_proof_status != new_proof_status
  47. @can_make_proof = @cart_item.acceptable_by_odt?
  48. page.replace_html 'proof_status', :partial => 'proof'
  49. end
  50. @project = Project.find(@cart_item.project_id) rescue nil
  51. if @valid_source != source_was_valid
  52. page.replace_html 'final_buttons', :partial => 'final_buttons'
  53. end
  54. end
Add Comment
Please, Sign In to add comment