Results 1 to 10 of 12

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    102
    Plugin Contributions
    0

    Default Re: Javascript issue

    hi dave west, thanks for your help so far. I have managed to get the script to run on just the products pages. although i don't think i did it right. As other javascript on that page (Ajax image swapper) is being hidden as well.

    for some reason the code would only work if it was in \modules\pages\product_info\jscript_main.php

    AND tpl_product_info_display.php

    i put the CSS code in jscript_main.php as i didn't know where to put it in the stylesheet and it worked apart from the problem above. do you think there is a way around this or are the two scripts going to fight with each other? thanks again :)

  2. #2
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: Javascript issue

    Quote Originally Posted by TheBuz View Post
    hi dave west, thanks for your help so far. I have managed to get the script to run on just the products pages. although i don't think i did it right. As other javascript on that page (Ajax image swapper) is being hidden as well.

    for some reason the code would only work if it was in \modules\pages\product_info\jscript_main.php

    AND tpl_product_info_display.php

    i put the CSS code in jscript_main.php as i didn't know where to put it in the stylesheet and it worked apart from the problem above. do you think there is a way around this or are the two scripts going to fight with each other? thanks again :)
    Placing the style into jscript_main.php would work if you placed it outside of the javascript tags with the style tags in place, just not a clean way of doing it with Zen.

    I use this type of code for my floating login box.

    The key to the code is that it needs to run during page load and it uses the ID tags to make the switch. If your Ajax image swapper is using the same ID as the loading image... then it to would hide. On loading image change id="loading" to something like id="myloading" as will, change the script to
    Code:
    <script type="text/javascript">
      document.getElementById("myloading").className = "loading-visible";
      window.onload=function(){
        document.getElementById("myloading").className = "loading-invisible";
      }
    </script>
    Dave
    Always forward thinking... Lost my mind!

  3. #3
    Join Date
    Apr 2009
    Posts
    102
    Plugin Contributions
    0

    Default Re: Javascript issue

    hi dave,

    i have tried renaming the class ID as i thought that might be the issue i tried renaming it to loadings, myloading and hideit, but the same issue keeps happing . if you have any other ideas i'd be happy to hear them, and i do appericated the advise you have give so far

  4. #4
    Join Date
    Apr 2009
    Posts
    102
    Plugin Contributions
    0

    Default Re: Javascript issue

    sorry for double posting but i came back to late to edit.

    update: i did some tests and it seems any other JS on the products info page stops the Ajax image loader from working

  5. #5
    Join Date
    Apr 2009
    Posts
    102
    Plugin Contributions
    0

    Default Re: Javascript issue

    Hi guys, i have discovered that this JS is interfering with the AJAX image loader it stops the images from being shown anyone know why this might be? thanks for all the help so far :)

  6. #6
    Join Date
    Apr 2008
    Location
    Bellingham, WA
    Posts
    10
    Plugin Contributions
    0

    Default Re: Javascript issue

    Ok...after reading until my eyes are popping out from all the posts over the years on JS implementation, I'm going to stick out my neck and see if there's an answer I'm just not understanding.
    Creating the ??.js and placing it in the /includes/modules/pages/{pagename}/ all makes sense, except that the "Gallery" pages I've created do not have a specific name. They are "General Document" pages, but I don't want all of the general doument pages to have the script run.

    I'm running the current version of 1.3.8a on a PHP version 5.2.6. I run all of my altered scripts in /custom/ folders. "I" am the hosting company.
    Everything works well, but I get an error on the pages that do not need the script, which are all pages in the site but the few "Gallery" pages because I was frustrated and 'dumped' the script in the default template.
    Here's a site page example: http://www.peninsulaoutfitters.com/s...roducts_id=186

    Everything works, but the IE error icon in the lower left of the browser drives me crazy.
    Is there a way to put that little snippet of JavaScript (found in "view source" of any of the 3 gallery pages head) into a file as suggested through all the forum posts? I don't have a page name, and it's only the 3 pages in which the script is needed.

    Now, to make things more difficult, I have another JS running the images at the top of each page. With each page reload or page change the image changes. I have some pages I want to load different sets of images. Right now, I settled for running the same images on all pages because the JS set up was too confusing. I'm sure it makes great sense to those who have accomplished or wrote the instructions. But, in both of these cases I think you'll agree it's not that simple.

    Thoughts? Help?
    Thanks. BTW - you all do great work.

  7. #7
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: Javascript issue

    Quote Originally Posted by TheBuz View Post
    Hi guys, i have discovered that this JS is interfering with the AJAX image loader it stops the images from being shown anyone know why this might be? thanks for all the help so far :)
    I had to look up a AJAX image loader, not sure which one your using so kind of shooting in the dark here. I think your problem is that both scripts are using the onload event. Having the event called by both scripts cancels out the other so nothing loads.

    You would have to integrate another variable within the Ajax script or find one that uses a smart onload event.


    @LTCreations

    running scripts in the header tags work like this..
    placing script in, includes\templates\my_template\jscript\jscript_somthing.js will run the script site wide, every page.

    placing script in, includes\modules\pages\product_info\jscript_main.php runs the script just for that page.

    As for the image on top of your site, you could code it with a cross of php and script to load your catigory image giving it a differnt image depending on catigory.
    Dave
    Always forward thinking... Lost my mind!

  8. #8
    Join Date
    Sep 2009
    Posts
    4
    Plugin Contributions
    0

    Default Re: Javascript issue

    Thank you!
    It's been while to reply since the client didn't want to spend the $ on my efforts until last week. Now that I've had to revisit the issue it took me nearly 2 weeks to find this thread again.

    I've implemented the scripts as directed by you and in this thread http://www.zen-cart.com/forum/showthread.php?t=90993 in order to combine the information to create http://www.peninsulaoutfitters.com/s...index&cPath=75 . Of course the specific images won't mean anything to you since you won't know what images are intended for each category and id. Trust me...after lots of I've incorporated, tested, and have used the jscript_main.php in the folder you suggested, as well as the jscript_index.php which contains similar js for the categories to show images different for each of 4 categories - as per client. The combination of the 2 threads was mandatory, and once implemented 'correctly', they work great. Thanks again.

 

 

Similar Threads

  1. Javascript slideshow issue
    By timhersh in forum General Questions
    Replies: 6
    Last Post: 2 Nov 2012, 09:26 PM
  2. SSL ISSUE IE8 javascript
    By hawlisjawt in forum General Questions
    Replies: 11
    Last Post: 6 Jan 2011, 08:28 PM
  3. Javascript issue in IE. FF is working ok
    By TheBuz in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 4 Dec 2009, 05:32 PM
  4. Payflow pro Module- Uk Debit Card issue with issue dates
    By Calljj in forum Addon Payment Modules
    Replies: 27
    Last Post: 1 Oct 2007, 08:59 PM
  5. Categories Javascript issue
    By fbords in forum Addon Sideboxes
    Replies: 1
    Last Post: 5 Sep 2007, 07:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg