• Priority: 0
  • Status: Closed
  • Theme: Alysum
  • Assigned To: Fred
  • Private: No
  • Open Date: 07.06.23, 10:05
  • Opened by: Piero
  • Closed by: Fred
  • Closed on: 26.06.23, 23:29
  • Reason: Closed
  • Comment: Glad to help!

Ticket #24753 - Cart not updating first purchase and problems with smarty cache

Hi Fred, I swear I’m at the end and I won’t bother you anymore hahaha.
I noticed 2 things, the first is that if you go to the site and put an item on the cart the cart icon in the menu doesn’t update (1) unless I refresh the page or go to another one. In any case, from the second purchase it updates regularly. This thing also happens to me on the second site for which I bought the Alysum theme and which is now under construction at this link https://epica.bevirosso.it/ Then… with smarty cache active, the product slides on the homepage (which I don’t have now) and those in the “in the same category” section of the product page break if I refresh the page. I am sending you 2 attachments of the before (when I land on the page) and the after (if I refresh that page).
Thanks again I’m at the end
Piero

Attachments:

Before.PNG (599 KiB)
After.PNG (590.1 KiB)

Comments

Piero 07 Jun 2023, 11:47

Hi Fred,

the cart issue seems to be a code problem. The visibility of the quantity beside the cart icon is tied to the productsnum data attribute in the field itself, and while the function does change the number, it doesn’t change the related attribute.
I noticed while fixing it that for some strange reason jQuery’s data function does not work:
element.data(’productsnum’) so I had to use element.attr(’data-productsnum’), possibily this may help you.

In order to achieve the functionality I just forced it from the button, it’s ugly but for now it will do: please let me know when you issue a fix so I can update and get rid of my hack.

Here is how I changed:
/home/sensi/public_html/themes/alysum/assets/js/alysum.js

const addToCartButtonListeners = () => {
document.querySelectorAll(selectors.buttonAddToCart).forEach((item) => {
        item.addEventListener('click', ({ target }) => {
                        // fasterjoomla
                        console.log('add2cart');
                        const cartEl = $('.cart-select .pk-cart .current-item span.cart-products-count');
                        cartEl.attr('data-productsnum', '14');
                        // end change
                        target.classList.add(classes.inProgress);
                }
        );
    });
};

Riccardo (Piero’s programmer)

Piero 07 Jun 2023, 14:11

Hi Fred, just a quick update, the cart not updating on the first purchase issue I fixed above for the category page, is also showing the same error in the products page, but I couldn’t find an entry point to hack into it, please include it in your tests
Thank you
Riccardo

Fred 07 Jun 2023, 21:26

Hi, Piero.
Try easier solution:

[data-productsnum='0'] {
    opacity: 1
}
Piero 07 Jun 2023, 21:32

Hello Fred, I would like to point out your answer to Riccardo the technician (he is the one who answers with the more technical questions ehehh). As for the smarty cache speech can you help me?
Piero

Piero 07 Jun 2023, 22:02

Riccardo tells me that with that system I would see 0…but how is it possible that for 2 sites with which I bought Alysum I have the same problem and it can’t be solved

Fred 07 Jun 2023, 22:19

Yes, I see now where is the problem in JS - open the file

/themes/alysum/modules/ps_shoppingcart/ps_shoppingcart.js

find the line

$('.cart-products-count').text(prestashop.cart.products_count)

replace with

$('.cart-products-count').text(prestashop.cart.products_count).attr('data-productsnum', prestashop.cart.products_count);
Piero 07 Jun 2023, 22:20

Ok i update Riccardo! Thanks Fred

Fred 07 Jun 2023, 22:21

You are welcome!

Piero 08 Jun 2023, 12:39

Hi Fred, I applied the fix, removed mine, and apparently everything is working fine! Thank you
Riccardo

Fred 08 Jun 2023, 12:39

You are welcome!

Piero 08 Jun 2023, 14:50

Hi Fred, let me know about that issue of products cracking after page refresh. I sent 2 photos attached…basically with smarty cache active I land on a product page where at the bottom I have the slide of the products “in the same category” that have the right aesthetics (as in the thumbnail)…if I update that page the product sheet breaks… and this thing also happens in the homepage slide (where at the moment for this reason I have removed the products slide)… if you see the photos attached to the first post of this topic you will see the difference

Fred 08 Jun 2023, 21:46

Hi, Piero.
1. What widget are you using there?
2. What I have to do to see the problem?

Piero 08 Jun 2023, 22:03

Hi Fred,
1) the product page is virgin compliant…meaning i use the native template and not creative elements…but if you look at the “in the same category” products slide the products have the thumbnail design. That’s all.
2) go to any product page…scroll down and see the products slide…you notice the design used by me in the thumbnail because there is the price written in pink and gray background…everything seems ok …but at that point you refresh the page and go look at that slide…and you realize that the title, description, price, etc. it’s split…this happens ONLY when the “smarty cache” is active…otherwise this thing doesn’t happen.
I hope I was clear

Fred 11 Jun 2023, 15:33

2. Ok, button position is fixed now
I see the issue with cache, trying to find out what’s wrong

Piero 11 Jun 2023, 15:50

Thanks Fred, anyway I think I’m at the end … then I’ll start with the other site hahaha … I already saw there that there is the same problem I had here … the one on the checkout page where I was asked for the password mandatory while making the purchase as a guest … anyway from time to time

Fred 11 Jun 2023, 15:55

Password issue is fixed in the latest theme version.
And as I can see in the file it’s also fixed

/home/sensi/public_html/themes/alysum/templates/_partials/form-fields.tpl 
Piero 11 Jun 2023, 16:04

yes yes Fred…maybe I wasn’t precise…I bought another Alysum license on another site www.epicamusic.net (now on wordepress) which I have had for 11 years. Now I switched to prestashop there too with the Alysum theme and I’m building it and you can see the progress here epica.bevirosso.it. Well here I have the same password problem and if you go to the checkout page as a guest you can already see it. Anyway then I will open a ticket with that site, inserting n. license and access data, and I will remind you of the problem so you can easily solve it based on this from SensiShop

Fred 11 Jun 2023, 16:08

Just copy that fixed file to another your shop

Piero 11 Jun 2023, 16:10

Ok then I’ll pass that chat to Riccardo (the technician) and hopefully it will resolve

Piero 11 Jun 2023, 16:13

I have had that site for many years and it works well…now I’m opening this one and if it works within a year I would like to open yet another one…I have this project…and I feel great with your theme and so if I will buy a third license…only one thing doesn’t fully satisfy me and I’m telling you this ONLY for information…the mobile menu…in my opinion you can do much better and make it more modern. Take it as feedback…there is no controversy in my words

Fred 11 Jun 2023, 16:15

I understand, no worries, and thank you for your opinion.
We are working all the time to make the them better

Piero 11 Jun 2023, 16:17

thank you Fred for putting up with me ahahahah and for solving all my problems…indeed…now I’ll look for where to review you to give you 5 stars

Fred 11 Jun 2023, 16:18

Thank you in advance! You could rate it here http://themeforest.net/downloads

Piero 11 Jun 2023, 16:25

I am so satisfied with this theme that I bought licenses for 2 sites. Super fast and super flexible for every need. It allows you to make professional sites and is perfect for ecommerce. Also I would like to give a special mention to the customer service and to Fred (my customer service contact) who helped me solve the problems I encountered and the improvements I wanted. The 5 stars are well deserved. If you want to make a professional, fast, serious and beautiful site, choose this theme … recommended

Fred 11 Jun 2023, 16:27

Thank you! Really nice review

Piero 11 Jun 2023, 16:32

Meriata Fred…especially the mention to you who helped me so much

Piero 11 Jun 2023, 16:32

Meritata Is deserved

Fred 11 Jun 2023, 16:32

Yes, I see :)

Piero 23 Jun 2023, 10:28

Hi Fred, I’m left with only this problem (which also doesn’t allow me to put products on the homepage because it happens there too)… 2) go to any product page…scroll down and see the products slide…you notice the design used by me in the thumbnail because there is the price written in pink and gray background…everything seems ok …but at that point you refresh the page and go look at that slide…and you realize that the title, description, price, etc. it’s split…this happens ONLY when the “smarty cache” is active…otherwise this thing doesn’t happen.
I hope I was clear (see attchament first post)

Fred 24 Jun 2023, 16:40

Hi, Piero.
As I can see now, Smarty cache is enabled and the issue is not appear, at least here https://www.sensishop.net/giochi-erotici/55-set-regalo-coppia-romantico-8713221431783.html

Piero 24 Jun 2023, 17:38

Eh Fred since I saw that it was not resolved now you can’t see it anymore because just as you wrote to me I was working to remove the creative elements thumbnail in the categories, as this problem ONLY manifested itself when I used these. Now that I’ve removed them and given a similar style with the css codes, the problem has disappeared…I don’t know what to say because now I don’t even want to put the creative elements thumbnails back…however, without those the category pages are pure faster!

Piero 24 Jun 2023, 18:24

Now I’m noticing a strange thing … I no longer have the problem that in the individual product pages I get that problem if I refresh the page … but in some pages I see the same problem even just by accessing the page … like here ( see the related products slide)

https://www.sensishop.net/anelli-fallici/25-eclipse-anello-fallico-vibrante--8713221467805.html

Fred 25 Jun 2023, 13:00

It works fine for me all the time, see the screenshot https://take.ms/qtQoE

Piero 26 Jun 2023, 20:02

prefect Fred maybe it was a cache problem. I also see correctly by removing the creative elements thumbnails the problem no longer exists. Tickets can be requested