ecwid Installation Guide

Important

The "AUTO DETECT PRICES" option must be selected in Step 1 (selected by default).

Step 3. Pasting the Installation String into your website.

Under 'Step 2. - Installation String', on the Dynamic Converter Settings page in the text box, you will see the Installation String for yoursite. That Installation String now needs to be added to your web site pages.

  1. Paste the installation string into your template just before or as close to the close body tag.
  2. Paste this extra line of code just below the installation string.
        <script>
    
           function reloadDC(from)
            {
                dc_convert_now();
                var spans = document.querySelector('span#convert+span#convert');
                if (spans !== null) spans.remove();
            }
    
            function dcUpdateRecentlyViewed() {
                document.querySelectorAll('a > .recently-viewed__price').forEach(function (elm) {  elm.parentNode.after(elm); });
                reloadDC('Recently-viewed');
            }
    
            var dcObserver = new MutationObserver(function (mutations) {
                mutations.forEach(function (mutation) {
                    reloadDC('price change detection');
                });
            });
    
            function dcSetObserver(page) {
                var nodeToWatch = null;
    
                if (page === 'CART') {
                    nodeToWatch = document.querySelector('div.ec-cart__sidebar-inner');
                }
    
                if (page === 'PRODUCT') {
                    nodeToWatch = document.querySelector('span.details-product-price__value');
                    setTimeout(dcUpdateRecentlyViewed,500);
                }
    
                if (nodeToWatch !== null)
                {
                    dcObserver.observe(nodeToWatch, {characterData: true, subtree: true});
                }
            }
    
            Ecwid.OnPageLoaded.add(function (page) {
                reloadDC('loaded');
                dcSetObserver(page.type);
            });
    
            Ecwid.OnPageLoad.add(function (page) {
                dcObserver.disconnect();
            });
    
    </script>
            
  3. And 'Save'

Installation Complete.

 

;