Forums / Addon Admin Tools / PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

Views: 5,564

Results 1 to 13 of 13
30 Apr 2021, 10:09 AM
#1
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,864
Plugin Contributions:
18

PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

This is a new support thread for the PDF Attachment in Product Description Mod v2.2.0 and specifically for Zen Cart version 1.5.7c

Versions of Zen Cart prior to 1.5.7c are*** NOT ***supported by this mod or this thread.

When approved, the files will be found at https://www.zen-cart.com/downloads.php?do=file&id=1642.

The files are also available on GitHub at https://github.com/dbltoe/PDF-Attachment-in-Product-Description.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

30 Apr 2021, 1:16 PM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

Approved. Strong suggestion: also add a .htaccess file to the pdf-attachments folder. You can use the one from /download.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

30 Apr 2021, 4:40 PM
#3
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,864
Plugin Contributions:
18

Re: PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

THANX Scott.
The .htaccess file is available on GitHub at https://github.com/dbltoe/PDF-Attachment-in-Product-Description
or...
create your own.

## @copyright Copyright 2003-2020 Zen Cart Development Team
# @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
# @version $Id: DrByte 2020 Oct 29 Modified in v1.5.7a $
#

AuthType Basic
AuthName "No access"
AuthUserFile .htnopasswd
AuthGroupFile /dev/null
#Require valid-user

###############################
#
# This is used with Apache WebServers
#
# The following blocks direct HTTP requests to all filetypes in this directory recursively, except certain approved exceptions
# It also prevents the ability of any scripts to run. No type of script, be it PHP, PERL or whatever, can normally be executed if ExecCGI is disabled.
# Will also prevent people from seeing what is in the dir. and any sub-directories
#
# For this to work, you must include either 'All' or at least: 'Limit' and 'Indexes' parameters to the AllowOverride configuration in your apache/conf/httpd.conf file.
# Additionally, if you want the added protection offered by the OPTIONS directive below, you'll need to add 'Options' to the AllowOverride list, if 'All' is not specified.
# Example:
#<Directory "/usr/local/apache/htdocs">
#  AllowOverride Limit Options Indexes
#</Directory>
###############################

# deny *everything*
<FilesMatch ".*">
  <IfModule mod_authz_core.c>
    Require all denied
  </IfModule>
  <IfModule !mod_authz_core.c>
    Order Allow,Deny
    Deny from all
  </IfModule>
</FilesMatch>

# but now allow just *certain* necessary files:
<FilesMatch "(?i).*\.(pdf)$">
  <IfModule mod_authz_core.c>
    Require all granted
  </IfModule>
  <IfModule !mod_authz_core.c>
    Order Allow,Deny
    Allow from all
  </IfModule>
</FilesMatch>

<IfModule mod_headers.c>
  <FilesMatch "(?i).*\.(zip|pdf|mp3|swf|wma|wmv|wav|epub|ogg|m4v|m4a)$">
    # tell all downloads to automatically be treated as "save as" instead of launching in an application directly
    # ALERT: ForceType requires Apache2 or later. If using older version of Apache, it will need mod_mime installed. Or just comment out the ForceType line below
    # (to disable, just comment the next 2 lines by adding a '#' at the beginning of each):
    ForceType application/octet-stream
    Header set Content-Disposition attachment
  </FilesMatch>
</IfModule>

IndexIgnore */*

## NOTE: If you want even greater security to prevent hackers from running scripts in this folder, uncomment the following line (if your hosting company will allow you to use OPTIONS):
# OPTIONS -Indexes -ExecCGI
```This will allow ***ONLY ***PDF files to be uploaded.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

30 Apr 2021, 4:53 PM
#4
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,864
Plugin Contributions:
18

Re: PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

When creating or updating a product, the PDF Attachment options will appear between the Product Images and the inputs for URL, Shipping Weight, and Sort Order.

It should look like the following:

[Attachment no longer available]
It's operation is very similar to the process used for Product Images.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

1 May 2021, 3:16 AM
#5
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,864
Plugin Contributions:
18

Re: PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

Just found a glitch that occurred when adding the hidden file/author/version information at the top of New_Files/ YOUR_ADMIN/includes/functions/extra_functions/pdf_attachments_functions.php.

Operation of the mod is not affected but the portion that should be commented out is shown at the top of all admin pages.

I will be submitting version 2.2.1 to the Plugins

You can either grab the repaired file from GitHub at https://github.com/dbltoe/PDF-Attachment-in-Product-Description

Or...

Change

// | http://www.zen-cart.com/index.php                                    |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | [email protected] so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
//-Last updated for PDF Attachment v2.2.0, 20210430 (dbltoe)
//
<?php

To

<?php
// | http://www.zen-cart.com/index.php                                    |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | [email protected] so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
// Last updated for PDF Attachment v2.2.1, 20210430 (dbltoe)
//

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

16 Jun 2021, 1:16 PM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

I think that the addition of $sql in ./includes/modules/pages/product_info/main_template_vars.php is not required. You get this data above already. (See "includes/modules/pages/product_info/main_template_vars.php" line 18)

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

16 Jun 2021, 1:52 PM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

Suggestions / Bug Fixes:

  • rather than having people modify their configure.php files, just create
    includes/languages/english/extra_definitions/pdf_attachment.php
    with define('DIR_FS_CATALOG_PDF_ATTACHMENTS', DIR_FS_CATALOG . 'pdf-attachments/');

  • admin/includes/modules/product/preview_info.php line 97 not needed.
    $pInfo->products_name = $products_image_name;

  • admin/includes/modules/copy_product_confirm.php line 112 you are missing the field name pdf_attachment_name, which should be added after products_name. As coded, the line would give a SQL error.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

16 Jun 2021, 6:23 PM
#8
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

Re: the last item - just updated this file admin/includes/modules/copy_product_confirm.php in 1.5.8 to use zen_db_perform on an array, so it will be easier to add the setting for PDF attachements.

https://github.com/zencart/zencart/pull/4386#event-4898788954

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

17 Jun 2021, 2:46 AM
#9
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,973
Plugin Contributions:
8

Re: PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

while i admire the intent of ALL plugins (and their writers) to help store owners, i would change a few things with this one:

  • i would not preface any function name with zen_. it makes it seem that it is part of the ZC base code, of which it is not.
  • i am also not a fan of whole sale replacement of existing scripts. the ZC notifier system should be able to handle what this plugin does without any modification of ZC core files.
  • if it can not be done using the ZC notifier system (of which i am not convinced), then i would create a PR to add needed notifiers.
  • barring that, i would create a standalone plugin using the new zc_plugins for the admin side to add needed pdfs.

just my 2 cents.

best.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

17 Jun 2021, 5:03 AM
#10
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

I suspect moving the PDF information out of the products / products_description tables into its own table would make decoupling this change from the core even easier. Perhaps in a future version.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

9 Sep 2021, 2:55 AM
#11
elemi avatar

elemi

Zen Follower

Join Date:
Mar 2006
Location:
Auckland, New Zealand
Posts:
242
Plugin Contributions:
0

Re: PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

Is this good to go now for 1.5.7c? Or is it still being tweaked based on the conversations above?

:-)

Elemi

The Art of Bespoke Aromatherapy
https://www.AmorAromatherapy.co.nz

21 Oct 2022, 3:37 PM
#12
bigandrew avatar

bigandrew

New Zenner

Join Date:
Oct 2014
Location:
Georgia
Posts:
74
Plugin Contributions:
0

Re: PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

After installing this mod, I have the following error when trying to "copy" (create a duplicate) a product.

WARNING: An Error occurred, please refresh the page and try again.If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

I hate to uninstall this mod just to fix that issue. Any thoughts? This error does not create a log file.

31 Mar 2023, 11:12 AM
#13
cunningstunt2 avatar

cunningstunt2

Zen Follower

Join Date:
Jan 2019
Location:
UK
Posts:
113
Plugin Contributions:
0

Re: PDF Attachment in Product Description v2.2.0 for 1.5.7c [Support Thread]

This could be quite useful to me, but it would need to support multiple PDF files per product, the products I sell online are adhesives and other chemicals and some are two part systems, so I have to link a technical datasheet and safety datasheet for each product, and for 2 part adhesives I would need to link 2 safety datasheets per product.

At the moment I just use a script to populate tables from 2 folders I have full of datasheets, then manually link each datasheet into the products description.