Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def update_cart_item
- @product = Product.find params[ :product_id ]
- product_color = ProductColor.find params[ :product_color ][ :product_id ]
- product_size = ProductSize.find params[ :product_size ][ :product_id ]
- product_quantity = ProductQuantity.find params[ :product_quantity ][ :product_id ]
- product_price = ProductPrice.first( :conditions => {
- :product_color_id => product_color.id,
- :product_quantity_id => product_quantity.id,
- :product_size_id => product_size.id
- } )
- product_customs = []
- product_size.product_customs.all.each do |product_custom|
- value = params[ 'product_custom_' + product_custom.id.to_s ]
- product_customs << ProductCustomItem.find( value ) if value
- end
- page_count = params[ :page_count ]
- if page_count && ( page_count == "" )
- page_count = 2 # nil - changed to 2 on 05/05/2009
- else
- page_count = page_count.to_i if page_count
- end
- source_was_valid = cart_item.source_diagnostics.nil?
- @old_proof = cart_item.proof
- cart_item.change_product product_price, product_customs, page_count
- @valid_source = cart_item.source_diagnostics.nil?
- @proof = cart_item.proof
- set_od_for_lists
- @cart_item = cart_item
- render :update do |page|
- unless @cart_item.valid_product?
- page.replace_html 'artworks',
- :text => "The database is not yet adjusted for this product"
- # render :text => "The database is not yet adjusted for this product"
- else
- @cover_part = @cart_item.cover
- @content_part = @cart_item.content
- @product_node = ProductNode.find @cart_item.product_node_id
- page.replace_html 'content_upload_list', :partial => 'source_list',
- :locals => { :product_part => @content_part, :output_hash => @output_hash }
- end
- old_proof_status = ! @old_proof.nil?
- new_proof_status = ! @proof.nil?
- if old_proof_status != new_proof_status
- @can_make_proof = @cart_item.acceptable_by_odt?
- page.replace_html 'proof_status', :partial => 'proof'
- end
- @project = Project.find(@cart_item.project_id) rescue nil
- if @valid_source != source_was_valid
- page.replace_html 'final_buttons', :partial => 'final_buttons'
- end
- end
Add Comment
Please, Sign In to add comment