Auto refresh data view in layout

0
Am designing a shopping website. I have a text box in layout to display the number of items in my cart. The count shows correctly in page content but when I place the same in layout using a snippet, its not getting refreshed automatically when i add/delete items in my cart. It works fine when I refresh the page manually. Any suggestions ?
asked
2 answers
2

Everything placed in a layout only changes if the layout is changed. If same layout is used on different pages, when navigating only the content area is loaded. This behavior is as designed to reduce the amount of data transfer.

 

Thus solution, don't add it to the layout, but the content area. If it should be placed on all pages;

- add a placeholder in your layout

- add snippet on the pages using this layout in the placeholder space.

- done

answered
1

You can add a place holder to a layout like this:

When you use that layout for a page, you can add a widget (snippet in this case) at the placeholder space:

answered