In my (in)frequent series of random posts I present today a small piece of code to manipulate the label of the tax order total line during checkout.
Now, that wouldn’t be soo exicting, however it doesn’t require any template changes
Let’s start with the code:
class GSTPatcher {
public function onZMViewStart($args=null) {
global $order;
$key = 'GST';
if (isset($order->info['tax_groups'][$key])) {
$order->info['tax_groups']['Includes GST'] = $order->info['tax_groups'][$key];
unset($order->info['tax_groups'][$key]);
}
}
}
ZMEvents::instance()->attach(new GSTPatcher());
So, what is happening here? To begin with, a small class is defined with a single method onZMViewStart(). As the name suggests, the method is a callback function. In order to have it called an instance is registered (attached) to the ZenMagick event service ZMEvents.
The event view_start is raised? right before the actual page content is generated. The event service will then try all registered objects for a matching callback method. If found, it is called.
The method itself is rather simple. All it does is to modify the map of order totals of the current cart (in an $order object!).
Comments Off
Right, another distraction! I just checked in another plugin that allows to take advantage of the recent changes to the logging code.
The plugin adds support for FirePHP by means of a custom ZMLogging implementation. Pretty neat, indeed!
EDIT: Originally I just thought it would be cool to have something fancy like this. However, as it turns out, even after using it for a day or two I start loving it. In particular with translating the errlevel to something FirePHP understands it becomes a lot easier to browse the log (with the custom error handling enabled).
Comments Off
There has been some trouble with the payments for the zenmagick domains. Since I switched to a direct credit payment, the otherwise excellent hosting provider kept insisting to try and charge my credit card.
For some reason syncing my payments with their invoicing system seems to be doomed. So now services are suspended until this is settled. I apologize for any trouble this should cause.
Hopefully, this will be sorted before the weekend.
EDIT: Ooops, turns out the site was pulled because the disc limit was exceeded. My apologies – still the payment issue did exist! (sorted now)
Comments Off
For all the SEO junkies out there – I’ve just checked in a new plugin to supprot the Ultimate SEO URL mod for zen-cart.
Not sure yet if I am going to release that stand alone, but I think I can just add that to the 0.9.2 plugins package.
It’s jsut a simple wrapper around the main logic using the ZenMagick SEO callback function.
Reminder to self: update wiki plugin docs with new 0.9.2 plugins and probably restructure
Comments Off