I would like to add a print button to the information page. If possible, I would like to add this on specific information pages only. If not, I guess a print button on all information pages would work also.
Thank you in advance.
try going to code editing mode (by pressing the >< or whatever on the toolbar, or try pressing "source" if its there to go to code mode.
paste this:
Code: Select all
<html>
<head>
<title>PUT ANYTHING YOU WANT HERE</title>
</head>
<body>
<h1>Print Test</h1>
<input type="button"
onClick="window.print()"
value="Print This Page"/>
</body>
</html>
This works partially, as it will print the entire web page, with banners, ads, etc. I would need it to print only the section where the information is.
No problem, and sorry that I dont know how to do. Maybe someone else can chime in and helpwafflemeister wrote:Thank you!
This works partially, as it will print the entire web page, with banners, ads, etc. I would need it to print only the section where the information is.
Find:
Code: Select all
<?php echo $footer; ?>
Code: Select all
<script language="text/javascript">
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
</script>
Code: Select all
onClick="window.print()"
Code: Select all
onclick="printDiv('content')"
Source: http://stackoverflow.com/questions/4688 ... a-div-only
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Text2Print
Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.
OSWorX wrote:Or you could use this OCMod here:
Text2Print
No problem to make also one for 1.5.x - as paid service.wafflemeister wrote:Thank you, this looks great but I unfortunately run 1.5.6.4
OSWorX wrote:Or you could use this OCMod here:
Text2Print
Simply contact me and we can talk further.
Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.
The solution I posted is for 1.5 and 2.x releases and free release.wafflemeister wrote:Thank you, this looks great but I unfortunately run 1.5.6.4
OSWorX wrote:Or you could use this OCMod here:
Text2Print
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
http://forum.opencart.com/viewtopic.php ... 14#p498529
just to mention it!
Ernie
Sample Information Pages:
http://www.hitline.info/shop/index.php? ... ation_id=3
Example Information.tpl Source with Page Print Code included:
Code: Select all
<div id="printview">
<script type="text/javascript">function printDiv(printview){var dd=document.getElementById(printview).innerHTML,ee=document.body.innerHTML;document.body.innerHTML=dd,window.print(),document.body.innerHTML=ee}</script>
<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
<div class="breadcrumb">
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
<?php } ?>
</div>
<h1><?php echo $heading_title; ?></h1>
<?php echo $description; ?>
<div class="buttons">
<div class="right"><a href="javascript:printDiv('printview');" class="button" />Print Page</a> <a href="<?php echo $continue; ?>" class="button"><?php echo $button_continue; ?></a></div>
</div></div>
<?php echo $content_bottom; ?></div>
<?php echo $footer; ?>
Code: Select all
<div id="printview">
<script type="text/javascript">function printDiv(printview){var dd=document.getElementById(printview).innerHTML,ee=document.body.innerHTML;document.body.innerHTML=dd,window.print(),document.body.innerHTML=ee}</script>
Code: Select all
<a href="javascript:printDiv('printview');" class="button" />Print Page</a>
Code: Select all
</div>
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Users browsing this forum: No registered users and 278 guests