Zen Cart Logo
Forums / General Questions / troubleshoot help - same code on different site behaves differently

troubleshoot help - same code on different site behaves differently

Views: 1,741

Results 1 to 18 of 18
7 Jun 2015, 11:39 PM
#1
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

troubleshoot help - same code on different site behaves differently

Hi.

Not sure where to post, in case please move.

I have prepared a plugin to submit for the EU people needing the cookie consent (non-sense).
It works fine on my local test, so I decided to test it on live sites before submitting it, but for some reason out of three sites it works only on one.
Need your help to troubleshoot.
It consists of a js snip put at the end of tpl_main_page.php, two files in jscript folder (jquery and js files), and language extra_definitions file.
Could you please take a look, and see if you can spot why it shows correctly on editricebahai dot com and doesn't show on tesoreriabahai dot org

Thank you

8 Jun 2015, 12:45 PM
#2
joecooper avatar

joecooper

Zen Follower

Join Date:
Aug 2011
Posts:
122
Plugin Contributions:
0

Re: troubleshoot help - same code on different site behaves differently

Isn't the cookie notification thing only if your company is based in Europe? doesn't matter if your company is based outside of the EU. As far as I know.

Edit: Just noticed the site is Italian, so Ignore me!

8 Jun 2015, 12:50 PM
#3
joecooper avatar

joecooper

Zen Follower

Join Date:
Aug 2011
Posts:
122
Plugin Contributions:
0

Re: troubleshoot help - same code on different site behaves differently

Looks like your formatting of the JS is wrong. It's all on one line which is commented out with "//" thus ignoring all of the code.

Broken site:

Attachment 15341

Working site:

Attachment #15342

8 Jun 2015, 5:06 PM
#4
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: troubleshoot help - same code on different site behaves differently

Thanks you.

There is something happening during the upload, or on the server, as the files are the same; I need to contact the hosting.
I'll update.

9 Jun 2015, 9:19 AM
#5
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: troubleshoot help - same code on different site behaves differently

This is really strange.

I reuploaded the file (tpl_main_page.php) on tesoreriabahai, and it now works fine.
So I go on and try it on the third site, plus the live test of this latter (making it the fourth), on these last two the script looks to be on multiple lines, however it does not display.
These two are cadante dot com, and afzdesign dot com/cadante_151 (this latter being the live test of the former).

Host says might be upload issues, but I did it quite few times, and like said it seems the script is formatted as it should.

9 Jun 2015, 10:28 AM
#6
joecooper avatar

joecooper

Zen Follower

Join Date:
Aug 2011
Posts:
122
Plugin Contributions:
0

Re: troubleshoot help - same code on different site behaves differently

Load the site and press F12, then go to Console. There are a load of errors of missing files. Best to start with them.

9 Jun 2015, 12:35 PM
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: troubleshoot help - same code on different site behaves differently

joecooper:

Load the site and press F12, then go to Console. There are a load of errors of missing files. Best to start with them.

Applicable to IE. Other browsers have different tools and ways to access them.

9 Jun 2015, 1:59 PM
#8
joecooper avatar

joecooper

Zen Follower

Join Date:
Aug 2011
Posts:
122
Plugin Contributions:
0

Re: troubleshoot help - same code on different site behaves differently

mc12345678:

Applicable to IE. Other browsers have different tools and ways to access them.

Well this method will work for at least 93.5% of people, since it works on all common browsers, I think that's a chance worth taking.

Internet Explorer: Press F12 and go to "Console"
Chrome: Press F12 and go to "Console"
Firefox: Press F12 and go to "Console"
Safari for Windows Press F12 and go to "Console"
Safari for Mac: No idea.
Opera: Untested but they use the Chrome Engine

Would you like me to test with any other browsers?

9 Jun 2015, 2:34 PM
#10
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: troubleshoot help - same code on different site behaves differently

Thank you both.

mc12345678:

Applicable to IE. Other browsers have different tools and ways to access them.

joecooper:

Load the site and press F12, then go to Console. There are a load of errors of missing files. Best to start with them.

Besides what joecooper pointed out, I use ff, and firebug, and also time to time chrome and its developper tool, mainly for css.
Indeed my problem is using the other tools (console etc.) to troubleshoot these kind of issues, hence this thread.

Nevertheless I did try debugger, and besides not understanding the output I saw only 3 errors due to facebook stuff on cadante dot com (the one most interested in), and one youtube error on the afzdesign/cadante_151 (the test not updated as the former).

I tried also to remove the snip of the external js loading (which is only for the readme demo), not that I thought it was the cause, but only to not let anything untried.

So if you can think of other causes I'd greatly appreciate it.

9 Jun 2015, 8:15 PM
#11
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: troubleshoot help - same code on different site behaves differently

joecooper:

Would you like me to test with any other browsers?

Nope. None for me, thanks. :) In my experience IE seems to be the one hardest to get to thus requiring the routine use of F12, while others seem to make it a click away. Thanks for the lesson.

9 Jun 2015, 8:38 PM
#12
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: troubleshoot help - same code on different site behaves differently

joecooper:

Well this method will work for at least 93.5% of people, since it works on all common browsers, I think that's a chance worth taking.

That's a very handy tip to know actually.

When I'm using anything other than my regular browsers I often find myself navigating the menus to find this function. I've no idea why after all these years this has suddenly become 'news' to me, but it really is.

Cheers
RodG

10 Jun 2015, 1:40 PM
#13
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: troubleshoot help - same code on different site behaves differently

Can we please now concentrate on MY problem! :P

The above to be taken with humor, as seriously the f12 discussion doesn't bother me, and I always appreciate the efforts of you people.

10 Jun 2015, 8:58 PM
#14
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: troubleshoot help - same code on different site behaves differently

keneso:

Can we please now concentrate on MY problem! :P

Nah. It seems like too much work. <g>

keneso:

The above to be taken with humor, as seriously the f12 discussion doesn't bother me, and I always appreciate the efforts of you people.

OK, so I've nothing definitive for you, mainly on account of the fact that I've identified a number of differences between the various sites, the most confusing (to me) is the inconsistency of your /template/ folder naming convention(s).

For example, one of the sites has the jscript in a folder afz_zc_mulk_17, another is apparently using afz_zc_mulk_17 & afz_zc_mulk_18, and another afz_zc_05.

This is all fine if you know exactly what site should be using what, but as an outsider looking in, it makes it a little difficult to follow what is going on where.

In addition to this, and assuming the folders are correct for any given site/store, I did notice one thing that I consider would/could be the source of the problem, and that is with the name of the file for the lQuery 'Sizzle' library.

On the site(s) that work function correctly, this file is called "jscript_a_jquery.js", and the site(s) where it isn't working has this file called "jscript_a_jscript" (which is giving a file not found).

I don't have a clue how or where this library relates to the cookie script. or if it is related at all - but it seems like it has something to do with CSS selectors, and since the cookiescript would (I assume) depend on .CSS for it to work, there is a good possibility that this is the cause.... or not.

Anyway, before I delve any deeper into this I really would like to see a little bit more consistency in where the jscript/jquery files are located.

Cheers
RodG

11 Jun 2015, 11:44 AM
#15
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: troubleshoot help - same code on different site behaves differently

RodG:

Nah. It seems like too much work. <g>

LOL
Why do you think I asked you guys? :wink:

Seriously: Thank you.

The template naming is ok, I mean I'm using different templates for each site, the references too were ok, I had left the reference to an older template, but thanks to your note I cleaned it up, and now is less confusing.

The jscript_a_jquery file was there, the problem was that it was called twice as I had forgotten to remove one of the instances, which I noticed going after your notes, and suggestions.

After clean up all seems to be fine and working.
I removed it as I need to fine tune it a bit, but it works.

Thank you again, and glad you did MOST of the work for me! ;)

27 Jun 2015, 5:09 PM
#16
jvrossem avatar

jvrossem

New Zenner

Join Date:
Apr 2015
Location:
Netherlands
Posts:
24
Plugin Contributions:
0

Re: troubleshoot help - same code on different site behaves differently

I also have problems with this add. I uploaded the 2 jscript files and placed the cookie_consent_snip before the </body> tag.
Didn't changed anyhing else, but nothing is showing.
With F12 i get this error: Uncaught TypeError: $.cookiesDirective is not a function

Anyone has any idea how to get this working?

The website is: restyleparts.com

8 Sep 2015, 3:41 PM
#17
siem avatar

siem

New Zenner

Join Date:
Mar 2015
Posts:
28
Plugin Contributions:
0

Re: troubleshoot help - same code on different site behaves differently

Same here.

Uploaded both the .js files and the file from the language directory, added the snippet to the end of the tpl_main_page.php file just before the </body> tag.
I get the error about TypeError: undefined is not a function (evaluating '$.cookiesDirective') as well and would love to know how to solve this so the plugin works and shows people there are cookies on our site.

Site can be found at www4. carmo.nl (the 4 is needed, it's the test site)

8 Sep 2015, 3:55 PM
#18
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: troubleshoot help - same code on different site behaves differently

Siem:

Same here.

Uploaded both the .js files and the file from the language directory, added the snippet to the end of the tpl_main_page.php file just before the </body> tag.
I get the error about TypeError: undefined is not a function (evaluating '$.cookiesDirective') as well and would love to know how to solve this so the plugin works and shows people there are cookies on our site.

Site can be found at www4. carmo.nl (the 4 is needed, it's the test site)

Above was also begun as a discussion in the following thread: https://www.zen-cart.com/showthread.php?218203-Cookie-warning