Compiling Magento with web-to-print

02/04/2012

Magento’s code is spread out over a large number of modules. PHP search across a large number of include files has serious performance penalty. Magento compilation feature copies all the code into a single location. It doesn’t always work with our web-to-print extension. This post explains a quick workaround to make Magento compilation work on your web-to-print or dynamic imaging website.

How Magento compiler works

The compiler renames all files to include the fully qualified class name and puts them in a single folder. It ensured file name uniqueness.

E.g.

1
2
3
include/src/Mage_Core_Model_Abstract.php
include/src/Foo_Module_FooController.php
etc...

Read more about Magento Compiler mode on alanstorm.com

How to make web-to-print extension work with Magento compiler

After compilation process finished, follow these steps to make our web-to-print extension for Magento work properly:

1. Edit includes/src/ZetaPrints_Api.php file

Replace the following string

1
require_once 'zetaprints-api.php';

with this:

1
require_once 'ZetaPrints/zetaprints-api.php';

2. Copy XSLT files (compilation process doesn’t move them automatically)

Copy lib/ZetaPrints/xslt folder to includes/src/ZetaPrints folder.

See also: