Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 Technical
 ASP (Windows server) versions
 Issue in displayprodimagenum function
Author « Topic »  

jaapg@promanent.com
Advanced Member

Netherlands
376 Posts

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
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;}


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.
/* <![CDATA[ */<%
print "imlist=["
for index=0 to numallgiantimages-1
print IIfVs(index>0,",")&"'"&encodeimage(allgiantimages(0,index))&"'"
next
print "];" %>

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

42761 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 Software
Click Here to sign up for our newsletter
Click Here for the latest updater

jaapg@promanent.com
Advanced Member

Netherlands
376 Posts

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
10409 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

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

42761 Posts

Posted - 08/16/2023 :  03:21:01  
Hi Jaap
I tried here with a copy of the page source and get the same error when clicking on the next image. But you have two references to the js/ectcart.js file and if I remove the second one then I don't get an error. Could you possibly try that and see if it helps?

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

jaapg@promanent.com
Advanced Member

Netherlands
376 Posts

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

42761 Posts

Posted - 08/16/2023 :  04:41:13  
Hi Jaap
quote:
we use GT4, but also include the googleanalytics_script.asp.
I don't actually know what that script is so I would assume it's a custom one? And probably using the old Google Analytics setup? If that's the case it's likely you don't need it.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

jaapg@promanent.com
Advanced Member

Netherlands
376 Posts

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
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000