custom/plugins/GGiantsAppExtensions/src/Resources/views/storefront/base.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/base.html.twig' %}
    
    {% block base_header %}
    
        {% if app.request.headers.get('User-Agent') == "IchWillEisApp" %}
            <style>.header-main{display: none !important;}
                .offcanvas-cart,.cart-offcanvas, .modal-backdrop{ display: none;}
            </style>
            <script>
                document.addEventListener("DOMContentLoaded", () => {
                    window.PluginManager.initializePlugins();
                    let el = document.querySelector('[data-add-to-cart]');
    
                    let bcb = document.querySelector('.begin-checkout-btn');
                    if(bcb){
                       bcb.addEventListener('click', function(event){
                           event.preventDefault();
                            if(window.kmpJsBridge){
                                window.kmpJsBridge.callNative("iweShowCheckout",JSON.stringify({success:true}));
                            }
                        });
                    }
    
                    const plugin = window.PluginManager.getPluginInstanceFromElement(el, 'AddToCart');
                    plugin.$emitter.subscribe('beforeFormSubmit', function(){
                        if(window.kmpJsBridge){
                            window.kmpJsBridge.callNative("iweStartAddingArticle",JSON.stringify({success:true}));
                        }
                        else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.toggleMessageHandler) {
                            window.webkit.messageHandlers.iweStartAddingArticle.postMessage(true);
                        }
                        else if(typeof Android !== 'undefined'){
                            Android.startAddingArticle(true);
                        }
                        else{
                            console.log("Add article");
                        }
                    });
                    plugin.$emitter.subscribe('openOffCanvasCart', function(){
                        if(window.kmpJsBridge){
                            window.kmpJsBridge.callNative("iweAddedArticle",JSON.stringify({success:true}));
                        }
                        else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.toggleMessageHandler) {
                            window.webkit.messageHandlers.iweAddedArticle.postMessage(true);
                        }
                        else if(typeof Android !== 'undefined'){
                            Android.addedArticle(true);
                        }
                        else{
                            console.log("Added article");
                        }
                    });
                });
    
    
            </script>
        {% endif %}
        {{ parent() }}
    {% endblock %}
    
    {% block base_footer %}
        {% if app.request.headers.get('User-Agent') == "IchWillEisApp" %}
            <style>.footer-main{display: none !important;}</style>
        {% endif %}
        {{ parent() }}
    {% endblock %}