Understanding Zen Cart Architecture
I come from a long history of working and developing with osC, but I am trying to leave the dark side and come into the light with ZC.
I'm in the process of trying to port an osC payment module over to ZC. I found that using the basic CC payment module as a model, I was able to convert the osC payment module mostly by changing some of the differences in function calls.
Now the real challenge comes in that this particular payment module also calls for changes in other standard files, for example payment_process.php, this is where things are really starting to get different and I'm a little lost where to go.
I have however been studying the information in the wiki to come to an understanding of how things are put together in ZC. In particular I'm trying to wrap my brain around the architecture of application_top. I'm somewhat familiar with the auto-loader concept from other development work I have done and the concept of overrides.
The immediate question I have is that I need to make some additions to filenames.php and database_tables.php. Is it correct form to add to these files or should a custom version of these files be created and the additions placed there?
And if someone wants to give me a hint or two about working with changes to payment_process.php or other such files, that would be cool too.
Thanks,
stage
Re: Understanding Zen Cart Architecture
Welcome stage-
Kim here - formerly BirdBrain.
You can add additional file to the extra_datafiles and or extra_configures as needed. There are also the init_includes available for adding additional functionality without touching core code.
Re: Understanding Zen Cart Architecture
Hi Kim,
Thanks for the welcome and quick reply.
I see how that works. Are the files in those "extra" directories automatically loaded or do they need to be declared somewhere else?
I've been developing software for a long time and have to say that I am impressed with the work I see here.
Stage
Re: Understanding Zen Cart Architecture
Those directories are self-loading.
Have fun with Zen Cart.
Re: Understanding Zen Cart Architecture
Additionally, this program-flow doc may help clarify some things:
http://www.zen-cart.com/index.php?ma...roducts_id=378
Re: Understanding Zen Cart Architecture
thanks for the tip DrByte.
From what I've seen I'm very impressed by the work of the core team. You have put together a very robust and flexible system.
When I think of successful opensource systems, in particular with those written in PHP, Joomla! and osCommerce come to mind. The thing both of those systems have in common is an extensive library of contributions/extensions/modules.
Joomla! has been successful in that regard because they have a well documented API including well written tutorials on the process of developing extensions. osC has a lot of contributions because the system is prime for hack style coding. Of course that is also its greatest weakness.
Zen Cart has done a good job as an osC fork to correct many of the inherit issues with osC. I've noticed that many of the more popular osC contributions are part of the ZC core. So perhaps, add on modules are considered a lower priority. I would still say that encouraging module development is something very important to the overall success to the system. From what I've seen of other available options, commercial and opensource, there is no reason why ZC could not be the best and most popular choice out there. Is that one of the goals here?
The flowchart gives a nice high level view of what happens when a page loads. As someone new to the system, I would love to see other such flowcharts dealing with specific shopping cart functions, starting with payment, then shipping, which are the most important things. You can have the most beautiful site there is, but if you can't accept payments or set up shipping of products, how useful is it.
I've done a lot of work with osC and without exception every client that I've had, has not used paypal and required some customized effort in the payment module area. So at least from my experience, that's something that comes into play a lot.
I actually use the word "client" loosely, because I've never charged nor made any money working with opensource code. Not that I have anything against that, nor would I mind at some point earning a few supplemental dollars. It's just my primary motivation is A) I enjoy helping people and B) I enjoy the work itself.
Again I applaud the work done here and from what I have experienced from the community, you all seem like a friendly bunch.
thanks,
stage
Re: Understanding Zen Cart Architecture
I found the wiki documentation very useful, but there are a lot of differences in the file structure, it seems - from the OSC way to the new 1.3.8 way. I am trying to port a gift registry over, and I am finding the sheer amount of code on the OSC a little crazy. Zen Cart team has done very good job of cleaning up the amount of code, making it lighter and cleaner. :smile:
I bought the book, which should be arriving tomorrow. Does the book go into much detail about how construct and write modules?
I can easily go through and modify the code as outlined in that wiki document, but it seems like I would be modifying the core which I understand is a bad thing.:blink:
thanks in advance...
Re: Understanding Zen Cart Architecture
Quote:
I bought the book, which should be arriving tomorrow. Does the book go into much detail about how construct and write modules?
No, the book was written as an owner's operating guide.
Re: Understanding Zen Cart Architecture
Quote:
Originally Posted by
Kim
No, the book was written as an owner's operating guide.
I'm glad I bought it anyway - I am sure it will help on many levels!!!
Is there a resource, I would be perfectly happy to pay for it, which can point me in a good direction for writing modules. Perhaps a step by step guide to writing a module, with examples. That would be idealistic.
Re: Understanding Zen Cart Architecture
Elastic,
Did you ever find any documentation on developing modules? I'm at the same point you were in December.
Re: Understanding Zen Cart Architecture
I didn't find any further documentation per say, but I have spent a great deal of time in the ZEND development platform, looking at code, and forming a mental map of how everything fits together.
I was going to try to port code from OSC, but I found an easier approach to be just inspect the modules available for download, and look at their structure, and get a feel for the tables in ZC and their relationships. I did have some success with the mod for gift registry, wish list but I did a lot of custom php code and changed it's functionality quite a bit :-S
good luck with your search...
Re: Understanding Zen Cart Architecture
Also, I highly recommend Super Globals Plus:
http://www.zen-cart.com/index.php?ma...roducts_id=747
Not only as a debug/troubleshoot tool, but as a learning tool for stuff not documented (yet) in the Developers API and the Zen Cart Code Documentation.
HTH,
Daniel
Re: Understanding Zen Cart Architecture
Sorry for the self promotion here, but I think this article I wrote may help you a bit with ZenCart module development. Payment modules may need some extra code in specific areas, but this article about extending ZenCart without touching core files can shed some light on how ZC is light-years ahead of osC.
...and welcome to ZenCart!