View Single Post
  #6  
Old 10-03-2007, 04:27 PM
 
scottWB scottWB is offline
 

Member
  
Join Date: Jun 2006
Posts: 19
 

Default 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:
#Added for GC Printing elseif ($mode == 'print') { $giftcerts = false; if (!empty($gcids) && is_array($gcids)) { $tpl_cond = (!empty($tpl_file) ? " AND tpl_file='$tpl_file'" : ''); $giftcerts = func_query("SELECT *, add_date+'".$config["Appearance"]["timezone_offset"]."' as add_date FROM $sql_tbl[giftcerts] WHERE send_via<>'E' AND gcid IN ('".implode("','", array_keys($gcids))."') ".$tpl_cond); } if (empty($giftcerts) || !is_array($giftcerts)) { $top_message['type'] = 'W'; $top_message['content'] = func_get_langvar_by_name("msg_adm_warn_gc_sel"); func_header_location('giftcerts.php'); } foreach ($giftcerts as $k=>$v) { if ($config["General"]["use_counties"] == "Y") $giftcerts[$k]["recipient_countyname"] = func_get_county($v["recipient_county"]); $giftcerts[$k]["recipient_statename"] = func_get_state($v["recipient_state"], $v["recipient_country"]); $giftcerts[$k]["recipient_countryname"] = func_get_country($v["recipient_country"]); } $smarty->assign("giftcerts",$giftcerts); header("Content-Type: text/html"); header("Content-Disposition: inline; filename=giftcertificates.html"); $_tmp_smarty_debug = $smarty->debugging; $smarty->debugging = false; if (!empty($tpl_file)) { $css_file = preg_replace('!\.tpl$!', '.css', $tpl_file); if ($css_file != $tpl_file) { $smarty->assign('css_file', $css_file);; } } func_display("modules/Gift_Certificates/gc_admin_print.tpl",$smarty); $smarty->debugging = $_tmp_smarty_debug; exit; } # End added

after

Code:
elseif ($mode == "delgc") { # # Remove GC from cart # array_splice($cart["giftcerts"],$gcindex,1); func_header_location("cart.php"); }

Then in skin1/mail/html/order_data.tpl, add:

Code:
<!-- Added for Custom Print GC --> <br /><h3><a href="/giftcert.php?mode=print&tpl_file={$gc.tpl_file}&gcids[{$gc.gcid}]=on" target="_blank">Click here for printable gift certificate.</a></h3> <!-- /Added -->

after

Code:
{if $gc.send_via eq "P"} {$lng.lbl_gc_send_via_postal_mail}<br /> {$lng.lbl_mail_address}: {$gc.recipient_firstname} {$gc.recipient_lastname}<br /> {$gc.recipient_address}, {$gc.recipient_city},<br /> {if $gc.recipient_countyname ne ''}{$gc.recipient_countyname} {/if}{$gc.recipient_state} {$gc.recipient_country}, {$gc.recipient_zipcode}<br /> {$lng.lbl_phone}: {$gc.recipient_phone}

It works.
__________________
X-Cart Pro 4.1.10
PHP 4.4.2
Apache 2.0.52 RedHat
MySQL 4.1.20
Reply With Quote