0

私は e コマース サイトを開発しています..そして今、ある時点で立ち往生しました..フォームを送信すると、最初のクリックで送信されず、機能させるために 2 回目のクリックを行う必要があります..アンカータグを使用してデータを送信しました bcoz シックボックス (iframe) 内のデータを表示したい...

  View file
  <%= form_for :order, :url => populate_orders_url ,:html => { :class => "data# product.id}"},:method => "post",:remote => true do |f| %>

 // data 
//submit button


    <a href="/cart?KeepThis=true&TB_iframe=true&height=380&width=1000&modal=false"  onclick="$('.data<%= product.id %>').submit().trigger.reload();"   class="thickbox cart_button"></a>

 orders controller.rb
 def populate
  @order = current_order(true)

  params[:products].each do |product_id,variant_id|
    quantity = params[:quantity].to_i if !params[:quantity].is_a?(Hash)
    quantity = params[:quantity][variant_id].to_i if params[:quantity].is_a?(Hash)
    @order.add_variant(Variant.find(variant_id), quantity, ad_hoc_option_value_ids, product_customizations) if quantity > 0
  end if params[:products]

  params[:variants].each do |variant_id, quantity|
    quantity = quantity.to_i
    @order.add_variant(Variant.find(variant_id), quantity, ad_hoc_option_value_ids, product_customizations) if quantity > 0
  end if params[:variants]

  fire_event('spree.cart.add')
  fire_event('spree.order.contents_changed')

  redirect_to cart 

end

私はfirebugで見たことがあり、populateメソッドが処理されていますが、データをカートに送信しておらず、カートが空であることを示しています..そしてカートは処理中です...

4

1 に答える 1

0

ajaxリクエストを送信してい:remote => trueます。フォームからオプションを削除して確認してください。

于 2012-08-10T09:36:48.600 に答える