Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Jan 2009
    Location
    Baltimore, MD
    Posts
    21
    Plugin Contributions
    0

    Default Programming php in Zen Cart

    Hi Folks.

    Was hoping someone could answer a couple of programming questions for me. I see a lot of really knowledgeable people here in the forums, doing all kinds of customization and mods, and I'm hoping I can learn this as well.

    I am reading through the developers API tutorial which is helping a great deal. I also found a "Zen Cart Program Flow (v1.3 series)" chart somewhere in this forum. Here are 2 things I am kind of stuck on. Any help would greatly be appreciated.

    First question: Am I correct in assuming that each time I visit a page within my cart, ALL of the steps in the "Zen Cart Program Flow" get executed? Seems to me that some of the initial stuff like the InitSystem calls would only need to be executed once at the start of the session, but the flow chart doesn't make that clear... at least that I can see. Maybe I'm missing it. So is there a place in the program flow that represents a point when a user changes to a new page, or does this entire flow happen each time a new page is visited. The last event leads me to believe that it happens every time since it says, "causing actual output to the browser." Need some clarification on this, please.

    Second question... When a particular class is instantiated, does that class remain instantiated for the entire users session, or does each class get instantiated over and over again as the program flow progresses. Perhaps the answer to the above question will answer this question for me.

    OK, that's all for now. Thanks a bunch for taking the time to look at this post and providing some guidance. Really appreciate all the contributions in this forum.

    And just so I'm not out of line with the posting guidelines here. I am using ZenCart 1.3.8a fully upgraded and patched to the most recent level. The only add-on I'm using at the moment is the Image Handler2. Site is a basic vanilla install of ZC with some Admin customization. Site = www.bryia.com. Yes, I've been reading the FAQ's and the forum for months.

    Thanks again folks.
    Bruhn

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

    Default Re: Programming php in Zen Cart

    I think you're misunderstanding slightly how PHP works. Each page is built independently of the previous one linked only by a relatively small number of global variables such as the $_SESSION which persists for the session and $_GET & $_POST which can be used to pass data forward into the present page only.

    So most of the initialisation needs to be done for each page (though some bits are grabbed back from $_SESSION where they persist) and no, classes don't remain instantiated for the whole session and need instead to be instantiated each time a page is built.
    Kuroi Web Design and Development | Twitter

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

  3. #3
    Join Date
    Jan 2009
    Location
    Baltimore, MD
    Posts
    21
    Plugin Contributions
    0

    Default Re: Programming php in Zen Cart

    Thank You. That answers my question. And that was totally opposite of what I was thinking. Yes, I do need to brush up on my php skills. I'm reviewing the docs on php.net as well as the Zen Cart specific stuff. I done some C++, C# and Perl, but this whole concept of php and how it integrates with www pages is making me rethink some of the things I've learned.

    One last thing and then I'll continue my reading. I'm trying to identify the entry point for each page that I click. Not sure if that is going to make sense or is even the proper terminology.

    Let me rephrase... I go to my site and index.php runs. I understand that much so far. It loads all of the external php pages that are a result of the auto_loaders, etc. Now I click on another link on my page, let's say... shipping. How do I know how to trace the path of what is being run. Do I just start at the top of the Zen Cart Flow chart and substitute the shipping.php page for index.php. I know this is getting into some really deep concepts here and if it's not something that can be answered in the forums, I understand. I'll keep reading.

    Thanks for your help.
    Bruhn

  4. #4
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: Programming php in Zen Cart

    What are you trying to do as the result? Zen Cart is really pretty easy to work with and you shouldn't have to go digging around in the code to do most things ...
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  5. #5
    Join Date
    Jan 2009
    Location
    Baltimore, MD
    Posts
    21
    Plugin Contributions
    0

    Default Re: Programming php in Zen Cart

    Here is what I am trying to do. I have 4 top categories on my site. ie: Men's, Women's, Boys, Girls. Within each of these categories, I have sub-categories. Shirts, Pants, Shoes, etc. When someone is on my main page and then clicks the Womens top category, for instance, I would like for ZC to display all items within all of the Womens sub-categories until they click on one of the sub-categories.

    I found several posts out here, that seemed to apply. This one: http://www.zen-cart.com/forum/showthread.php?t=100555 seemed to be the most applicable and there were 3 different zip files within this post, all appeared to be some variation on this theme. But when I tried to apply any one of these mods, for some reason, they didn't do anything. I noticed that most times people had to do some tweaking.

    So, to answer your question, I'm trying to learn how all this stuff works and ties together so I can debug a mod when it doesn't work instead of just posting something like, "Mod doesn't work for me, please help." And hopefully someday create my own mods and add-ons.

    Bruhn

  6. #6
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: Programming php in Zen Cart

    I would like for ZC to display all items within all of the Womens sub-categories until they click on one of the sub-categories.
    This is a very unintuitive way to navigate, why would you want to confuse your customers?
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  7. #7
    Join Date
    Jan 2009
    Location
    Baltimore, MD
    Posts
    21
    Plugin Contributions
    0

    Default Re: Programming php in Zen Cart

    One other thing I just thought of that I'm trying to do.... I modified the Greeting line on the main page to say something like click here to login or create an account. Problem is.... once a user logs in, the greeting on the main page still says, click here to login. I need to figure out where to put some logic code that figures out if a user has logged in and then displays another message on that line. Don't want to say "login" if they are already logged in.

  8. #8
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: Programming php in Zen Cart

    One other thing I just thought of that I'm trying to do.... I modified the Greeting line on the main page to say something like click here to login or create an account. Problem is.... once a user logs in, the greeting on the main page still says, click here to login. I need to figure out where to put some logic code that figures out if a user has logged in and then displays another message on that line. Don't want to say "login" if they are already logged in.
    That is already built in - if it is not working then you have broken something.
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  9. #9
    Join Date
    Jan 2009
    Location
    Baltimore, MD
    Posts
    21
    Plugin Contributions
    0

    Default Re: Programming php in Zen Cart

    Quote Originally Posted by Kim View Post
    That is already built in - if it is not working then you have broken something.
    So if I broke something, that goes right back to your first question as to what I am trying to accomplish. I am trying to learn how to program ZC.

    I am not an expert at this as you appear to be. I am learning. I might make some poor decision on how to set things up or how to implement site navigation, but at this point, I am learning.

    Hope it's OK to be a novice and want to learn in this forum.

  10. #10
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: Programming php in Zen Cart

    May I suggest that you play with a stock installation for a while and learn the built in capabilities before attempting to change the default behavior? Zen Cart is designed to be very easy to manipulate without having to do any programming.
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v154 Zen Cart v1.5.4 and PHP 5.4
    By kwright in forum Upgrading to 1.5.x
    Replies: 5
    Last Post: 31 Aug 2015, 07:56 PM
  2. Having problem with order.php and checkout_process.php with OLD Zen Cart v1.2.3
    By wolfbane01 in forum Managing Customers and Orders
    Replies: 0
    Last Post: 28 Jul 2010, 01:56 AM
  3. Zen Cart 1.3.5 on php 5.2.11
    By Domain in forum Installing on a Linux/Unix Server
    Replies: 8
    Last Post: 13 Apr 2010, 10:18 PM
  4. Zen-Cart php 5.2 support
    By sonic in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 16 Oct 2008, 06:59 PM

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