[Typo3-dev] Zencart Extension
Gene Rodrigues
mediamechanix at verizon.net
Fri Apr 9 04:45:45 CEST 2004
> This is, perhaps, the most interesting point...
>
> >Sixth, I like the clever way they allow new contributions to be absorbed
> >into the core by enumerating the contents of selected directories. We do
> >this a lot in Mambo, so the approach was easy to relate to. I hope to see
> >them improve and refine this approach until it's possible to add new
classes
> >to expand the core on-the-fly.
> >
> >
> Do you have links on the discussion about this either at mambo or at
> zen-cart?
>
This capability was labeled as 'Zencart Magic' and I was referred to several
directories in the directory structure where this could be done. I need to
experiment and will get back to you on this because I never tried it out
with anything else other than template files (see below).
I found out about this when I mentioned that I wanted to modify the htmlarea
form elements to support multiple editors (RTE, htmlarea2, htmarea3, KTML,
etc.) in the Wish List forum (what we do in Mambo). I got private mail about
this from Wilt or Steve and it was deleted later because you can only have
about 4 private mail messages at ZC.
I was told to create a new file with the same name as another core file and
place it in one of these special directories. The core is supposed to use a
conditional statement (if exists) to test for the existance of files (of the
same name) stored in those directories and use the alternate variations of
the files should they exist. Their template engine works on the same
principle. That's how you can copy selected template files from their
common/ directory and place them in a new common/ directory under a
different stylesheet and allow those modified files to override the core's
common template files.
For example, if I needed to modify my header file to remove the top graphic
for embedding as a module, this should be possible. Never tried it, but it
should work because of the way the code is setup.
> Finally, I think that Gary pointed out one of the most important
> differences (off list). That being: osCommerce does not use views
> through index.php, but actually calls any of about 50 different files to
> generate pages. Zen-Cart on the other hand solely uses index.php making
> it much easier to pass variables between it and a CMS, or other
application.
>
You are referring to the use of the main_page variable to pass the current
file which is really a BTS trait. I mapped these to Mambo tasks in the
frontend (for example, index.php?option=com_zencart&task=products_new). I
used a switch, mainly to redirect to alternate files for login, account,
etc. for certain tasks.
The redirection could have also been performed from application_top.php, I
think.
I extended the normal Mambo account form to support the additional fields
required for Zencart user registration. I left the normal Mambo user
registration fields on a default tab and the additional fields (Zencart
details) on a second tab. This allowed casual users with no interest in
registering fill in basic login information and for true customers to use
the second tab for the required personal details. Redirection to the new set
of files was handled from the main switch.
It should be possible to do the same for osCommerce when BTS is installed
for the front end because main_page or something like it is also used.
Currently my backend, loads index.php into an iFrame but one goal of the
Zencart project is to allow XHTML/CSS compliancy. For this reason, I am
assuming that something similar to BTS is going to be implemented for the
backend later. It makes sense for them to handle this need in the same way
from both the frontend and backend for consistency reasons. I say this
because they have been changing similar backend and frontend code in a
consistent manner.
-------------------
The ZC backend should load fine in TYPO3 using your existing osCommerce
iFrame extension or you can create your own separate file that embeds the
index.php into the iFrame. It will run fine this way.
You should be able to get the frontend to load with minor changes to files
for initial testing purposes and then go from there. Your sessions and
authentication are going to be different from ours, so you need to handle
this on your own. Modules need to be handled on your own also. Your queries,
database connection, and wrapper are going to be different from ours.
The paths in configure.php are going to need some modification to make it
possible to use Zencart as an extension and some minor changes to the
output_html.php in includes/functions/ will be necessary for related
reasons. The conditional statements to test for the existence of the
configure.php files in includes/local/ and a few others need changing for
similar reasons. A few other require and require_once statements will need
to be changed in application_top.php.
includes/functions/general.php is a good place to add additional functions
if you need them because it is included in all files.
You need to track down the file containing the header graphic (forgot which
one) and strip off the top table row to remove the graphic header. As
mentioned before, you can probably do this from another common/directory
added to the template used for your implementation (mambo template was based
on classic, in my case) You can turn off the right and left columns from
admin (and later remove those booleans from the admin form (and the
configuration table) if you do not want to support full screen mode).
In Mambo, we used fixed CSS names for HTML elements, so I made multiple
global searches on the ZC files to change their CSS class ids to Mambo
equivalents. This allowed our template styles to take precedence over the
styles in their template.
I decided to stop at this point because template changes were underway for
1.2, ADODB is on the way out, new caching is being added, and I do not know
yet how this will effect things. There are other fundamental changes coming
that might effect how sessions and cookies are handled.
More information about the TYPO3-dev
mailing list