theme – edit – compare widget does not load

Home Forums Loaded 7 Developer Forums General Discussion theme – edit – compare widget does not load

Tagged: , , ,

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Kiran Kiran 2 weeks, 3 days ago.

  • Author
    Posts
  • #369788
    Profile photo of Sal
    Sal
    Keymaster

    trying to make a full page compare report so we can style it and link to it.

    in a new theme page, i have the comapre wdiget, when i click on “compare” to define the products to compare, it does not load.

    Compare widget

  • #369790
    Profile photo of Kiran
    Kiran
    Moderator

    Home page is missing compare related javascript and button code.
    Here is what I did;
    add below code to theme js

     tl('/themes/basic/js/main.js', function(){
        $('.no-js').hide();
        if (!window.compare_key) {
          window.compare_key = 1;
          var params = { compare: []};
          $('.compare_button').popUp({
            box: "<div class='popup-box-wrap'><div class='around-pop-up'></div><div class='popup-box popupCompare'><div class='pop-up-close'></div><div class='popup-heading compare-head'>Compare</div><div class='pop-up-content'><div class='preloader'></div></div></div></div>",
            data: params,
            beforeSend: function () {
              params.compare.splice(0, params.compare.length);
              $('input[name="compare[]"]').each(function (i, e) {
                if (e.checked) {
                  params.compare.push(e.value);
                }
              })
            }
          })
        }
      });
    

    Add button where you want;

            <div class="compare-box-btn">
          <a class="compare_button btn" href="/catalog/compare">Compare</a>
        </div>
    

    It works.

You must be logged in to reply to this topic.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close