farshadf's avatar

show modal in a blade file container in another in bagisto ecommerce

i am using bagisto eCommerce system and now i want to add a pop up like a modal or a sweet alert to the page where user add the product to the shopping cart . so here is the code : add-to-cart.blade.php

 <button
                    type="submit"
                    {{ ! $product->isSaleable() ? 'disabled' : '' }}
                    class="theme-btn {{ $addToCartBtnClass ?? '' }}">

                    @if (! (isset($showCartIcon) && !$showCartIcon))
                        <i class="material-icons text-down-3">shopping_cart</i>
                    @endif

                        {{ __('shop::app.products.add-to-cart') }}
                </button>

and this file is contained in view.blade.php :

  <div class="product-actions">
   @include ('shop::products.add-to-cart', [
   'form' => false,
   'product' => $product,
   'showCompare' => true,
   'showCartIcon' => false,
   ])

and some how i feel this script is related to this part but i am not sure :

  <script type="text/x-template" id="product-view-template">
        <form
            method="POST"
            id="product-form"
            @click="onSubmit($event)"
            action="{{ route('cart.add', $product->product_id) }}">

            <input type="hidden" name="is_buy_now" v-model="is_buy_now">

            <slot v-if="slot"></slot>

            <div v-else>
                <div class="spritespin"></div>
            </div>

        </form>
    </script>
0 likes
2 replies
bobbybouwmann's avatar

It sounds to me that you have an existing application/script and you have no clue what to do with it. I highly recommend you to understand the basic first before you start editing stuff in here.

Anyway, the popup/sweet alert is JS related. You can trigger it from Laravel as well but you probably need a package for it. This might fit your needs: https://realrashid.github.io/sweet-alert/

1 like
devansh0207's avatar

Hi @farshadf,

If you check the file packages/Webkul/Velocity/src/Resources/assets/js/UI/components/modal.vue. Component is present for reference.

You can take a copy of that component and make it dynamic.

Then, use like this, <modal-component is-open="true"></modal-component>

Please or to participate in this conversation.