Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,557
    Plugin Contributions
    28

    Default Call to a member function get_template_part() on null

    Zen Cart 1.5.5d
    PHP 5.6

    The customer is reporting customers are having trouble checking out. Either time out errors or the site just spins. I cannot duplicate the issue, but I see this in the error logs. I don't find any reference in the forums. I don't suspect it's related to checkout, since I can place an order and not trigger any error. In browsing the site, I cannot trigger this error either.

    PHP Fatal error: Call to a member function get_template_part() on null in /home/SITENAME/public_html/index.php on line 29

    Line 29 is:
    $directory_array = $template->get_template_part($code_page_directory, '/^header_php/');

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Call to a member function get_template_part() on null

    If calling "$template->get_template_part()" returns an error saying "Call to a member function get_template_part() on null",
    that means that the $template variable has either not been defined yet or has been unset() (ie: removed) or set to blank (null).
    This could happen if the auto-loader infrastructure doesn't load the template components (do you have new/altered code in includes/auto_loaders or /includes/init_includes directories?) due to having custom loading scripts or failures to load the usual scripts.
    Or it could be that some code you've added is resetting the $template variable to something other than the object it is expected to be.
    .

    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
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,557
    Plugin Contributions
    28

    Default Re: Call to a member function get_template_part() on null

    Quote Originally Posted by DrByte View Post
    If calling "$template->get_template_part()" returns an error saying "Call to a member function get_template_part() on null",
    that means that the $template variable has either not been defined yet or has been unset() (ie: removed) or set to blank (null).
    This could happen if the auto-loader infrastructure doesn't load the template components (do you have new/altered code in includes/auto_loaders or /includes/init_includes directories?) due to having custom loading scripts or failures to load the usual scripts.
    Or it could be that some code you've added is resetting the $template variable to something other than the object it is expected to be.
    Thank you for the reply. It's an odd ball but I appreciate the input. Should I find any solution or specific cause, I will post back.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Call to a member function get_template_part() on null

    Might be worth checking the IP address via the logs ... in case it's initiated by something like a SE spider, or some nefarious bad actor.
    .

    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.

 

 

Similar Threads

  1. Replies: 14
    Last Post: 2 Jan 2024, 08:32 PM
  2. v156 Call to a member function format() on null
    By jeking in forum Upgrading to 1.5.x
    Replies: 15
    Last Post: 8 Feb 2019, 08:05 PM
  3. v155 PHP Fatal error: Call to a member function isMobile() on null
    By asdco in forum Basic Configuration
    Replies: 5
    Last Post: 12 Oct 2018, 11:03 AM
  4. v153 got error "Call to a member function value() on null"
    By su35 in forum General Questions
    Replies: 4
    Last Post: 25 Nov 2014, 03:02 AM
  5. Need help: Fatal Error: Call to a member function get_template_part() on a non-object
    By LarryDavidson in forum Upgrading from 1.3.x to 1.3.9
    Replies: 0
    Last Post: 21 Aug 2009, 02:49 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