Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Jan 2015
    Location
    Pensacola Florida
    Posts
    75
    Plugin Contributions
    0

    Default 1.56-.6B Change Sitemap XML Result File 404 error

    I am not sure if this is actually a 1.5.6b bug or a Sitemap XML v 3.9.3 16.04.2017 bug but it appeared with the lastest changes in 1.5.6b.

    The problem is the Sitemap popup results page gives a 404 error when sitemap is updated. Before this change I was not seeing any problems with sitemap with the exception of some 7.2 errors when it installed but they do not seem to repeat once installation is complete.

    I have tracked the error as far as I can here are the results.

    A change was made to the /includes/templates/responsive_template/common/main_template_vars.php In addition to the changes to the page information at the top this code was added to the page.

    $display_as_mobile = ($detect->isMobile() && !$detect->isTablet() || $_SESSION['layoutType'] == 'mobile' or $detect->isTablet() || $_SESSION['layoutType'] == 'tablet');

    With this code loaded the sitemap results popup give a 404 error and the debug error below.

    [15-Jun-2019 18:41:52 America/Chicago] PHP Fatal error: Uncaught Error: Call to a member function isMobile() on null in /var/www/humphreystowbars.com/public_html/includes/templates/responsive_tow/common/main_template_vars.php:32
    Stack trace:
    #0 /var/www/humphreystowbars.com/public_html/index.php(49): require()
    #1 {main}
    thrown in /var/www/humphreystowbars.com/public_html/includes/templates/responsive_tow/common/main_template_vars.php on line 32

    [15-Jun-2019 18:41:52 America/Chicago] Request URI: /index.php?main_page=sitemapxml&rebuild=yes&ping=yes, IP address: 98.190.184.37
    --> PHP Fatal error: Uncaught Error: Call to a member function isMobile() on null in /var/www/humphreystowbars.com/public_html/includes/templates/responsive_tow/common/main_template_vars.php:32
    Stack trace:
    #0 /var/www/humphreystowbars.com/public_html/index.php(49): require()
    #1 {main}
    thrown in /var/www/humphreystowbars.com/public_html/includes/templates/responsive_tow/common/main_template_vars.php on line 32.

    This particular site (www.humphreystowbars.com) is very basic the only additional module it has is RCS which is seems to be functioning fine. The site appears to work normally on desktop and mobile but I am concerned about running with that code missing, I am sure it was put in for a reason.

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,683
    Plugin Contributions
    123

    Default Re: 1.56-.6B Change Sitemap XML Result File 404 error

    I am running the latest Sitemap XML (3.9.5) and this seems to work fine. Please update your copy of Sitemap XML.
    https://www.zen-cart.com/downloads.php?do=file&id=367
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Jan 2015
    Location
    Pensacola Florida
    Posts
    75
    Plugin Contributions
    0

    Default Re: 1.56-.6B Change Sitemap XML Result File 404 error

    Sorry I look at the readme for the version when I made the report and it shows version 3.9.3, I just checked the sitemap installed on the site and it shows the version 3.9.5 so it is the same.

    It has been running fine under 1.5.6a and did not start having this problem until I upgraded to 1.5.6b.

    I updated to a new server with Ubuntu 18.04 and PHP 7.2 in Jan. and have upgraded all modules I use on the different sites to the latest I could find.

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,683
    Plugin Contributions
    123

    Default Re: 1.56-.6B Change Sitemap XML Result File 404 error

    Copy
    includes/templates/responsive_classic/common/main_template_vars.php
    to
    includes/templates/responsive_tow/common/main_template_vars.php

    Not sure why you made the change you did.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: 1.56-.6B Change Sitemap XML Result File 404 error

    Note that the issue being reported is that at the point of trying to determine the type of connection made from the "browser" to the server that $detect is not defined. In responsive_classic this is done in includes/templates/responsive_classic/common/html_header.php. That file should be the one that is copied/merged with includes/templates/responsive_tow/common/html_header.php. If that file doesn't exist, then it should be copied to responsive_tow from responsive_classic.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Jan 2015
    Location
    Pensacola Florida
    Posts
    75
    Plugin Contributions
    0

    Default Re: 1.56-.6B Change Sitemap XML Result File 404 error

    I am sorry I guess I am not explaining the problem properly. Let me try this.

    I upgraded an existing working 1.5.6a site to 1.5.6b

    This was a simple site tou upgrade since few changes were made and the only extra modules were sitemap and RCS. I removed the few 7.2 temp changes I had made to core files so everything was the original 1.5.6a files.

    I uploaded 1.5.6b files and because the responsive folders do not overwrite I compared all files in the folders and made a set of responsive_tow 1.5.6b files for this siteand uploaded

    The 2 files in question, when I compaired the /includes/templates/common/html_header.php for 1.5.6a to 1.5.6b I found line 8 copyright, line 11 Version and line 136 jquery version changed. I made thos changes

    When I compaired the /include/templates/common/main_template_vars.php when compared line 13 copyright, line 15 version change and line 32 becomes $display_as_mobile = ($detect->isMobile() && !$detect->isTablet() || $_SESSION['layoutType'] == 'mobile' or $detect->isTablet() || $_SESSION['layoutType'] == 'tablet'); which is what causes the problem with Sitemap.

    When I remove this line which is pointed to in the error log sitemap then functions again correctly.

    I hope this makes things clearer.

  7. #7
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: 1.56-.6B Change Sitemap XML Result File 404 error

    To some extent, though the question becomes what else is included with this store that has either: not used the header_php.php file from includes/templates/responsive_classic/common, or redefined/unset the variable $detect between when that file was called by index.php and the line where $detect was used in the main_template_vars.php file?

    There are a few notifiers that could be observed and the variable possibly unset, or if index.php has been manipulated something could be modified there. It just doesn't seem like there is anything in the sitemap files that would bypass loading of html_header.php and go directly to main_template_vars.php at least in the review done so far.

    Might I suggest performing a file search in tools->developers tool kit of the catalog for $detect and see what other files appear?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: 1.56-.6B Change Sitemap XML Result File 404 error

    I think I see where the issue is.

    The includes/templates/template_default/sitemapxml/header_php.php file overrides the loading of the common version of that file and therefore doesn't result in defining the variable $detect. Other "class" variables are defined outside of this load sequence so the file can be bypassed without loss. Not entirely sure what the full benefit is of using this modified html_header.php file other than declaring that the content is text/html and the absence of loading css and javascript.

    Problem could be fixed in the plugin by adding the similar $detect assignment and associated variables to includes/templates/template_default/sitemapxml/html_header.php or better yet specifically to the template override version of this of: includes/templates/responsive_tow/sitemapxml/html_header.php. This last file being a copy of the template_default version for sitemapxml.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Jan 2015
    Location
    Pensacola Florida
    Posts
    75
    Plugin Contributions
    0

    Default Re: 1.56-.6B Change Sitemap XML Result File 404 error

    I thank you much for the assistance but I am sorry most of what you have said went right over my head, I am a hardware guy I started in 1974 with tubes and transistors ending maintaining Medical computers and computerized equipment like CT Scanners and Ultrasounds and before the internet was anything like it is today. I learned what software I know in the school of hard knocks trying to maintain hardware and later for my sites on the Internet.

    Anyway to answer your request "Might I suggest performing a file search in tools->developers tool kit of the catalog for $detect and see what other files appear?" This resulted in the following pages

    /var/www/humphreystowbars.com/public_html/includes/classes/Mobile_Detect.php
    /var/www/humphreystowbars.com/public_html/includes/functions/extra_functions/zca_responsive_functions.php
    /var/www/humphreystowbars.com/public_html/includes/languages/english/html_includes/responsive_classic/define_main_page.php
    /var/www/humphreystowbars.com/public_html/includes/languages/english/html_includes/responsive_tow/define_main_page.php
    /var/www/humphreystowbars.com/public_html/includes/modules/pages/download/header_php.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_classic/common/html_header.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_classic/common/main_template_vars.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_classic/common/tpl_header.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_classic/common/tpl_main_page.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_classic/jscript/jscript_responsive_framework.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_classic/templates/tpl_account_default.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_classic/templates/tpl_shopping_cart_default.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_tow/common/html_header.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_tow/common/tpl_header.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_tow/common/tpl_main_page.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_tow/jscript/jscript_responsive_framework.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_tow/templates/tpl_account_default.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_tow/templates/tpl_products_next_previous.php
    /var/www/humphreystowbars.com/public_html/includes/templates/responsive_tow/templates/tpl_shopping_cart_default.php

    You had mentioned other places calling it like index page and of course mine is modified based on the information that was in the first release of zen cart with the responsive template so it is very possible it was something in my mods causing the problem and I needed to prove it was not so to check I put up a plain 1.5.6b (5/27 release) on one of my test sites. I changed nothing but loaded demo data and the sitemap 3.9.5 module.

    When I run the sitemap on this vanilla site I am seeing the same error so now I am totally at a loss again. The same error is also in the logs. So at least at this point it does not seem to be something in my code.

  10. #10
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: 1.56-.6B Change Sitemap XML Result File 404 error

    No problem, I ended up chasing down the issue after posting the things I thought could lead to the problem... (One of those talk it through with oneself situations).

    There are a few different ways to address this that I see.

    One is to "fix" the includes/templates/responsive_classic/common/main_template_vars.php file so that it ensures to load and assign the $detect variable the same way that it is done in includes/templates/responsive_classic/common/html_header.php because each of these files can be overridden and the mobile detect code really is only loaded when a template is considered responsive and can support the mobile detection actions.

    Another fix was to update the provided html_header.php file that is incorporated to the system when installing sitemapxml, copy that file to the applicable responsive template and yet another fix is to add a main_template_vars.php file to either of those two solutions so that no matter what the common/main_template_vars.php file would not be loaded.

    Each of those solutions has its "problems". I haven't investigated what main_template_vars would be needed to ensure continued operation to just display the sitemapxml page, but I'm thinking that probably is the best/easiest way to go.

    Anyways, if I may suggest, copy the file header_php.php
    from: includes/templates/template_default/sitemapxml
    to: includes/templates/responsive_tow/sitemapxml/header_php.php

    Then modify the file and towards the end add:
    Code:
    // ZCAdditions.com, ZCA Responsive Template Default (BOF-addition 1 of 2)
    if (!class_exists('Mobile_Detect')) {
      include_once(DIR_WS_CLASSES . 'Mobile_Detect.php');
    }
      $detect = new Mobile_Detect;
      $isMobile = $detect->isMobile();
      $isTablet = $detect->isTablet();
      if (!isset($layoutType)) $layoutType = ($isMobile ? ($isTablet ? 'tablet' : 'mobile') : 'default');
    // ZCAdditions.com, ZCA Responsive Template Default (BOF-addition 1 of 2)
    So that the file would look something like:
    Code:
    <?php
    /**
     * Common Template
     *
     * outputs the html header. i,e, everything that comes before the \</head\> tag <br />
     *
     * @package templateSystem
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: html_header.php 6948 2007-09-02 23:30:49Z drbyte $
     */
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?>>
    <head>
    <title><?php echo HEADING_TITLE; ?></title>
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" />
    <meta http-equiv="imagetoolbar" content="no" />
    <?php if (defined('FAVICON')) { ?>
    <link rel="icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
    <link rel="shortcut icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
    <?php } //endif FAVICON ?>
    
    <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ); ?>" />
    
    </head>
    <?php 
    
    // ZCAdditions.com, ZCA Responsive Template Default (BOF-addition 1 of 2)
    if (!class_exists('Mobile_Detect')) {
      include_once(DIR_WS_CLASSES . 'Mobile_Detect.php');
    }
      $detect = new Mobile_Detect;
      $isMobile = $detect->isMobile();
      $isTablet = $detect->isTablet();
      if (!isset($layoutType)) $layoutType = ($isMobile ? ($isTablet ? 'tablet' : 'mobile') : 'default');
    // ZCAdditions.com, ZCA Responsive Template Default (BOF-addition 1 of 2)
    
    // NOTE: Blank line following is intended: ?>

    Another thing that could be done is to incorporate the above ZCAdditions.com code into the includes/templates/responsive_tow/common/main_template_vars.php file just before the attempted use of $detect.

    That's just two ways considered to resolve the issue.

    Thank you though for the search of $detect. Like said above, because I listed all the "ifs" and then actually dug into the core ZC code and what is typically included in sitemapxml, I was able to identify the above as potential solutions.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Google sitemap 404 error
    By covone in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 2 Dec 2010, 05:58 PM
  2. XML Sitemap: Use Existing File
    By Yolanda in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 6 May 2010, 11:57 PM
  3. Sitemap XML - Google Error
    By kevinmc3 in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 10 Jun 2009, 04:00 PM
  4. sitemap.xml error
    By abhishek77 in forum General Questions
    Replies: 3
    Last Post: 23 Oct 2008, 07:17 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