jaapg@promanent.com
Advanced Member
Netherlands
376 Posts Pre-sales questions only (More Details...)
|
Posted - 08/12/2023 : 09:20:12
On the proddetail.asp page there is a Javascript function that is used when showing the giantimages.
For some reason this was not working anymore after updating to the latest version. I found two issues.
The line [code]if(document.getElementById("extraimcnt"+theitem))document.getElementById("extraimcnt"+theitem).innerHTML=pIX[theitem]+1; [/code] seems to be missing {}. So should be: [code]if(document.getElementById("extraimcnt"+theitem)){document.getElementById("extraimcnt"+theitem).innerHTML=pIX[theitem]+1;} [/code]
But more important the assignment var imlist=pIM[theitem]; seems to be having problems. theitem=999 and pIM[999} is declared and filled a few lines above but still when I log imlist and pIM[999] in the console of my browser both are reported as being undefined. Strangely enough also a pIM[0] is being declared earlier on, so maybe this is causing a conflict.
As a quick fix I moved some code inside the displayprodimagenum function. [code]/* <![CDATA[ */<% print "imlist=[" for index=0 to numallgiantimages-1 print IIfVs(index>0,",")&"'"&encodeimage(allgiantimages(0,index))&"'" next print "];" %> [/code] This works, but I am puzzled why this code was now not working while the almost the same code in older versions was working.
What has happened and why is pIM[0] and pIM[999] declared?
Greetings, Jaap
jaapg@promanent.com Promanent b.v. www.promanent.com | www.vaarwinkel.nl
|
Vince
Administrator
43016 Posts |
Posted - 08/13/2023 : 02:47:34
Hi Jaap quote: The line if(document.getElementById("extraimcnt"+theitem))document.getElementById("extraimcnt"+theitem).innerHTML=pIX[theitem]+1; seems to be missing {}. So should be: if(document.getElementById("extraimcnt"+theitem)){document.getElementById("extraimcnt"+theitem).innerHTML=pIX[theitem]+1;}
That line is actually ok as it's just one line after the "if" statement. For instance this is fine... if(x) y=true; else z=true; ...where this would be an error without the curly braces... if(x){ y=true; w=true; }else z=true; It's likely that an error before this statement is causing the problem so could you let me know the URL of the page? Vince Click Here for Shopping Cart SoftwareClick Here to sign up for our newsletterClick Here for the latest updater
|
jaapg@promanent.com
Advanced Member
Netherlands
376 Posts Pre-sales questions only (More Details...)
|
Posted - 08/13/2023 : 03:18:36
Hi Vince,
Thanks for the swift reply. I checked with an online Javascript parser and this suggested adding the {}. But the problem is with imlist being undefined as pIM[999} seems also to be undefined. I have reverted the changes I made so incfunctions.asp and incprodetail.asp are original again. I only added some console.log calls in the displayprodimagenum and updateprodimage2 functions so you can easily see what the values are when these functions are called.
A sample URL of our work in progress can be seen on: https://www.vaarwinkel.nl/_sandbox/proddetail.asp?prod=leidraadkleinvaarbewijs
Please note we have 2 issues on this page. One when calling the giantimages (displayprodimagenum ) and one when clicking through the images on the main view (updateprodimage2).
When you check console you will see imlist and pIM being undefined.
Hope you can discover what is wrong here?
Greetings,
Jaap
jaapg@promanent.com Promanent b.v. www.promanent.com | www.vaarwinkel.nl
|
dbdave
ECT Moderator
USA
10518 Posts |
Posted - 08/13/2023 : 11:25:00
Hi Jaap, I believe you have an issue with some non-ect javascript on the page. Once this error throws (early on page load) it stops all other javascript from running. <script type="text/javascript"> window.onresize = displayWindowSize; window.onload = displayWindowSize;
function displayWindowSize() { myWidth = window.innerWidth; myHeight = window.innerHeight; // your size calculation code here document.getElementById("afmetingen").innerHTML = myWidth + "x" + myHeight; }; </script> The line in red there is "null" - Basically there is no html element with the ID of afmetingen, found. So you can fix that by checking to see if that element exists before attempting to define the element. Thanks, David
|
jaapg@promanent.com
Advanced Member
Netherlands
376 Posts Pre-sales questions only (More Details...)
|
Posted - 08/14/2023 : 00:51:12
Hi David,
Thanks for checking. This was not the cause. I have moved this bit down after the declaration of the id=afmetingen (just to be sure) and all works here. But the issue with the images remains.
https://www.vaarwinkel.nl/_sandbox/proddetail.asp?prod=leidraadkleinvaarbewijs
Greetings,
Jaap
jaapg@promanent.com Promanent b.v. www.promanent.com | www.vaarwinkel.nl
|
Vince
Administrator
43016 Posts |
Posted - 08/16/2023 : 03:21:01
|
jaapg@promanent.com
Advanced Member
Netherlands
376 Posts Pre-sales questions only (More Details...)
|
Posted - 08/16/2023 : 04:07:42
Hi Vince,
You are correct. We included ectcart.js in our template, but this is also included in incectstyle.asp
I removed our own include line and now all is working correct.
Many thanks.
One question: we use GT4, but also include the googleanalytics_script.asp. Is this stille required?
Greetings, Jaap
jaapg@promanent.com Promanent b.v. www.promanent.com | www.vaarwinkel.nl
|
Vince
Administrator
43016 Posts |
Posted - 08/16/2023 : 04:41:13
|
jaapg@promanent.com
Advanced Member
Netherlands
376 Posts Pre-sales questions only (More Details...)
|
Posted - 08/16/2023 : 04:50:51
Hi Vince,
This is the old script that calls ga.js
So I guess we do not need this anymore.
Greetings,
Jaap
jaapg@promanent.com Promanent b.v. www.promanent.com | www.vaarwinkel.nl
|
|
|