Zen Cart Logo
Forums / All Other Contributions/Addons / Printable, numbered gift certificates

Printable, numbered gift certificates

Views: 6,700

Results 21 to 28 of 28
2 Dec 2011, 8:59 PM
#21
becktowery avatar

becktowery

New Zenner

Join Date:
Dec 2011
Posts:
2
Plugin Contributions:
0

Printable, numbered gift certificates

3 Dec 2011, 7:55 PM
#22
becktowery avatar

becktowery

New Zenner

Join Date:
Dec 2011
Posts:
2
Plugin Contributions:
0

Re: Printable, numbered gift certificates

I figured it out. Bad dompdf url I am now going to try to add fields to be printed. I need a date of purchase and product name. Any thoughts?

7 Dec 2011, 4:24 PM
#23
zskiman avatar

zskiman

New Zenner

Join Date:
Mar 2005
Posts:
69
Plugin Contributions:
0

Re: Printable, numbered gift certificates

Any chance of sharing "bad file location"? im stuck where you were at. which file did you change location in was it gutsc431n.php in the download folder?

thanks
Mike Z

7 Dec 2011, 5:57 PM
#24
georgfly avatar

georgfly

New Zenner

Join Date:
Apr 2011
Posts:
10
Plugin Contributions:
0

Re: Printable, numbered gift certificates

@ becktowery
you can get product name as op.products_name (this is actually in table "orders_products"), and date of purchase as o.date_purchased (this is actually in table "orders")
and in header_php.php:

  1. add these fields (op.products_name and o.date_purchased) to the sql query in line ~28-36
  2. to add the data to the string that makes up the temporary directory name:

in line ~213, where it says "$tempdir = zen_random_name($downloads->fiel...":
add $downloads->fields['products_name'] and $downloads->fields['date_purchased']
in line ~71, where it says "function zen_random_name($orders_produc...":
add variables passed to the function ("function zen_random_name($orders_products_id, $products_quantity, $products_price, $products_name, $date_purchased)")
in line ~77 $curOrder = $GET['order'] . "" . $orders_products_id . "" . $products_quantity . "" . round($products_price,2) . "" . $products_name . "" . $date_purchased;

before adding extracting the info into the actual pdf, just try to download the original pdf. this may not work now or look screwed up, because you messed around with the temporary directory name, and e.g. added strange characters with products_name, or date_purchsed, so you may want to make sure to change products name to something that is tolerated as part of a directory name, and maybe you also have to modify the format that date_purchased is passed.

anyway, once that is sorted, extract the info in gutsc431nForw.php (underneath line ~18 where it says "// identify order_id, products_price, etc. based on temp fold..." and add as GET variable to $curfileurl (line ~35)

finally, $_GET the new data in gutsc431n

as i said, the only bottleneck is the fact that you pass all data inside this temporary directory name, which may lead to problems if your data contains characters that are not allowed in directory names; furthermore, dompdf may be more choosy on the $curfileurl the we pass in gutsc431nForw.php (line ~37)

hope that is of some help!
G

6 May 2012, 9:52 AM
#25
slobadog avatar

slobadog

New Zenner

Join Date:
Mar 2006
Posts:
89
Plugin Contributions:
0

Re: Printable, numbered gift certificates

A problem I had that broke my brain for most of today... I was getting an "Internal Server Error".

The server log showed:
SoftException in Application.cpp:601: Directory "/home/mydir/public_html/mysite/pub/.ggnshlinhp_7_7_1_0" is writeable by group, referer: http://www.mysite.com.au/index.php?main_page=checkout_success

This occurred when the download button was clicked. It seems not to like the group writeable dir. The fix is simple, as follows:

includes/modules/pages/download/header_php.php around line 223:

mkdir(DIR_FS_DOWNLOAD_PUBLIC . $tempdir, 0777);

Changed to:

mkdir(DIR_FS_DOWNLOAD_PUBLIC . $tempdir, 0755);

Voila! It works now. Hope this saves another fried brain...
(c:

23 Nov 2012, 5:52 PM
#26
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

Re: Printable, numbered gift certificates

becktowery:

Hi Georgefly,

Great addon..

I think I have most of it installed correctly.. Ive got the product all the way up to the download part and the get a 404 error when I hit the download button:

**///Commented///**http://www.epiphanydayspa.com/store/pub/.isznbzi_5_5_1_0.01/gutsc431nForw.phpwww.epiphanydayspa.com/store/dompdf/dompdf.php?input_file=http%3A%2F%2Fwww.epiphanydayspa.com%2Fstore%2Fpub%2F.isznbzi_5_5_1_0.01%2Fgutsc431nForw.php%2F..%2F..%2F..%2Fdownload%2Fgutsc431n%2Fgutsc431n.php%3Forders_id%3D5%26orders_products_id%3D5%26products_quantity%3D1%26cur_price%3D0.01&paper=a4&output_file=GiftCertificate.pdf[/url]

I would LOVE to get this working!
Any ideas?

becktowery:

I figured it out. Bad dompdf url I am now going to try to add fields to be printed. I need a date of purchase and product name. Any thoughts?

I'm having the same issue. Can you please share what you changed to fix this? I've looked and looked, but apparently am completely missing whatever needs to be changed. :wacko:
Thanks!

23 Nov 2012, 11:10 PM
#27
georgfly avatar

georgfly

New Zenner

Join Date:
Apr 2011
Posts:
10
Plugin Contributions:
0

Re: Printable, numbered gift certificates

hi guys.
with respect to adding purchase date, etc. see my last post in this thread.
there is another issue i came across when i recently moved my shop to another webspace. it appeared that the server had problems with symlinks: the file thats called upon clicking the download button (e.g. /pub/.isznbzi_5_5_1_0.01/gutsc431nForw.php) is actually created on the fly as a symlink to the file /download/gutsc431nForw.php
although my server allowed zencart to actually create the symlink file, i would keep getting an access right error message on my browser when trying to download the voucher. in case, anybody runs into the same problem, the solution is to have zen cart make an actual real copy of gutsc431nForw.php rather than just have zen cart create the symlink.
to do that, make some changes in /includes/modules/pages/download/header_php.php

line ~217
replace:
$link_create_status = @symlink(DIR_FS_DOWNLOAD . $origin_filename, DIR_FS_DOWNLOAD_PUBLIC . $tempdir . '/' . $download_link);
with:
$link_create_status = copy(DIR_FS_DOWNLOAD . $origin_filename, DIR_FS_DOWNLOAD_PUBLIC . $tempdir . '/' . $download_link);

also, we want to totally avoid user accidently downloading our php file, if something goes wrong (i saw that this could happen, when i tried to figure out the symlink problem):
line ~227
replace
if ( DOWNLOAD_BY_REDIRECT != 'true' or $link_create_status==false ) {
with
if (substr($origin_filename,-4) != ".php" && ( DOWNLOAD_BY_REDIRECT != 'true' or $link_create_status==false) ) {

23 Nov 2012, 11:29 PM
#28
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

Re: Printable, numbered gift certificates

georgfly:

hi guys.
with respect to adding purchase date, etc. see my last post in this thread.

Hi Georgfly,

Sorry for any confusion. I should have edited the 'quote' I copied. The problem I'm having is when I click the download button, I get:

Forbidden

You don't have permission to access /dompdf/dompdf.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

And the url shows as:

http://steelhorseroad.com/dompdf/dompdf.php?input_file=http%3A%2F%2Fsteelhorseroad.com%2Fstore%2Fpub%2F.sxfleryj_12978_88_1_10%2Fgutsc431nForw.php%2F..%2F..%2F..%2Fdownload%2Fgutsc431n%2Fgutsc431n.php%3Forders_id%3D12978%26orders_products_id%3D88%26products_quantity%3D1%26cur_price%3D10&paper=a4&output_file=My_Fancy_PDF.pdf

A previous poster had a similar issue and said he/she fixed it, that it was a bad url, but didn't post where or what needed to be changed.

Will the code change you posted above fix this issue?

Any help would be greatly appreciated!