• Closed by: Marek
  • Closed on: 16.11.18, 18:26
  • Reason: Closed
  • Comment: Glad to help!

Ticket #12791 - Content of the cart does not appear on mouse over

After adding product to the cart, contents of the cart does
not appear on mouse over, it’s appear only after updating page
or entering another page.
The same issue like in the Ticket #12451
but cart is working on mouse over in previouse Venedor http://venedor.promokit.eu/en/

Comments

Marek 28 Aug 2018, 13:04

Hi, Ruslan.
Sorry for the delay, I was on vacation these days.
As for your question, yes, there is such “problem” but it comes not from the theme. Prestashop doesn’t use ajax to generate cart “on fly”, that’s why the page require to be reloaded to show updated cart.

Ruslan Polukarov 28 Aug 2018, 15:30

Hi, Marek!

And what about previous theme on PS 1.6 it’s perfectly working http://venedor.promokit.eu/en/ in that theme used Ajax for refreshing?

Marek 28 Aug 2018, 16:57

Yes, right, that is the difference between 1.6 and .17

Ruslan Polukarov 09 Sep 2018, 17:37

Hi, Marek!

I changed a bit some files and now Cart is working on mouse over. You can check it om my domain.

1. I removed {if isset($pkts.mini_cart)} {if file_exists($pkts.mini_cart)} from ps_shoppingcart.tpl after that product miniature appeared in the mini-cart
2. Changed data-link-action=”delete-from-cart” in mini-product.tpl it was remove-from-cart, and now it does not redirect on checkout page when we click remove product button in mini-cart.
3. I am not really good with js but took your code, change selectors and put it in ps_shoppingcart.js, please have a look and correct in a better way…

Marek 10 Sep 2018, 11:29

Hi, Ruslan.
First of all I would like to thank you for your suggestions.
1 and 2 has been implemented into the theme
3. What exactly did you change in .js file and what was a goal?

Ruslan Polukarov 10 Sep 2018, 12:59

Hi Marek. I’ve noticed that after click on Add-to-Cart button disappeared “event”- listener from dd_el element (<div class=”header dd_el relative h-100”>),
so I just put event listener to anorher element #desktop_cart (<div id=”desktop_cart” class=”h-100”>) and revrite selectors in js. Maybe you can
correct your script that event does not dissapear after “add to cart” click.

I addet to ps_shoppingcart.js
this function:

$(document).ready(function () {

  var timer;
  var dd_cont = '.dd_container';
  $('#desktop_cart').hover(
  // $('#desktop_cart').on("mouseover",
          function() { 
           clearTimeout(timer);
       $(dd_cont).not($('.header.dd_el.relative').parent().not(".dd_el_hover")).stop().slideUp(200, 'easeOutExpo');
         $('.header.dd_el.relative').children(dd_cont).stop().slideDown(500, 'easeOutExpo');
         // $(this).addClass('dd_el_hover');
        $('.header.dd_el.relative').addClass('dd_el_hover');
      },
      function() {
          var $self = $('.header.dd_el.relative').children(dd_cont);
          timer = setTimeout(function() {
          $self.stop().slideUp(200, 'easeOutExpo');
          }, 500);
          $('.header.dd_el.relative').removeClass('dd_el_hover');
     
     }
  );

});

Marek 10 Sep 2018, 13:02

Yes, your solution is correct. I’ll implement it too