| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Printable Gift Certificates for Customer and Backend | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Printable Gift Certificates for Customer and Backend
Gift certificates sure do complicate things, at least for us.
This is my first posted mod so go easy. I'll post others soon. This mod allows you to send each gift certificate recipient a custom graphic they can print and use instore or give to someone else. It also allows you to create a gift certificate using a custom graphic in the backoffice to print up and send. Example http://www.spydorweb.com/images/5F14BC86D0C0D640.jpg This mod is not for the faint of heart and you have to make sure that your hosting server supports the functions used. WARNING!! WARNING!!! WARNING!!!! Backup up your database and xcart directories before making any alterations. Need to have the GD library compiled with PHP. How do you verify this? Create a file called php.php in the root directory Code:
FreeType support must be enabled as well. Ok Getting started 1. Create a basic graphic. Mine is 672pixels X 672pixels. You can see it here http://www.spydorweb.com/images/giftcert.jpg We'll call it giftcert.jpg. Oh it must be a jpg as well. 2. Copy the graphic to files/images/misc/giftcert.jpg 3. Grab this TrueTypeFont File here http://www.spydorweb.com/images/Vera.ttf And throw that in files/images/misc/Vera.ttf as well. 4. add this to the bottom of include/func.php Code:
You will need to edit this function more later I'll explain below. 5. add Code:
to include/func.php (this starts around line 3238) as follows Code:
This will create the image right before it's sent via email and store it in the templates_c directory as <giftcertificate id>.jpg (e.g. 5873F758D81A063C.jpg) 6. Now edit the skin1/mail/html/giftcert.tpl add the following somewhere in the mix Code:
Backoffice side 7. add the file "admin/view_gc.php" Code:
8. edit skin1/admin/modules/Gift_Certificates/gc_admin.tpl (around line 38) replace Code:
with Code:
You can now log into the back office, go to Gift Certificates and there should be a "View" link next to each GC code. Clicking it will create that image and then display it. 9. Last part, you need to edit the position of the text for your custom image. This is done through trial/error. Look back again at the func_create_gc function we added to include/func.php. There are several lines like such Code:
Hey this works for me on v4.0.9. Why didn't I just do an HTML image? A graphic will show the same on all plateforms/email clients and just looks professional.
__________________
No longer using Xcart, was good while it lasted. |
|||||||
#2
|
|||||||||
|
|||||||||
Cant fault you!
That is a quality mod! Gd job
__________________
XC 4.2 inc (unofficial) patch release. |
|||||||||
#3
|
|||||||
|
|||||||
This is a great MOD, My wife had been trying to get me to do this for weeks, last night I finally did it
My Daughter made the graphic not bad for a 15 year old. its amazing what kids can do. http://del-mart.com/pics/giftcert.jpg I am using X-Cart version 4.0.14 and found a few things different than above. Quote:
on my cart it is at skin1/modules/Gift_Certificates/gc_admin.tpl Quote:
files/images/misc dirs had to be created ( I didnt have the images or misc directories in my shopping cart ), I didnt know if they were in the version you used when you posted. Not counting the graphic the whole mod took about 10 mins, then aligning the names and such took about 20 mins. Make sure you print them out because it looks a tad different on the paper than on the screen. Putting the code in the email I still need to play with a little so my customers can find a easy way to print out the cert with out all the other information that comes in the email. Again Awsum job Delw
__________________
Version 4.7.11 |
|||||||
#4
|
|||||||||
|
|||||||||
I just implimented this, but would like the message included too. After attempting to do this I can see why it was left out of the original mod.
The problem is if the message is too long it runs off the side of the image. I had considered using the str_replace() function to rewrite the perios to be periods followed by line breaks, but that would look ugly. I suck at PHP, so if any PHP gurus out there read this, it would be a huge help if you could figure out how to format the message text into multiple lines.
__________________
Alltribes.com Native American Jewelry Pottery, Baskets, Kachinas & More X-cart Gold Version 4.0.17 Live PHP 5.2.6 MySQL 4.1.25 (mt) |
|||||||||
#5
|
|||||||||
|
|||||||||
Ok, I've got it!
Add this after #Company info Code:
Change the 30 to however many characters you want to wrap the text at. And add this with the rest of the ImageTTFText statements Code:
You'll need to mess with the layout a bit
__________________
Alltribes.com Native American Jewelry Pottery, Baskets, Kachinas & More X-cart Gold Version 4.0.17 Live PHP 5.2.6 MySQL 4.1.25 (mt) |
|||||||||
#6
|
|||||||
|
|||||||
Re: Printable Gift Certificates for Customer and Backend
A way to allow the customer to print in 4.1.8 using the templates.
Edit giftcert.php and add: Code:
after Code:
Then in skin1/mail/html/order_data.tpl, add: Code:
after Code:
It works.
__________________
X-Cart Pro 4.1.10 PHP 4.4.2 Apache 2.0.52 RedHat MySQL 4.1.20 |
|||||||
#7
|
|||||||||
|
|||||||||
Re: Printable Gift Certificates for Customer and Backend
I used scottWB's mod to print Gift Certificates in 4.1.9 and it worked nicely! But if you try it, here are a couple of pointers so your edit will go faster than mine.
First, in X-cart 4.1.9 find giftcert.php in the root directory. That wasn't clear to me from the posting above. Second, I was able to print the customers Gift Certificate from the receipt at the end of checkout, but I could not print from the receipt that I display thru Admin/Orders. My fix was to hard code the URL in the order_data.tpl edit. I suspect my shared SSL to be the reason for not being able to print from Admin. Like this worked for me: Code:
__________________
Bullfrog ~~~ X-Cart Gold v4.7.2 (2) v4.7.8. ⌠If the road is easy, you're likely going the wrong way.■ ― Terry Goodkind |
|||||||||
#8
|
|||||||
|
|||||||
Re: Printable Gift Certificates for Customer and Backend
Hello bullfrog,
I have the same version as you and im trying to work this out but failing miserabley. I cannot get ANYTHING to work. Sorry to be a pain. Ive followed ScottWB steps and nothing Regards Chris |
|||||||
#9
|
|||||||
|
|||||||
Re: Printable Gift Certificates for Customer and Backend
ScottWB and/or Bullfrog - I'm a bit confused on how to implement this in 4.1.9. I was wondering if the original code modifications mentioned at the beginning of this thread (by sstillwell) still need to be added or can I just start at ScottWB's post?
__________________
Brian Schade Owner and CTO Twilight Teez, LLC www.twilightteez.com X-Cart 4.1.9 GOLD |
|||||||
#10
|
|||||||||
|
|||||||||
Re: Printable Gift Certificates for Customer and Backend
Sorry for the delay in responding. I don't go to the forum as much as I used to.
From re-reading my 02-26-2008 post, I think I started at scottWB's mod and did not use anything from previous posts. The code in my post is a change I made to scottWB's to get printing to work on my system. If you use my line of code within scottWB's mod, make sure you use your URL where the example shows http: //www.mysite.com. I don't understand his mod, but I followed it and it worked for me. There is more than one file named giftcert.php. Make sure you are editing the one in the root directory. Use a simple text editor to make the edits. Good luck.
__________________
Bullfrog ~~~ X-Cart Gold v4.7.2 (2) v4.7.8. ⌠If the road is easy, you're likely going the wrong way.■ ― Terry Goodkind |
|||||||||
|
|||
X-Cart forums © 2001-2020
|