Page 1 of 4 123 ... LastLast
Results 1 to 10 of 39
  1. #1
    Join Date
    Oct 2009
    Posts
    93
    Plugin Contributions
    0

    Default Can't include catalog functions in seperate PHP file.

    I have created a folder on root and with some php files in it.
    Whenever i include the following line at the top of the php file:

    require('../includes/functions/functions_general.php');

    I get error that "failed to open this file.

    Please note that path is correct, i have checked it 10 times.

    What is the reason for that?

    How can I resolve this issue?

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,835
    Plugin Contributions
    9

    Default Re: Can't include catalog functions in seperate PHP file.

    Please explain in detail what it is you are trying to accomplish
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Oct 2009
    Posts
    93
    Plugin Contributions
    0

    Default Re: Can't include catalog functions in seperate PHP file.

    I just want to call zen functions like storing data in database using $db->Execute plus some other functions for reading categories and sub categories name using zen cart functions.

    I have created a new php file on root directory where zen cart is installed but I'm not able to access these functions in the php files created at root.

    For example www.mydomain.com/myphpfile.php

    In this file i want to call zen cart functions for accessing database and some other functions for categories manipulation.

    The zen cart functions are at:

    www.mydomain.com/includes/functions/....

    Please let me know if this is clear now.

  4. #4
    Join Date
    Jan 2004
    Posts
    64,748
    Blog Entries
    6
    Plugin Contributions
    74

    Default Re: Can't include catalog functions in seperate PHP file.

    So, you're writing scripts to run completely outside of Zen Cart but you want to hijack Zen Cart code to do something from outside Zen Cart?
    .

    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
    Oct 2009
    Posts
    93
    Plugin Contributions
    0

    Default Re: Can't include catalog functions in seperate PHP file.

    No, in fact I'm using Ajax using Jquery. The files are placed at different folders because when I place my php files inside includes/functions directory i'm not able to access it through AJAX call therefore i placed my files in root directory.

    When I place files in root directory i no longer can access zen cart functions.

    I'm not doing any hijacking or cracking stuff just adding AJAX calls to my zencart.

  6. #6
    Join Date
    Jan 2004
    Posts
    64,748
    Blog Entries
    6
    Plugin Contributions
    74

    Default Re: Can't include catalog functions in seperate PHP file.

    Your script needs to load /includes/application_top.php ... which will in turn load everything else needed for Zen Cart operation, including the functions files.
    .

    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.

  7. #7
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,835
    Plugin Contributions
    9

    Default Re: Can't include catalog functions in seperate PHP file.

    Can try this
    Code:
    require('includes/application_top.php');
    Zen-Venom Get Bitten

  8. #8
    Join Date
    Oct 2009
    Posts
    93
    Plugin Contributions
    0

    Default Re: Can't include catalog functions in seperate PHP file.

    When I include require('../includes/application_top.php') at the top of the file, the function used inside my php file 'json_encode() stops working.

    Can you tell me the reason for this?

  9. #9
    Join Date
    Jan 2004
    Posts
    64,748
    Blog Entries
    6
    Plugin Contributions
    74

    Default Re: Can't include catalog functions in seperate PHP file.

    Why are you adding "../"?
    .

    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.

  10. #10
    Join Date
    Oct 2009
    Posts
    93
    Plugin Contributions
    0

    Default Re: Can't include catalog functions in seperate PHP file.

    IF i don't add that I get the following error:


    [28-May-2011 08:03:36] PHP Warning: require(/includes/application_top.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/serverpath/myinfo.php
    on line 3
    [28-May-2011 08:03:36] PHP Fatal error: require() [<a href='function.require'>function.require</a>]: Failed opening required '/includes/application_top.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/serverpath/myinfo.php on line 3

 

 
Page 1 of 4 123 ... LastLast

Similar Threads

  1. separate php file inside catalog can't connect to database
    By caborela in forum General Questions
    Replies: 1
    Last Post: 3 Mar 2012, 09:11 AM
  2. 'include' php file
    By vandiermen in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 6 Sep 2011, 05:41 PM
  3. Include a custom php file in mainpage.php
    By BeautyHealth.com.cy in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 8 Nov 2010, 02:45 PM
  4. How can I include a php file in the header section?
    By Andy_R in forum General Questions
    Replies: 3
    Last Post: 11 Sep 2009, 05:50 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