Purpose & Aim

You will be able to upload a pdf attachment to every product via the normal product editing in your Zen Cart admin panel. This can be useful if you have to show product data sheets or similar pdf documents to your visitors. You can define a description text (multilingual, similar to product names) for the pdf attachment. On the products detail page this text will show up below the product description (or whereever you want it) with a pdf icon linking to the pdf download file.

Backend:

Frontend:

Copyright, License

Copyright Version 2.0 for Zen Cart 1.5.5h
(c) 2017 webchills (www.webchills.com)

Credits: Andrea Giovanelli (andreagiov) for the first version 1.0

Changelog Version 2.0:
rewritten for Zen Cart 1.5.5
added ability to define multilingual descriptions for the pdf files

Portions Copyright (c) 2003 osCommerce
Portions Copyright (c) 2003-2017 Zen Cart

This contribution is subject to version 2.0 of the GPL license available through the world-wide-web at the following url:
http://www.zen-cart.com/license/2_0.txt

Installation


This plugin is for Zen Cart 1.5.5 only

IMPORTANT
Before you begin:
Make a BACKUP of store files and database!
No warranty!
BACKUP made? Ok, then continue...

Follow these steps carefully:

1)
Open the install.sql in the folder SQL with a text editor and copy the content. In your Zen Cart admin panel go to Tools > Install SQL Patches and paste it in. Send.
This creates the needed database changes.

2)
Download the following file from your Zen Cart installation:
includes/configure.php

Open it with a text editor and add the following entry (e.g after define('DIR_FS_CATALOG', '/abcd/');)

define('DIR_WS_PDF_ATTACHMENTS', 'pdf-attachments/');

Now upload the changed includes/configure.php again. Note that this file is normally not writeable, so you will have to change the file permissions to chmod 777 before you upload.
After uploading change it back to chmod 444

3)
Download the following file from your Zen Cart installation:
YOURADMIN/includes/configure.php
YOURADMIN is the name of your admin directory in Zen Cart

Open it with a text editor and add the following entry (e.g. after define('DIR_FS_CATALOG', '/abcd/');)

define('DIR_FS_CATALOG_PDF_ATTACHMENTS', DIR_FS_CATALOG . 'pdf-attachments/');

Now upload the changed YOURADMIN/includes/configure.php again. Note that this file is normally not writeable, so you will have to change the file permissions to chmod 777 before you upload.
After uploading change it back to chmod 444

4)
Im the folder NEW FILES rename the folder YOURADMIN to the name of your admin directory.
Then upload the folders/files, no existing files will be overwritten.
Change the permissions of the folder pdf-attachments to chmod 777 as it needs to be writeable to store the pdf files later.

5)
In the folder CHANGED FILES rename the folder YOURTEMPLATE to the name of your active store template. If you are using the responsive_classic template use the folder YOURTEMPLATE_RESPONSIVE.
Rename the folder YOURADMIN to the real name of your admin directory.
Now do a file comparison (I recommend BeyondCompare) between the changed files in this download and the files on your server. And merge the changes carefully.

6)
When editing a product you will now have a new option to upload a pdf file for a product. And you can define a description which will be shown later on the product details page for the pdf attachment.
Working with these pdf attachments is similar to uploading a product image, it should be self explanatory.

Similar to product images in the folder images you can work with subfolders if you wish.
Create subfolders in the pdf-attachments folder (they will need chmod 777 as well). As soon as there are subfolders they will be selectable in the "Upload to directory" dropdown

In Catalog > Product Types > Product General > Layout Settings you can deactivate that the pdfs are shown on the product detail page (e.g. during your testings).

UNINSTALLATION

1.
Use the uninstall.sql in the SQL folder to remove the database changes via Tools > Install SQL Patches

2.
Delete all new files created by ths plugin from your server.
Replace all files changed by this plugin with the original files or the files of your backup you made before.

Donation

Like this plugin? It is useful for you?

Buy me a cup of coffee here: