Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 39
  1. #21
    Join Date
    Oct 2009
    Posts
    93
    Plugin Contributions
    0

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

    So you mean I should change the folder location?

  2. #22
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

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

    Changing the folder location won't help as the only place from which your AJAX handler can invoke application_top will still be your admin's root folder.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

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

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

    I have resolved the issue by writing my own functions instead of using zen cart functions.

    But here, i'm encountering a very serious problem with $_SESSION variables. In my root directory I set a session variable but when i try to access it on EZ pages i don't get that value rather I get 0.

    How to resolve this issue?

  4. #24
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

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

    Unless you're prepared to write your own version of Zen Cart's page and session initialisation routines, you resolve it by putting your ajax handler in the admin root folder and calling application_top to do the heavy lifting for you.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  5. #25
    Join Date
    Oct 2009
    Posts
    93
    Plugin Contributions
    0

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

    I don't understand what you mean by all this. Please explain in a different or easy way.

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

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

    Any script that you want to run from outside Zen Cart but access resources from within Zen Cart ... requires that you load application_top.
    If you don't do that, then you need to re-invent all the core logic that Zen Cart runs on ... essentially recreating your own framework.

    So ... if you want to access Zen Cart resources, use application_top.
    .

    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. #27
    Join Date
    Oct 2009
    Posts
    93
    Plugin Contributions
    0

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

    Thanks for your suggestion, but i include application_top.php everything stops working in my application.

  8. #28
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

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

    The two most likely reasons for this are:
    • that you are invoking application_top from a script that's not being run from your admin root folder, which will cause problems with the paths of some of the files to be loaded and/or
    • that you are loading separately files that application_top has already loaded causing duplicate function errors.


    Quote Originally Posted by fawad123 View Post
    Please explain in a different or easy way.
    Sadly, this simply isn't that easy. It can get very technical, especially when ajaxing into the admin, as you have to also allow for the session expiring on you. PM me an email address and I'll send you some working code to look at.
    Last edited by kuroi; 1 Jun 2011 at 08:30 AM. Reason: added offer
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  9. #29
    Join Date
    Oct 2009
    Posts
    93
    Plugin Contributions
    0

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

    Your first point is correct. I'm loading application_top.php from different folder than admin but again the problem is if i copy that file to admin folder and include application_top.php and then give it AJAX call , it does not work. Otherwise it works fine.

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

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

    And, as I said before, using PHP error_reporting can help you see what PHP errors your scripts are encountering.
    .

    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.

 

 
Page 3 of 4 FirstFirst 1234 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