Skip to Content
Menu
This question has been flagged

Hello,


I've created a popup which is showing up when someone is trying do add something to cart from main shop page using small cart button under the picture of a product. What I'm trying to achieve is that when someone click "Yes" in this popup it will add chosen product to cart or just close it down when "No".

My code:

<input name="product_id" t-att-value="product.product_variant_ids[0].id" type="hidden"/>
    <t t-if="len(product.product_variant_ids) == 1">
      <a class="btn btn-default btn-xs a-submit"><span class="fa fa-shopping-cart"/></a>
      <section style="z-index:10000;" >
              <div>
                <button type="button" id="popup_cart_button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#age_restriction_view">ADD</button>
               
                <!--<a id="popup_cart_button" href="#test" class="fa fa-shopping-cart">Click Me</a>-->
              </div>
              <div class="modal fade" id="age_restriction_view" style="z-index:999;" data-backdrop="false">
                <div class="modal-dialog modal-content" style="margin-top:10%;border:solid 5px black; min-height:200px;max-width:1000px; z-index:999;">
                  <div class="modal-body" id="pop_html">
                  <a href="#" class="o_popup_btn_close o_not_editable o_default_snippet_text pull-right" data-dismiss="modal" style="font-size:30px">×</a>
                    <h2 style="text-align:center; font-size 24px; font-weight:bold" class="o_default_snippet_text">Are you 18 or older?</h2>
                    <br/>
                   
                  <br/>
                  <div class="text-center">
                    <!--<a  href="#" style="background-color: red" class="o_popup_btn_close btn btn-primary btn-lg" data-dismiss="modal">Tak</a>-->
                    <!--<t t-esc="product"/>-->
                    <a class="btn btn-default btn-xs a-submit" data-dismiss="modal" style="font-size:30px">Yes<span class="fa fa-shopping-cart"/></a>
                    <a href="#" class="o_popup_btn_close btn btn-primary btn-xs" data-dismiss="modal" style="font-size:30px;">No</a>
                  </div>
                   
                  </div>
                </div>
              </div>
            </section>
    </t>

I'm using a class from standard cart button and it works, but adds only first product to cart no matter which product I'm trying to add


How to solve this?

Avatar
Discard
Related Posts Replies Views Activity
1
Oct 23
2116
1
Mar 20
12304
7
Dec 24
24082
1
Jun 17
822
1
Jul 23
1164