October 29, 2007

HowTo: Display a category image

Filed under: ZenMagick — DerManoMann @ 10:49 am

This is one of the shorter HowTo posts, but it’s just so easy :)

Add the following line (or change to fit your design)

<?php $imageInfo = $this->create("ImageInfo", $category->getImage()); zm_image($imageInfo); ?>

The code assumes that $category is your current category object (instance of ZMCategory).

Done!

October 25, 2007

not coding for once

Tags:
Filed under: ZenMagick — DerManoMann @ 10:13 pm

As promised I am working my way through some not coding  tasks!

As a first step I have disabled the wiki on sourceforge. I’d like to stress that generally I really like sf and I am very happy with hosting the ZenMagick sources there. (One exception being the file add dialog where you need to set filetype and OS for each file individually!)

It’s not a great loss as there wasn’t really too much in it (two articles that I remember). Also, I was not very happy with the speed/performance (not sure if living in New Zealand helps or hurts, though). The replacement is actually already up and running using the very url wiki.zenmagick.org.

I started working on that and I invite all ZenMagick users to contribute where possible.

There is also a new demo store online now running the demo thema and a vanilla 0.8.4 installation. I haven’t had time to update the links on the current ZenMagick website, but I’ll do that this weekend.

So, what is missing? Exactly, the new ZenMagick website. As you might have figured out by now it’s going to be at www.zenmagick.org. Sadly, though, it’s not there yet and might actually still take some time.

One bit issue I have right now is to come up with a new lighter design and find a good logo. I never really thought much about it so far, but with the growing interest and more ZenMagick sites popping up I think it’s get one.

I had a look at some Open Source templating sites, but haven’t really found the right thing.  I plan to keep the actual site quite small, perhaps just a handful or dozen pages. Everything else should find a place in the wiki.

So, seeing that there are a lot of great designers out there and some even use ZenMagick, I secretly hope that there might be someone able to help out. I would be very grateful and think it would make ZenMagick more of a real Open Source project than just a one man show.

PS: I’d be interested in some feedback about the performance of the zenmagick.org sites. They are hosted a bit closer to where I live and therefore feel very fast to me. However, the page execution stats of the new demo site are much more impressive than the old ones…

PPS: There is actually one other task I’ll do as part of moving to zenmagick.org that is changing all source code packages to reflect the move. This will make things more consistent and the apidocs a bit more readable as the packages will also be shorter…

October 24, 2007

Smarty update

Tags: , ,
Filed under: ZenMagick — DerManoMann @ 2:55 am

In principle, the Smarty plugin is finished, except for email handling. One additional bonus I found is the integrated caching.

The custom theme supports now the same layout config mechanism that all ZenMagick themes use (ie default_layout, etc..) and the name of the content view is passes as $view_name into the main template.

Downsides so far: It would be required to write Smarty function plugins as wrapper for all ZenMagick/zen-cart functions that we need to use. So, maybe I’ll leave it as proof-of-concept and hope someone else might be keen to write all of those :)

I also need to investigate as to how sideboxes would work as they tend to do some processing themself. In the worst case custom SMarty plugins would need to be written to provide the functionallity/data required. In a way this would actually be quite neat as it translates into custom controller code for sideboxes which would only be executed when used!

Stay tuned

October 23, 2007

Chain reactions – be Smart(y)

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

Today was another day where a chain of events got me sidetracked. A post in ZenMagick’s sourceforge.net help forum was written by someone that is involved in zen-cart Xoops integration project.

That sounded like something that could be interesting for ZenMagick, too, so I had a closer look and next thing I read that Xoops is using the Smarty templating engine.

So, I dive into that as that was something that had me pondering before. I spend enough time to download and install Smarty and get the demo code from the installation page working.

After that is was around 30 minutes to write a very crude ZenMagick plugin that included a custom ZMView implementation to use Smarty to display a response based on templates located in a custom ZenMagick theme.

It has still a few hardcoded dependencies and other oddities, but it’s already a proof of concept. (For one thing I have no idea how emails would work yet, even though that should be following the same patterns.)

The theme structure would have to be different from a normal PHP based theme, though.

October 22, 2007

HowTo: adding the registration form to the login page

Tags: ,
Filed under: ZenMagick — DerManoMann @ 11:36 pm

When I started ZenMagick I had the requirement to split the login and registration page. That wasn’t too hard as there were already two separate templates. Getting the controller code to work properly was much harder, though.

Still, there are folks that would like to keep it the way it was, so here is how it can easily be done: (more…)

October 19, 2007

Plugin downloads

Tags:
Filed under: ZenMagick — DerManoMann @ 5:30 am

Just a quick word of explanation about plugin downloads.

Currently, plugin downloads are grouped by version. That version is the corresponding minimum ZenMagick core version required. That means if a plugin does not exist under 0.8.4, it might be under 0.8.3 and so forth.

At the moment plugins are updated only to fix bugs and keep up with API changes, so with that in mind you can see that  things have settled a bit and it’s getting even more quiet. For the next release the only plugin to be updated will USEO2, so do not get too excited.

If you feel there is a plugin /functionality missing, feel free to leave a comment or email me. You may also submit a feature request if you prefer to do that.

PS: There are plans, however, to refactor more code from core into plugins to make core smaller and easier to manage.

October 18, 2007

About: Categories

Tags:
Filed under: ZenMagick — DerManoMann @ 12:32 am

Root Categories

One question that comes up occasionally is about how to access the current/all root categories. A lot of store designs include horizontal tabs with the main categories, so it’s good to know how to get them.

Pretty much all that is requires is already there, it’s just a matter of knowing where to look. In this case the relevant file is themes/default/content/boxes/categories.php. Looking at the source you’ll find the line:

$tree = $zm_categories->getCategoryTree();

This will assign a tree like hierarchy of ZMCategory objects to $tree. In fact, it’s not really a tree as $tree will be an array of the – root categories. So a simple way of displaying all root categories would be:

foreach ($zm_categories->getCategoryTree() as $category) {
echo $category->getName()."<BR>";
}

The current root category

Another thing is to find out the current root category on a category or product page. There are at least two methods, depending on taste:

1) Looking at the crumbtrail

The crumbtrail contains all information needed. Since the first element is usually ‘Home’, it’s the second crumb element we are interested in:

$crumb = $zm_crumbtrail->getCrumb(1);
echo $crumb->getName()."<br>";
echo $crumb->getUrl()."<br>";

2) Using the category path included in the request

URLs pointing to category and product pages typically include a parameter denoting the category path. ZMRequest has a method getCategoryPathArray() that allows to access that information in a straightforward manner:

$cpath = $zm_request->getCategoryPathArray();
$category = $zm_categories->getCategoryForId($cpath[0]);

The logical second step is to lookup the category for the category id from the path. Please note that here we are looking at the first element (index = 0), as this is just the categroy path.

Again, displaying the name and creating a URL for the root category are as simple as:

echo $category->getName();
echo zm_href(FILENAME_DEFAULT, $category->getPath(), false);

October 17, 2007

Login / account issues

Tags:
Filed under: ZenMagick — DerManoMann @ 6:18 am

There has been some discussion about broken logins and being unable to login right after signing up. I did a review of the affected code and unfortunately, there are a couple of issues in 0.8.3. As a direct result, I’ll push the next release including many bugfixes in the next few weeks.

Issues found are:

  • When creating a new account, the password is not picked up. Instead, an empty string is encoded and written to the database (this is different from an empty password field, though)
  • In 0.8.3 it is possible to request a new password (forgotten_password) for a guest account. This will, effectively, convert the account into a registered account.
  • The create account controller does not check for duplicate email addresses

If your site suffers from any of these symptoms, please stay tuned for the next release to fix those issues as soon as possible.

While trying to test as much as I can, there are certainly things I do and will miss. Admittedly, these sort of bugs are not acceptable and I would like to apologize to everyone affected. I really appreciate the trust you put into me and ZenMagick and will do everything I can to justify that.

As a first action I suggest that I build release candidates for testing before releasing official new versions. However, this will require participation on your side to pick up those builds and test them as much as possible.

Alternatively, the release cycles might have to get longer which I do not really like. Still, perhaps it is better to have less innovation but a more stable product.

October 15, 2007

good news

Tags:
Filed under: ZenMagick — DerManoMann @ 9:27 pm

… for people struggling with creating a new ZenMagick theme. I just added a simple theme builder that just takes the name and generates a basic ThemeInfo classs and the most common folder.

I do not know why it is so hard, but it really seems to be an issue, so let’s see if this helps…

October 14, 2007

0.8.4 delayed

Filed under: ZenMagick — DerManoMann @ 10:27 pm

I know that I made a few remarks about 0.8.4 coming out this week, but doe to some bigger (longstanding) issues, I’ll wait until those are sorted. There is a potential second one, but I haven’t logged that yet as it is not confirmed.

Other reasons for the delay are my commercial commitments, however, some of the fixes in 0.8.4 are the direct result of that, so it’s also a good thing to do!

Next Page »