Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2005
    Posts
    527
    Plugin Contributions
    7

    Default Issues with Advanced Shipper js files when accessing methods in admin since upgrading

    I'm upgrading a site to version 1.5.7 and Advanced Shipper, which on 1.5.6 was working perfectly is now broken.

    On inspecting the console log I'm seeing " Uncaught SyntaxError: Unexpected token '<' " The code line where it reports this error is in a js file located in admin/includes/javascript

    The code line it throws the error on is
    var session_language_id = <?php echo $_SESSION['languages_id']; ?>;

    I've got other instances of the same error in different files, for instance it has taken a dislike to the opening php tag around the comments at the very start of another js file.

    Given that this should be a valid code format, can anyone shed any light on whether or not any changes in the 1.5.7 admin core are causing this issue as it's got me stumped!

  2. #2
    Join Date
    Jan 2004
    Posts
    66,350
    Blog Entries
    7
    Plugin Contributions
    271

    Default Re: Issues with Advanced Shipper js files when accessing methods in admin since upgra

    .js files can't parse PHP code if loaded directly by the browser

    This has nothing to do with any specific Zen Cart version.
    The only thing about Zen Cart 1.5.7 vs prior versions is the introduction of a directory to store javascript files that could get automatically loaded. But that doesn't change the fact that .js files DO NOT parse PHP code when loaded directly from the server.

    Contact whoever is writing the shipper plugin you're using to find out why it's working differently than expected.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Nov 2005
    Posts
    527
    Plugin Contributions
    7

    Default Re: Issues with Advanced Shipper js files when accessing methods in admin since upgra

    Quote Originally Posted by DrByte View Post
    This has nothing to do with any specific Zen Cart version.
    Wrong, it had everything to do with a specific zen cart version.
    Zen Cart 1.5.7 loads the files in admin/includes/javascript automatically rather than them being loaded when called by the module. This was the cause of the issues. The files have had to be removed from the javascript directory and modifications made to suit the new file location.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,350
    Blog Entries
    7
    Plugin Contributions
    271

    Default Re: Issues with Advanced Shipper js files when accessing methods in admin since upgra

    Hmm ... You are correct: it does load all *.js files in that directory.

    That doesn't change the fact that .js files should not contain PHP code. Make them .php files if you want them treated as PHP.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Jun 2010
    Location
    Austria
    Posts
    115
    Plugin Contributions
    0

    Default Re: Issues with Advanced Shipper js files when accessing methods in admin since upgra

    I'm using the same shipping module, it was originally written by CEON, but is no longer available in the Zen Cart plugin directory. A commercial version is available, but the changelog gives no info what fixes were made so I'm unsure if buying the commercial version will help.

    The old module from 2011 does indeed use PHP in a JS file; and whilst this isn't how we would do things nowadays, a quick fix is to do what Strelitzia suggested.

    Move the following 4 JS files from /admin/includes/javascript/ to a new folder, I've used /admin/includes/advshipper_js/
    advshipper_method_config.js
    advshipper_product_selector.js
    advshipper_region_config.js
    advshipper.js
    NB: When I say "move", I mean to copy into the new folder & then delete the from old. JS files are indeed auto loaded, so just copying without deleting wont' work.

    And then update the file path in these 4 files in /admin/
    advshipper_method_config.php
    advshipper_product_selector.php
    advshipper_region_config.php
    advshipper.php

    It''s a quick way to continue using this shipping module, and CEON's code appears to hold up well.

    with kind regards, Edith

  6. #6
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    8,482
    Plugin Contributions
    9

    Default Re: Issues with Advanced Shipper js files when accessing methods in admin since upgra

    Conor Kerr (ceon) always had this module as commercial. The loss of Conor was a huge blow to the community of Zen Cart. Fortunately, his site is still up and run by the family. The site currently has version 6.06 available and often will allow an upgrade if you have a record of your original purchase.

    Might want to check with them

 

 

Similar Threads

  1. Replies: 6
    Last Post: 3 Aug 2016, 10:07 PM
  2. Replies: 5
    Last Post: 5 Feb 2015, 10:32 PM
  3. v151 Ceon Advanced Shipper - how can I limit the display of available shipping methods?
    By dysfunctional in forum Addon Shipping Modules
    Replies: 4
    Last Post: 31 Jan 2015, 04:03 AM
  4. v138a Advanced Shipper wont apply methods to categories
    By 007mcfod in forum Addon Shipping Modules
    Replies: 6
    Last Post: 13 May 2014, 11:06 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR