Solving the “Fatal error: Declaration of Zend_Pdf_FileParserDataSource_File::__construct()” error (Magento 1)

Sometimes, when saving an invoice for an order, the following error might come up: Fatal error: Declaration of Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with Zend_Pdf_FileParserDataSource::__construct() in /var/www/vhosts/website/httpdocs/includes/src/Zend_Pdf_FileParserDataSource_File.php on line 41 To solve that problem, open the lib/Zend/Pdf/FileParserDataSource.php class and change the…

Fixing the Zend_Pdf_FileParserDataSource_File::__construct() declaration error (Magento 1)

The following error may appear when you attempt to print an invoice: Fatal error: Declaration of Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with Zend_Pdf_FileParserDataSource::__construct() in /var/www/vhosts/website/httpdocs/includes/src/Zend_Pdf_FileParserDataSource_File.php on line 41 To resolve it, open the class lib/Zend/Pdf/FileParserDataSource.php and change the declaration of the…

Adding a product image description programmatically (Magento 1)

There is no way to add a product image description using the addImageToMediaGallery function. The following code does the job though: foreach($product->getData(‘media_gallery’) as $each){ foreach($each as $image){ $attributes = $product->getTypeInstance(true)->getSetAttributes($product); $attributes['media_gallery']->getBackend()->updateImage($product, $image['file'], array(‘label’ => ‘whatever’)); } }

Adding a product image label programmatically (Magento 1)

If you want to add a label to a product image programmatically, you cannot do this with the addImageToMediaGallery method. The following code, however, does the job:

Increasing speed of store by adding Gzip compression (Magento 1)

You want to increase the speed of your Magento store? One way to achieve that is to add Gzip compression. It can be added easily by modifying your servers .htaccess file. Add the following lines:

When done, check if…

Improving page load speed with Gzip compression (Magento 1)

Want to speed up your Magento store? One option is to enable gzip compression. This can be activated relatively easily in your server’s .htaccess file. Add the following lines:

You can then check whether the changes work by running…