Zen-Cart anti-Koans

Zen-Cart is the Open Source shopping cart we’re using in the vast Richards web-empire.

It’s a fork of OsCommerce. They seem to be doing the same kind of cleanup that the OsCommerce team is doing, but actually delivering code. Version 1.1 seems much cleaner than the current OsCommerce build.

However, calling the documentation sketchy is flattering it, and it being early days yet, there are bugs and missing functions.

So, as I come up with info, I’ll be posting it here, as well as on the ZenCart site.

I figure we’ve all got more to do than time to do it, so I’ll be posting answers to my questions rather than leaving them as an exercise for the student:

Q. I changed my logo image according to the instructions, and set height and width. I got the new image, but it’s full size, not the size I specified.

A. I’m pretty sure this is a bug. HEADER_LOGO_HEIGHT and HEADER_LOGO_WIDTH are used in includes/templates/templatename/common/tpl_header.php to set the size of the

element the login appears in. However they are not included in the call to the zen_image function (includes/functions/html_output.php). This function defaults to putting the actual height and width of the image into the element, and both IE and Mozilla use these values rather than the ones in the

tag to actually size the displayed image.

The fix is:

In includes/templates/templatename/common/tpl_header.php, change the line

‘ . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,’images’). ‘/’ . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . ‘‘; ?>

to

‘ . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,’images’). ‘/’ . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT, HEADER_LOGO_WIDTH) . ‘‘;
//added HEADER_LOGO_WIDTH to make zen_image size the image
?>

This will cause the users browser to scale the image to the specified width, and scale the height proportionally.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.