VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: Thomas Kampp on October 19, 2018, 15:57:08 PM

Title: Loading frontend child product results in empty page until page is reloaded
Post by: Thomas Kampp on October 19, 2018, 15:57:08 PM
Viewing a products with child products. When choosing a child product the page reloads and goes to the child product. But the page is empty! If reloading (F5) the page the correct page is shown.

Reproduction of problem - click this link, choose different size (child product). The page is now empty. Try reloading.
https://danishcaresupply.dk/shop/hj%C3%A6lpredskaber-til-havearbejdet/test-produkt-demo-med-det-hele-detaljer

I have tested:

Setup:
VM: 3.4.0 (did not work on VM 3.2 either)
Joomla: 3.8.13
PHP: 7.1.20

What can the problem be?
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: Jörgen on October 19, 2018, 16:51:00 PM
Takes forever to load.
Clicking here on 81 cm
https://danishcaresupply.dk/shop/hj%C3%A6lpredskaber-til-havearbejdet/test-produkt-demo-med-det-hele-detaljer (https://danishcaresupply.dk/shop/hj%C3%A6lpredskaber-til-havearbejdet/test-produkt-demo-med-det-hele-detaljer)
Gets me to this page. With a clickable image and a clickable link.
https://danishcaresupply.dk/pa-og-afklaedning/sko/elastiske-sn%C3%B8reb%C3%A5nd/test-produkt-demo-med-det-hele-2-detaljer (https://danishcaresupply.dk/pa-og-afklaedning/sko/elastiske-sn%C3%B8reb%C3%A5nd/test-produkt-demo-med-det-hele-2-detaljer)
Here I can click to this page:
https://danishcaresupply.dk/pa-og-afklaedning/sko/elastiske-sn%C3%B8reb%C3%A5nd/elastiske-snorebaand-brun-141215-detaljer (https://danishcaresupply.dk/pa-og-afklaedning/sko/elastiske-sn%C3%B8reb%C3%A5nd/elastiske-snorebaand-brun-141215-detaljer)

Have You tried with SEF off ?
Check also with Protostar.

Jörgen @ Kreativ Fotografi
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: GJC Web Design on October 19, 2018, 17:06:35 PM
Has to be your template .. the ajax retuurns the correct content -- try

https://danishcaresupply.dk/hj%C3%A6lpredskaber-til-havearbejdet/test-produkt-demo-med-det-hele-2-detaljer?tmpl=component&format=html&dynamic=1

but I suspect your template hasn't the correct div id to display it correctly

all that renders is the related products
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: Thomas Kampp on October 22, 2018, 14:01:19 PM
Quote from: Jörgen on October 19, 2018, 16:51:00 PM
Have You tried with SEF off ?
Check also with Protostar.

Jörgen @ Kreativ Fotografi

It does not work with SEF off either.
It does not work with protostar (or protostar and SEF off).
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: GJC Web Design on October 22, 2018, 14:04:35 PM
QuoteHas to be your template .. the ajax retuurns the correct content -- try

https://danishcaresupply.dk/hj%C3%A6lpredskaber-til-havearbejdet/test-produkt-demo-med-det-hele-2-detaljer?tmpl=component&format=html&dynamic=1

but I suspect your template hasn't the correct div id to display it correctly

all that renders is the related products
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: Thomas Kampp on October 22, 2018, 14:05:15 PM
Quote from: GJC Web Design on October 19, 2018, 17:06:35 PM
Has to be your template .. the ajax retuurns the correct content -- try

https://danishcaresupply.dk/hj%C3%A6lpredskaber-til-havearbejdet/test-produkt-demo-med-det-hele-2-detaljer?tmpl=component&format=html&dynamic=1

but I suspect your template hasn't the correct div id to display it correctly

all that renders is the related products

The child product switch does not work in the tmpl=component&format=html&dynamic=1 version either. It is the same problem as described in my first entry. Not even if the protostar template is used at the same time does it work

I think that we can rule out the template even though it is the obvious choice.
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: Milbo on October 22, 2018, 16:04:48 PM
But this link here https://danishcaresupply.dk/hj%C3%A6lpredskaber-til-havearbejdet/test-produkt-demo-med-det-hele-2-detaljer?tmpl=component&format=html&dynamic=1
was loaded in my case below 1 sec.
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: Thomas Kampp on October 22, 2018, 16:11:16 PM
Quote from: Milbo on October 22, 2018, 16:04:48 PM
But this link here https://danishcaresupply.dk/hj%C3%A6lpredskaber-til-havearbejdet/test-produkt-demo-med-det-hele-2-detaljer?tmpl=component&format=html&dynamic=1
was loaded in my case below 1 sec.

It is not about load time. The problem is you need to click Refresh (F5) before the page with the child product is viewed. Until then it only shows "Related products".

Here is what I get: http://recordit.co/YoVla1Wcbb
It should not be necessary for the user to refresh the page manually every time.

Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: GJC Web Design on October 22, 2018, 16:35:15 PM
what do u mean with
QuoteThe child product switch does not work in the tmpl=component&format=html&dynamic=1 version either.
I am looking at it!

https://danishcaresupply.dk/hj%C3%A6lpredskaber-til-havearbejdet/test-produkt-demo-med-det-hele-2-detaljer?tmpl=component&format=html&dynamic=1

what DOESN'T happen is it isn't correctly loaded into your template with only the related products showing up until u refresh
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: Thomas Kampp on October 22, 2018, 16:40:08 PM
Please see my video. As you can see I have to click the reload button in order for the child product view to load correctly. This problem is the same weather or not I use protostar template, yootheme/site template, SEF on or off, use the tmpl=component... code or not. It is the same result with all constellations with these settings.

Do you ned experience the same?
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: GJC Web Design on October 22, 2018, 16:53:28 PM
I understand exactly the problem u are getting and I get the same

But what I am saying is .. when you select the dropdown an ajax call is made for the selected child and returned where it "replaces" the content in the div .productdetails-view via the dynupdate.js scripts

the url is e.g. https://danishcaresupply.dk/hj%C3%A6lpredskaber-til-havearbejdet/test-produkt-demo-med-det-hele-2-detaljer?tmpl=component&format=html&dynamic=1 which returns the correct content.

What ISN'T happening is the correct substitution of the content in that div -
the view below is missing so much code and all the JS - why?

Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: Thomas Kampp on October 22, 2018, 17:06:16 PM
But that does not explain how it can work when the reload/refresh button is clicked?

It would be logical if it was an Virtuemart template override. But if I deactivate all the overrides the problem is still there even though it is using default Virtuemart code?
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: GJC Web Design on October 22, 2018, 17:09:27 PM
you need to debug the problem.. it is of course not a problem for other users so "something" is different on yours.

use the normal debug techniques  - start with a clean install .. add stuff until it breaks or compare the clean working with your broken
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: Thomas Kampp on October 22, 2018, 17:16:12 PM
That's just it. I feel that I have attempted changing everything and all constellations:

So I don't really know where to look any longer...
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: GJC Web Design on October 22, 2018, 18:08:40 PM
install this -> http://dev.virtuemart.net/attachments/download/1145/VirtueMart3.4.2_Joomla_3.8.12-Stable-Full_Package.zip

takes 5 mins

does it work?

if so there's your starting point

If not then assume server related
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: Thomas Kampp on November 16, 2018, 11:08:59 AM
I think I have found the problem. It turns out that if you add "related products" to a multi variant products with child products, then it stops working. So simply remove the related products and it works again it seems.
This must be a bug, but I am not sure where to report it.
Title: Re: Loading frontend child product results in empty page until page is reloaded
Post by: MarioP on February 03, 2021, 13:35:49 PM
I described my problem in here :https://forum.virtuemart.net/index.php?topic=146237.msg520083#msg520083 (https://forum.virtuemart.net/index.php?topic=146237.msg520083#msg520083) and after further investigation I can only confirm:
Quote from: Thomas Kampp on November 16, 2018, 11:08:59 AM
I think I have found the problem. It turns out that if you add "related products" to a multi variant products with child products, then it stops working.
The same happens to me. But this is definitely not a solution:
Quote from: Thomas Kampp on November 16, 2018, 11:08:59 AM
So simply remove the related products and it works again it seems.
What's worse I'm not able to reproduce the issue on the VM demo site - adding a related product to a multi variant doesn't result in a page with only that product visible after the update (which happens in my case).
--
Where I can find the code that prepares response for the Ajax call?
'tmpl=component&format=html&dynamic=1'
For me ajax gives two different responses (depending I use the related product or not).
This is the response when a related product is added  - actually the related product itselves  :-X
<div class="vm-product-media-container"><a href="/wcdmc/en/products-en/accessories/stands/stand-detail" title="Speaker stand" target="_blank">Aluminium speaker stand</a></div>
That's why we have that incomplete website after the dynamic update, but what is the reason?