December 9, 2009

re-evaluating price related plugins

Tags: , , , , ,
Filed under: ZenMagick — DerManoMann @ 9:51 pm

While refactoring existing plugins I’ve taken the time to think about which ones to keep and which ones to drop (for now? ever?). Right now I am looking at the dual pricing and the price group plugins.

Two thoughts:

  1. The price group plugin should be moved into storefront. There are two good reasons for this. First of all, it would mean not having to subclass ZMProducts. Secondly, it is useful and opens the door for more improvements in that area.
  2. #1 actually means that the dual pricing plugin is more or less obsolete.

Opinions?

December 3, 2009

another pugin refactoring update

Tags: , , ,
Filed under: ZenMagick — DerManoMann @ 10:20 pm

I am making quite good progress on converting plugins. However, as already mentioned a couple existing plugins might not make it to the finals.

There are mainly two reasons:

  1. I do not have the time/energy to maintain all plugins any more – hopefully integration plugins for zen cart mods will be taken over by some mod owners in the future.
  2. Some plugins are just too far away from what I wish they would be and in order to get a release ready they’ll have to wait.

Right now there are about 25 plugins left. Some are rather simple and I might skip testing them (in particular the integration plugins that usually consist of just the plugin class).

Among the plugins still to be done are also the Catalog Manager plugins. Hopefully the time and work I put into the new infrastructure code will pay off to those going without too much trouble

December 2, 2009

and more on plugins

Tags: , , , , ,
Filed under: ZenMagick — DerManoMann @ 9:49 pm

After some interesting discussions in the comments and also in the new forum, I’ve decided that I’ll add some more changes to the next release regarding plugins.

In fact, it’s a partial rewrite of how plugins generate admin UI content. Precondition for that was to convert all ZenMagick admin pages to using the MVC framework. While this is not complete it now still allows to write proper controller and views for admin pages. A side effect is that it will make it much easier to get to a point where the admin UI could be skinned similar to what themes do for the storefront.

It also means that the new plugin naming conventions will be active in the next release.

I made a small change compared to the previous proposal, though. The word ‘Plugin‘ is now expected to be at the end of the main plugin clas; for example: ‘ZMQuickEditPlugin‘. This means all classes will start with the same plugin specific prefix (‘ZMQuickEdit‘ in the example), which acts as some simple sort of namespace, I guess.

A downside to all of this is that all plugins need to be updated. On the other hand it means I really need to test all of them and I already found a few bugs in existing versions….

I’ll be publishing a new snapshot over the weekend I hope. That should also include the latest zen cart XSS patch in zc-base.

November 30, 2009

plugins – still moving

Tags: , , ,
Filed under: ZenMagick — DerManoMann @ 12:03 am

I am still working on redefining how plugin admin pages work. I’ve been going in circles for a while until I realized the reason for that is that there are right now two distinct kinds of plugins:

  1. normal plugins
    Any plugin that is not a…
  2. catalog manager plugin

So I figured I might start making #1 work and then see what the actual difference is between #1 and #2.

The tricky thing right now is that I don’t want to change things again once the project is in a place where the admin pages can be re-implemented. (I am still not sure if that will be evolution or revolution…).
The plan is to expire the current ZMPluginPage and ZMPluginPageController in favour of *normal* controllers, based on ZMController. In the long run that will help minimize changes required should it come to the planned admin improvements.

These changes go togther with the already implemented (but disabled) changes to support the new plugin naming conventions.

November 26, 2009

working on plugins

Tags: , , , ,
Filed under: ZenMagick — DerManoMann @ 1:10 am

I’ve started working on the proposed change of naming conventions for plugins. Once really positive side effect is going to be that all plugins will receive a bit of polish and catching up on API changes.

Also, I already found a couple that most likely can’t have worked for some time. Not sure if people don’t need/use those or are just to lazy to report bugs…

Either way, I guess I’ll try to push this as last change into the next release. This will mean that some custom code might be broken and you’ll also need to go through your custom plugin settings to adjust some setting names…

November 25, 2009

Plugin code and naming convention proposal

Tags: , , , ,
Filed under: ZenMagick — DerManoMann @ 10:37 pm

A few days ago I wrote about the ‘ZM’ prefix and plugins. The prefix is useful but, as Raine pointed out it would be good to have something to avoid naming conflicts.

Seeing that it will be a while before we can start using PHP’s new namespaces a different solution must be found. (more…)

June 16, 2009

3rd party integration

Tags: , , , , , ,
Filed under: ZenMagick — DerManoMann @ 11:04 am

I’ve done a bit of 3rd party integration work for ZenMagick, mostly on the Wordpress and phpBB plugins. The following is a summary of my experiences and thoughts about that (based on a discussion I’ve recently had with a client).

3rd party integration examples in ZenMagick

The ZenMagick Wordpress and phpBB plugins implement user syncing from Zen Cart/ZenMagick to the respective 3rd party application. That means any user/account change relevant in the other application is forwarded (or, more precisely, applied to the other application’s database).

What is full integration?

There is, of course, more to be had. Full integration would be to do exactly the same (ie. updating the Zen Cart database) from within other application (where appropriate).

Why ZenMagick plugins only implement one side of side of user syncing

Syncing from ZenMagick to another app. is obviously not that hard. In fact, I’ve spend quite a bit of time tweaking the ZenMagick plugin architecture to allow doing that in a way that does not require any patching on Zen Cart or ZenMagick core files [excluded patches on Zen Cart to make ZenMagick work at all].

Things are looking quite differently doing the other side. The main blocker in implementing that is simply time! I just don’t have time to get involved in every 3rd party at the low level required in order to handle registration, login, logout and other events. I am sure other apps have code to allow to capture and process those events one way or another. However, learning that just for the sake of a plugin is just not possible.

I suppose for someone who maintains just a single plugin it’s fun to dive into both apps involved, but for me it’s just not practical.

Events that need handling for full user syncing

There are a number of events in each application that result in user data being changed. For ZenMagick, events exist to allow easy processing of the following events:

  • registration
    Registration of a new user. Once a user account is created, an event is fired that includes the new account. Also included is the password in clear text to allow plugins to store it (as-is, or as some sort of hash) in the other applications database
  • account update
    Fired each time account information are updated.
  • password change
    Since Zen Cart/ZenMagick have a separate dialog for updating a password, this is a separate event from account update. As with the registration, the clear text password is passed in the event.
  • request new password
    Similar to a password change, however in this case the password is generated rather than changed.

Since it is usually not practical (the only exception so far is Wordpress) to use code from both applications at the same time, the typical solution to add data to the other application is to generate low level SQL. (For exampe, phpBB uses a global $db to access the database, same as Zen Cart!).

Single Sign On (SSI)

If SSI is required, the list of events to handle needs to be expanded by the following two:

  • login
    An event to notify interested code/plugins that a user has successfully logged on. The account is part of the event parameters.
  • logoff
    Indicates that the current user has logged off.

Capturing these events is as simple as all the others above in ZenMagick. The tricky bit is to actually make the other application believe that the same has happened over there!

There are a number of ways to archive this:

  1. Fake login/logogg requests
    The code that handles the login/logoff events generates a GET/POST to the other applications login form / logoff URL with appropriate parameters.
    This does work, however for my taste this is a bit too fragile.
  2. Simulate login/logoff
    What I mean with this is that all activities required to register/invalidate a session are replicated. This includes:

    • Set session cookie
    • Create session record in database (or other session store)
    • Add user id or other session data required to make a session valid

    Obviously, this is the more elaborate alternative and also not without downsides. It requires intimate knowledge of the other app and is prone to break when the 3rd party application is upgraded.

  3. Linked user accounts
    This approach is based on some sort of repository (usually a database table) that is used to map or link corresponding user between Zen Cart and the 3rd app.
    Then both applications need to be extended to allow to recognize each others session. This doesn’t have to be complete, though. It is sufficient if ZenMagick can identify the 3rd party’s user id and vice versa. The mapping table can then be used to lookup the corresponding own user details and the user gets logged in automatically.

Personally I really like option #3. I haven’t tried implementing it yet, however it seems to involve the least overhead on both sides. Also, it minimizes the amount of knowledge that each application needs to have of the other one and leaves each application to manage it’s own sessions, not the other ones!

In the most generic version there could be a login service on ZenMagick side that manages a number of 3rd party specific sniffer modules that try to detect 3rd party sessions for each request. In that scenario only the really application specific code would need to be written from scratch for each new external application.

The good news is that with zm_auto_login a plugin already exists that can login a Zen Cart user based on an customer id taken from a separate database table (and identified by a separate cookie [that could be shared by both apps]).

June 8, 2009

adding services to core

Tags: , , , ,
Filed under: ZenMagick — DerManoMann @ 4:40 am

I’ve been pondering adding some more (not just database access) services to the core of ZenMagick. Right now my (rather short) list of services is mostly made up of plugins and yet-to-write code:

  • zm_cron
  • zm_token
  • a generic product association service that delegates to installed association plugins
  • a rewrite of ZMOffers as service, plus the ability to plug-in alternative/additional discount calculations; this would be on product level and work as alternative to order total discounts that operate on cart/order level

The motivation to add the cron and token service to core is that they are way to valuable to be optional. Also, I found that in particular the cron job is already referenced from enough other plugins to justify the move.

If there are other services that would be useful I’d be happy to hear about that (preferrably with some sort of justification).

May 28, 2009

another plugin idea

Tags: , , , ,
Filed under: ZenMagick — DerManoMann @ 3:43 am

I’ve had an idea for yet another plugin. I think I’ve seen some similar things for Wordpress, so maybe that’s where it is coming from.

The idea is to build  a plugin that replaces specially formatted  HTML comments or custom tags with predefined content. This could be used as an alternative marketing system. The rules for picking content to insert could be as complex as you want, include regular expressions, start/end date and more (perhaps conditions like login status, referrer, etc).

This would allow to add marketing images, etc anywhere on the site, and even in static  and ez pages!

Any volunteers??

May 14, 2009

plugin maintenance

Tags: , , , , ,
Filed under: ZenMagick — DerManoMann @ 1:03 am

So far every ZenMagick release was accompanied by the release of new plugins and updates to existing ones. With the current number of plugins I do not know for how much longer I’ll be able to keep up with that.

A quick count in my development folders shows (including unreleased and incomplete):

  • 44 request plugins
  • 1 order total plugin (new)
  • 7 init plugins (of which 2 are currently official, however the plan is to make those obsolete)
  • 7 admin (Category Manager) plugins

If anyone is interested in taking over maintenance of one (or more) plugins I’d be more than happy to hand them over. Also, I’ve been toying with some ideas about how plugins could become even easier to handle. In particular the following items are on my current list:

  • Auto update of plugins (similar to what WordPress offers since 2.7)
  • Dedicated pages for each plugin on zenmagick.org, rather than just a single wiki page
  • Go through all plugins and update to using the new features available (plugin controller, etc.)
  • I recently found out that the code that drives AMO is Open Source – Perhaps a (stripped down) version of that could be used to host ZenMagick plugins…

I am open for more suggestions and if you have ever thought about getting into ZenMagick development, working on a plugin would be a great way to get started…

Next Page »